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
The registry for chisel modes is tfc:chisel_mode
Methods
: Sets the ‘priority’ of the chisel mode when sorting chisel modes for cycling. Defaults to.priority(priority: int)300
: 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 null to indicate an invalid value Defaults to returning thechiseledstate
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 (orginal.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
The registry for climate model types is tfc:climate_model
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
: Sets the fog calculation of the model, accepts a.fog(fog: TimelessClimateValueFunction)TimelessClimateValueFunction. The returned value will be clamped to[0, 1]
: Sets the fog calculation of the model, accepts a.calendarFog(fog: ClimateValueFunction)ClimateValueFunction. The returned value will be clamped to[0, 1]
: Sets the average temperature calculation of the model. Accepts a.averageTemperature(temp: TimelessClimateValueFunction)TimelessClimateValueFunctionwhich returns the average temperature, in °C, at the position
: Sets the average rainfall calculation of the model, accepts a.averageRainfall(rain: TimelessClimateValueFunction)TimelessClimateValueFunction. Returned values will be clamped to[0, Infinity)
: Sets the rain variance calculation of the model, accepts a.rainVariance(variance: TimelessClimateValueFunction)TimelessClimateValueFunction. Returned values will be clamped to[-1, 1]
: Sets the calculation for if its currently raining 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
: Sets the calculation for the instantaneous temperature of the model, accepts a.instantaneousTemperature(temp: ClimateValueFunction)ClimateValueFunction
: Sets the calculation for the instantaneous rainfall of the model, accepts a.instantaneousRainfall(rain: ClimateValueFunction)ClimateValueFunction
: Sets the groundwater calculation of the model, accepts a.baseGroundwater(groundwater: TimelessClimateValueFunction)TimelessClimateValueFunction. Returned values will be clamped to[0, Infinity)
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 dir = calendarTick / 1000
return wind.blow(Math.sin(dir), Math.cos(dir)).scaled(Math.cos(dir) * 100)
})
.thunder((model, calendarTick) => true)
.rainIntensity((model, calendarTick) => 2)
.averageTemperature((model, level, pos) => {
return pos.y > 20 ? 88 : 92
})
.instantaneousTemperature((model, level, pos, calendarTicks, daysInMonth) => {
let yearlength = daysInMonth * 12 * 24000
let yearPortion = (calendarTicks % yearLength) / yearLength
// +/- 7 degrees dependent on progress through year
let currentDeviation = Math.cos(yearPortion * 2 * Math.PI) * 7
// Use the model's average temperature (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
The registry for food traits is tfc:food_trait
Methods
: Sets the decay modifier of the trait. A larger value results in a quicker expiry.decayModifier(modifier: number)
: Sets the modifier of the trait as a supplier.decayModifierSupplier(modifier: Supplier<number>)
: 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
The registry for glass operations is tfc:glass_operation
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 required to apply the operation.workingTemperature(temperature: number)
: 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
The registry for item stack modifiers is tfc:item_stack_modifiers
Methods
: Sets the behavior of the modifier, accepts a callback with the params.applicator(applicator: BiFunction<ItemStack, StackModifierContext, ItemStack>)stack: ItemStack: The original output stack, my be freely modifiedcontext: StackModifierContext: The context under which the modifier is being applied, may be eitherdefaultorno_random_chancereturn: ItemStack: The modified output item stack
: Sets the behavior of the modifier, accepts 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 applies, may be eitherdefaultorno_random_chancereturn: ItemStack: The modified output item stack
: Sets the behavior of the modifier, accepts 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
})
})
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 ↩