Custom Registry Objects
KubeJS TFC adds the ability to register some TFC-specific non-item/block types
Chisel Mode
Chisel modes are used when chiseling
Part of the tfc:chisel_mode registry and can be created via the default builder in KubeJS’s StartupEvents.registry('tfc:chisel_mode', event => {}) event
Methods
: Sets the ‘priority’ of the chisel mode when sorting chisel modes for cycling.priority(priority: int)- Defaults to
300
- Defaults to
: Sets the texture to use when displayed in the hotbar. Draws the 20 x 20 pixel area at the x and y coordinate.hotbarIcon(textureLocation: ResourceLocation, x: int, y: int)
: Sets the texture to use when displayed in recipe viewers.recipeIcon(textureLocation: ResourceLocation, x: int, y: int, width: int, height: int)
: Sets the behavior when chiseling is performed. Accepts a callback with the params.chiselBehavior(behavior: ChiselBehavior)original: BlockState: The original state being chiseledchiseled: BlockState: The chiseled state specified by the recipeplayer: Player: The player chiselinghit: BlockHitResult: The hit result of the playerreturn: @Nullable BlockState: The chiseled state to place in-world- May be
nullto indicate an invalid value and cancel the recipe Defaults to returning thechiseledstate
- May be
Example
StartupEvents.registry('tfc:chisel_mode', event => {
event.create('my_chisel_mode')
.hotbarIcon('kubejs:block/my_chisel_mode/hotbar', 0, 0)
.recipeIcon('kubejs:block/my_chisel_mode/recipe', 0, 0, 20, 20)
.chiselBehavior((original, chiseled, player, hit) => {
if (original.hasBlockEntity()) {
return null
} else {
return chiseled
}
})
})
Climate Model Type
Climate models define the temperature, rainfall, and other climatic factors of a world. They are created and added to a level at world-start, but must have a registered type. KubeJS TFC adds the ability to create types and easily create models from them
Part of the tfc:climate_model registry and can be created via the default builder in KubeJS’s StartupEvents.registry('tfc:climate_model', event => {}) event
Methods
: Sets the wind calculation of the model, accepts a callback with the params.wind(wind: WindFunction)model: ClimateModel: TheClimateModelthe wind is being calculated forlevel: Level: The level wind is being calculated forpos: BlockPos: The position the wind is being calculated forcalendarTick: int: The calendar tick at which wind is being calculated atdaysInMonth: int: The number of days in a monthwind: Function<number, number, Vec2>: A helper function to create aVec2without reflection. Use.blow(x: float, z: float)to do soreturn: Vec2: The calculated horizontal wind vector
: A.fog(fog: TimelessClimateValueFunction)TimelessClimateValueFunction, the fog calculation of the model- Returned values will be clamped to
[0, 1]
- Returned values will be clamped to
: A.calendarFog(fog: ClimateValueFunction)ClimateValueFunction, the fog calculation of the model- Returned values will be clamped to
[0, 1]
- Returned values will be clamped to
: A.averageTemperature(temp: TimelessClimateValueFunction)TimelessClimateValueFunction, the average temperature, in °C, calculation of the model
: A.averageRainfall(rain: TimelessClimateValueFunction)TimelessClimateValueFunction, the average rainfall calculation of the model- Returned values will be clamped to
[0, )
- Returned values will be clamped to
: A.rainVariance(variance: TimelessClimateValueFunction)TimelessClimateValueFunction, the rain variance calculation of the model- Returned values will be clamped to
[-1, 1]
- Returned values will be clamped to
: The calculation for if its currently thundering at a calendar tick, given it is raining. Accepts a callback with the params.thunder(thunder: BiPredicate<ClimateModel, int>)model: ClimateModel: TheClimateModelthe calculation is forcalendarTick: int: The calendar tick being evaluated atreturn: boolean: If it is thundering at the tick
: Sets the calculation for the rain intensity. Accepts a callback with the parameters.rainIntensity(intensity: BiFunction<ClimateModel, int, number>)model: ClimateModel: TheClimateModelthe calculation is forcalendarTick: int: The calendar tick being evaluated atreturn: number: The intensity, typically in the range[0, 1], but may be greater to indicate extreme rain intensity or negative to indicate it is not raining
: A.instantaneousTemperature(temp: ClimateValueFunction)ClimateValueFunction, the calculation for the instantaneous temperature of the model
:A.instantaneousRainfall(rain: ClimateValueFunction)ClimateValueFunction, the calculation for the instantaneous rainfall of the model
: A.baseGroundwater(groundwater: TimelessClimateValueFunction)TimelessClimateValueFunction, the groundwater calculation of the model- Returned values will be clamped to
[0, )
- Returned values will be clamped to
TimelessClimateValueFunction
A callback with the following parameters
model: ClimateModel: TheClimateModelthe value is being calculated forlevel: LevelReader: The level the value is being calculated inpos: BlockPos: The position the value is being calculated atreturn: number: The calculated value
ClimateValueFunction
A callback with the following parameters
model: ClimateModel: TheClimateModelthe value is being calculated forlevel: LevelReader: The level the value is being calculated inpos: BlockPos: The position the value is being calculated atcalendarTick: int: The calendar tick at which the value is being calculated atdaysInMonth: int: The number of days in a monthreturn: number: The calculated value
Example
StartupEvents.registry('tfc:climate_model', event => {
event.create('hell')
.wind((model, level, pos, calendarTick, daysInMonth, wind) => {
let direction = calendarTick / 1000
return wind.blow(Math.sin(direction), Math.cos(direction)).scale(Math.cos(direction) * 100)
})
.thunder((model, calendarTick) => true)
.rainIntensity((model. calendarTick) => 2)
.averageTemperature((model, level, pos) => {
return pos.y > 20 ? 88 : 92
})
.instantaneousTemperature((model, level, pos, calendarTick, daysInMonth) => {
let yearLength = daysInMonth * 12 * TFC.calendar.CALENDAR_TICKS_IN_DAY
let yearPortion = (calendarTick % yearLength) / yearLength
// +/- 7 degrees dependent on progress through year
let currentDeviation = Math.cos(yearPortion * 2 * Math.PI) * 7
// use the model's average temperate (as calculated above) as a base
return model.getAverageTemperature(level, pos) + currentDeviation
})
})
Food Trait
Food traits can be applied to food items to modify how long it takes them to expire
Part of the tfc:food_trait registry and can be created via the default builder in KubeJS’s StartupEvents.registry('tfc:food_trait', event => {}) event
Methods
: Sets the decay modifier of the trait.decayModifier(modifier: number)- A larger value results in a quicker expiry
- Defaults to
1
: Sets the modifier of the trait as a supplier.decayModifierSupplier(modifier: Supplier<number>)- Defaults to
() => 1
- Defaults to
: Gives the food trait a tooltip with the specified translation key.tooltipKey(key: String)
: Gives the food trait a tooltip with the given text, autogenerating a lang key if not already specified.tooltipText(text: Component)
Example
StartupEvents.registry('tfc:food_trait', event => {
event.create('my_trait')
.decayModifier(0.5)
.tooltipText('Well preserved')
})
Glass Operation
Glass operations are used in glassworking recipes and are performed by specific items and tools
Part of the tfc:glass_operation registry and can be created via the default builder in KubeJS’s StartupEvents.registry('tfc:glass_operation', event => {}) event
Methods
: Marks the operation as being associated with a powder item and sets the texture used in the powder bowl.powder(texture: ResourceLocation)
: Sets the minimum temperature, in °C, required to apply the operation.workingTemperature(temperature: number)- Defaults to
480
- Defaults to
: Sets the sound1 to use when the operation is applied.applicationSound(sound: Holder<SoundEvent>).items(items...: Holder<Item>[]): Sets the items associated with the operation, used for recipe viewers and, if a powder, powder bowls
Example
StartupEvents.registry('tfc:glass_operation', event => {
event.create('my_operation')
.powder('minecraft:block/cobblestone')
.items('kubejs:stone_dust', 'kubejs:pulverized_mineral_sample')
})
Item Stack Modifier
Item stack modifiers are used by ItemStackProviders to modify a stack, typically at the completion of a recipe
Part of the tfc:item_stack_modifiers registry and can be created via the default builder in KubeJS’s StartupEvents.registry('tfc:item_stack_modifiers', event => {}) event
Methods
: The behavior of the modifier, a callback with the params.applicator(applicator: BiFunction<ItemStack, StackModifierContext, ItemStack>)stack: ItemStack: The original output stack, may be freely modifiedcontext: StackModifierContext: The context under which the modifier is being applied, may be eitherdefaultorno_random_chancereturn: ItemStack: The modified output item stack
: The behavior of the modifier, a callback with the params.applicatorWithInput(applicator: TriFunction<ItemStack, ItemStack, StackModifierContext, ItemStack>)stack: ItemStack: The original output stack, may be freely modifiedinput: ItemStack: The input stack, should not be modified in any waycontext: StackModifierContext: The context under which the modifier is being applied, may be eitherdefaultorno_random_chancereturn: ItemStack: The modified output item stack
: The behavior of the modifier, a callback with the params.applicatorWithInventory(applicator: QuadFunction<ItemStack, ItemStack, StackModifierContext, Iterable<ItemStack>, ItemStacl>)stack: ItemStack: The original output stack, may be freely modifiedinput: ItemStack: The input stack, should not be modified in any waycontext: StackModifierContext: The context under which the modifier is being applied, may be eitherdefaultorno_random_chanceinventory: Iterable<ItemStack>: An iterable view of the inventory’s itemsreturn: ItemStack: The modified output item stack
Example
StartupEvents.registry('tfc:item_stack_modifiers', event => {
event.create('copy_cheese')
.applicatorWithInput((stack, input, ctx) => {
if (input.has('cheese_mod:cheese')) {
stack.patch({
'cheese_mod:cheese': input.get('cheese_mod:cheese')
})
}
return stack
})
})
Rock Setting
Rock settings define a collection of blocks that can be used for a rock layer in TFC’s world generation
Part of the tfc:worldgen/rock_settings registry and can be created via the default builder in KubeJS’s ServerEvents.registry('tfc:worldgen/rock_settings', event => {}) event
Methods
: The raw block of the setting.raw(b: Block)- Must be set
: The hardened block of the setting.hardened(b: Block)- Must be set
: The gravel block of the setting.gravel(b: Block)- Must be set
: The cobble block of the setting.cobble(b: Block)- Must be set
: The sand block of the setting.sand(b: Block)- Must be set
: The sandstone block of the setting.sandstone(b: Block)- Must be set
: The spike block of the setting.spike(b: Block)- Requires TFC’s spike part block state property
: The loose rock block of the setting.loose(b: Block)- Requires TFC’s rock count block state property
: The mossy loose rock block of the setting.mossyLoose(b: Block)- Requires TFC’s rock count block state property
: Marks the setting as being karst.karst()
: Marks the setting as being mafic.mafic()
Example
ServerEvents.registry('tfc:worldgen/rock_settings', event => {
event.create('vanilla')
.raw('minecraft:stone')
.hardened('minecraft:deepslate')
.gravel('minecraft:gravel')
.cobble('minecraft:cobblestone')
.sand('minecraft:sand')
.sandstone('minecraft:sandstone')
.mafic()
})
Spring Water
A fluid registry type
Type: tfc:spring
Creates a fluid which emits steam and bubble particles and heals the player when inside it
Inherits all the methods of the base fluid builder
Extra Methods
: Set the bubble particle options of the fluid via the id of a particle type or.bubbleParticle(particle: @Nullable Holder<ParticleType<?>>)nullto indicate the fluid has no bubble particles
: Set the bubble particle options of the fluid.fullBubbleParticle(bubble: Supplier<ParticleOptions>)
: Set the steam particle options of the fluid via the id of a particle type of.steamParticle(particle: @Nullable Holder<ParticleType<?>>)nullto indicate the fluid has no steam particles
: Set the steam particle options of the fluid.fullSteamParticle(steam: Supplier<ParticleOptions>)
: Set the health the fluid restores while a living entity is in it, defaults to.healingAmount(healing: number)0.08
Example
StartupEvents.registry('fluid', event => {
event.create('spring', 'tfc:spring')
.bubbleParticle(null)
.healingAmount(5)
})
-
A full list of sounds can be obtained by running the command
/kubejs dump_registry minecraft:sound_eventin-game ↩