Data
TFC’s data types can be created through the TFCEvents.data event in the server_scripts folder
- Climate Range
- Deposit
- Drinkable
- Entity Damage Resistance
- Fauna
- Fertilizer
- Fluid Heat
- Food
- Fuel
- Heat
- Item Damage Resistance
- Item Size
- Knapping Type
- Lamp Fuel
- Support
Most of these methods have an optional final argument which specifies the id of the virtual json file the data will be placed in. For instance, if an id of fish:get_pierced was used for an entity damage resistance, the resulting file would effectively be at data/fish/tfc/entity_damage_restances/get_pierced.json; the tfc/<data_type> folders do not need to be provided
If no id is provided, one will automatically be generated with the namespace kubejs and, unless other wise noted, a path matching the base 16 hash of the (usually) data type’s .toString() value
Additionally, for data types that use ingredients, if there are multiple definitions with the same valid item/block/fluid/entity, then there is no guarantee as to which will take precedence. This situation can be confirmed by using the search command and fixed by either overriding the existing definition or changing the entries in the tag it uses
Most of these methods have an optional final argument which specifies the id of the virtual json file the data will be placed in. For instance, if an id of fish:get_pierced was used for an entity damage resistance, the resulting file would effectively be at data/fish/tfc/entity_damage_restances/get_pierced.json; the tfc/<data_type> folders do not need to be provided
If no id is provided, one will automatically be generated with the namespace kubejs and, unless other wise noted, a path matching the base 16 hash of the (usually) data type’s .toString() value
Additionally, for data types that use ingredients, if there are multiple definitions with the same valid item/block/fluid/entity, then there is no guarantee as to which will take precedence. This situation can be confirmed by using the search command and fixed by either overriding the existing definition or changing the entries in the tag it uses
Climate Range
Defines the values of an existing, registered climate range, does not create new ones
Method Signature
event.climateRange(
range: ClimateRange,
id: ResourceLocation
)
- 1st argument: The climate range, a map of parameters to values
minHydration?: int: The minimum hydration the plant can grow in, defaults to0maxHydration?: int: The maximum hydration the plant can grow in, defaults to100hydrationWiggleRange?: int: Additional hydration range in which the plant can survive, but not necessarily grow, in. Defaults to0minTemperature?: number: The minimum temperature, in °C, the plant can grow in, defaults to-InfinitymaxTemperature?: number: The maximum temperature, in °C, the plant can grow in, defaults toInifinitytemperatureWiggleRange?: number: Additional temperature range in which the plant can survive, but not necessarily grow, in. Defaults to0
- 2nd argument: The registered id of the climate range being defined
Example
TFCEvents.data(event => {
event.climateRange({
minHydration: 15,
maxHydration: 75,
minTemperature: -2,
maxTemperature: 26
}, 'kubejs:circada_crop')
})
Deposit
Add a deposit definition, which allows an item to processed in a pan or sluice
Method Signature
event.deposit(
ingredient: Ingredient,
lootTable: ResouceKey<LootTable>,
modelStages: List<ResourceLocation>,
id?: ResourceLocation
)
- 1st argument: An item ingredient, the items the deposit applies to
- 2nd argument: The id of a loot table, the result of panning/sluicing the item
- 3rd argument: The models to display in sequence while panning
- Optional 4th argument: A
ResourceLocation, the id of the deposit
Example
TFCEvents.data(event => {
event.deposit(
'#minecraft:flowers',
'kubejs:flower_loot',
[
'minecraft:block/poppy',
'minecraft:block/daisy',
'minecraft:block/cornflower'
]
)
})
Drinkable
Add a drinkable definition, allows a fluid to be drunk for thirst, nutrients, and even effects
Method Signature
event.drinkable(
drinkable: Drinkable,
id?: ResourceLocation
)
- 1st argument: The drinkable data, a map of parameters to values
ingredient: FluidIngredient: The fluids the drink data applies toconsumeChance?: number: The chance, in the range[0, 1], a block of fluid will be consumed when drinking from in-worldmayDrinkWhenFull?: boolean: If the player can drink with a full thirst bar,food?: FoodData: Additional food and nutrient data, the same as the food properties of food definitionseffects?: List<Effect>: A list of effects to apply, an effect can be specified as a map oftype: Holder<ModEffect>: The effect to apply1duration: int: How many ticks the effect should be active foramplifier?: int: The level of the effect, defaults to0chance?: number: The chance, in the range[0, 1], the effect is added
- Optional 2nd argument: A
ResourceLocation, the id of the drinkable
Example
TFCEvents.data(event => {
event.drinkable({
ingredient: Fluid.of('lava', 500),
mayDrinkWhenFull: true,
food: {
nutrients: [
0,
0,
0,
500,
0
]
},
effects: [
{
type: 'minecraft:wither',
duration: 500,
amplifier: 3,
chance: 1
}
]
})
})
Entity Damage Resistance
Add an entity damage resistance
Method Signature
event.entityDamageResistance(
entity: TagKey<EntityType<?>>,
resistance: PhysicalDamage,
id?: ResourceLocation
)
- 1st argument: The entities the resistances applies to
- 2nd argument: The resistance data, a map of types to values
piercing?: number: The piercing resistance, may be negative to make the entity weak to piercing. Defaults to0slashing?: number: The slashing resistance, may be negative to make the entity weak to slashing. Defaults to0crushing?: number: The crushing resistance, may be negative to make the entity weak to crushing. Defaults to0
- Optional 3rd argument: A
ResourceLocation, the id of the resistance
TFCEvents.data(event => {
event.entityDamageResistance(
'minecraft:fish',
{
piercing: -800
},
'fish:get_pierced'
)
})
Fauna
Defines the values of an existing, registered fauna, does not create new ones. See the relevant event for doing so
Method Signature
event.fauna(
builder: Consumer<FaunaBuilder>,
id: ResourceLocation
)
- 1st argument: A consumer with several methods
.minTemperature(min: number): Sets the minimum temperature (and the maximum temperature to infinity).maxTemperature(max: number): Sets the maximum temperature (and the minimum temperature to negative infinity).temperature(min: number, max: number): Sets the maximum and minimum temperature.minGroundwater(min: number): Sets the minimum temperature (and the maximum groundwater to infinity).maxGroundwater(max: number): Sets the maximum temperature (and the minimum groundwater to negative infinity).groundwater(min: number, max: number): Sets the maximum and minimum groundwater.minRainVariance(min: number): Sets the minimum rain variance (and maximum rain variance to1and absolute rain variance tofalse).maxRainVariance(max: number): Sets the maximum rain variance (and minimum rain variance to-1and absolute rain variance tofalse)rainVariance(min: number, max: number, absolute: boolean): Sets the permissible rain variance, in the range[-1, 1]and if the sign of the rain variance should be ignored.minForest(min: int): Sets the minimum forest density (and maximum forest density to4).maxForest(max: int): Sets the maximum forest density (and minimum forest density to0).forest(min: int, max: int): Sets the permissible forest density, in the range[0, 4].forestType(types...: ForestType[]): Restricts spawning to within the givenForestTypes.minElevation(min: int): Sets the minimum elevation (and maximum elevation to320).maxElevation(max: int): Sets the maximum elevation (and minimum elevation to-64).elevation(min: int, max: int): Sets the permissible elevation range.months(months: List<Month>): Set theMonths during which spawning is valid.chance(value: int): Sets the spawn chance.distanceBelowSeaLevel(value: int): Sets the distance below sea level required to spawn.maxBrightness(value: int): Sets the maximum light level spawning can occur under.fuzzy(): Makes the temperature, groundwater, and rain variance limits fuzzy when evaluating.solid(): Makes it so spawning can only occur on blocks taggedminecraft:valid_sapwn.ignoreRivers(): Makes river contributions to groundwater are ignored
- 2nd argument: A
ResourceLocation, the id of the fauna
Example
TFCEvents.data(event => {
event.fauna(fauna => {
fauna.temperature(-20, 5)
fauna.forest(1, 3)
fauna.fuzzy()
fauna.solid()
}, 'tfc:fox')
})
Fertilizer
Add a fertilizer definition
Method Signature
event.fertilizer(
fertilizer: Fertilizer,
id?: ResourceLocation
)
- 1st argument: The fertilizer data, a map of parameters to values
ingredient: Ingredient: The ingredient the fertilizer values apply tonitrogen?: number: The nitrogen amount, in the range[0, 1], defaults to0phosphorus?: number: The phosphorus amount, in the range[0, 1], defaults to0potassium?: number: The potassium amount, in the range[0, 1], defaults to0
- Optional 2nd argument: A
ResourceLocation, the id of the fertilizer
Example
TFCEvents.data(event => {
event.fertilizer({
ingredient: 'minecraft:bone_block',
potassium: 0.2,
phosphorus: 0.07
}, 'kubejs:bone')
})
Fluid Heat
Add a fluid heat, required for heating recipes
Method Signature
event.fluidHeat(
fluidHeat: FuidHeat,
id?: ResourceLocation
)
- 1st argument: The fluid heat data, a map of parameters to values
fluid: Fluid: The fluid the heat applies tomeltTemperature: number: The temperature, in °CspecificHeatCapacity: number: The specific heat capacity of the metal, in units of Energy / (°C * mB)
- Optional 2nd argument: A
ResourceLocation, the id of the fertilizer
If no id is specified, the namespace will be kubejs and the path will be the the id of the fluid with a slash between its namespace and path
If no id is specified, the namespace will be kubejs and the path will be the the id of the fluid with a slash between its namespace and path
Example
TFCEvents.data(event => {
event.fluidHeat({
fluid: 'minecraft:lava', // Here, the id of the heat would be kubejs:minecraft/lava
meltTemperature: 1550,
specificHeatCapacity: 0.023
})
})
Food
Add a food definition to an item
Method Signature
event.food(
food: FoodDefinition,
id?: ResourceLocation
)
- 1st argument: The food definition data, a map of parameters to values
ingredient: Ingredient: The items the food applies to
: The food properties, a map of parameters to valuesfood: FoodDatahunger?: int: The amount of hunger to add. A full hunger bar is 20. Defaults to0water?: number: The amount of thirst to restore. A full thirst bar is 100, defaults to0saturation?: number: The amount of saturation to provide, defaults to0intoxication?: int: The number of ticks of intoxication to add to the player, defaults to0nutrients?: number[5]: The nutrient amounts to add to the player, ordered asgrain,fruit,vegetables,protein, anddairy. Defaults to values of0for all nutrientsdecayModifier?: number: The decay modifier to apply, a higher value means a quicker decay
edible?: boolean: If the food is edible, defaults totrue
Fuel
Add a fuel for firepits, charcoal forges, etc.
Method Signature
event.fuel(
fuel: Fuel,
id?: ResourceLocation
)
- 1st argument: The fuel definition, a map of parameters to values
ingredient: Ingredient: The items the fuel applies toduration?: int: The number of ticks the fuel burns for. Defaults to0temperature?: number: The temperature, in °C, the fuel burns at. Defaults to0purity?: number: The purity of the fuel, effects how much smoke the firepit makes when burning the fuel. Defaults to1
- Optional 2nd argument: A
ResourceLocation, the id of the fuel
Heat
Add a heat capability definition to items
Method Signature
event.heat(
heat: HeatDefinition,
id?: ResourceLocation
)
- 1st argument: The heat definition, a map of parameters to values
ingredient: Ingredient: The items the heat applies toheatCapacity: number: The heat capacity of the item, a higher values makes the item take longer to heat upforgingTemperature?: number: The temperature at which the item can be forged2weldingTemperature?: number: The temperature at which the item can be welded2
- Optional 2nd argument: A
ResourceLocation, the id of the heat definition
Example
TFCEvents.data(event => {
event.heat({
ingredient: 'minecraft:gold_ingot',
heatCapacity: 0.5
}, 'kubejs:vanilla_gold')
})
Item Damage Resistance
Add an item damage resistance
Method Signature
event.itemDamageResistance(
ingredient: Ingredient,
resistance: PhysicalDamage,
id?: ResourceLocation
)
- 1st argument: The items the resistance applies to
- 2nd argument: The resistance data, a map of types to values
piercing?: number: The piercing resistance, may be negative to make the entity weak to piercing. Defaults to0slashing?: number: The slashing resistance, may be negative to make the entity weak to slashing. Defaults to0crushing?: number: The crushing resistance, may be negative to make the entity weak to crushing. Defaults to0
- Optional 3rd argument: A
ResourceLocation, the id of the resistance
Example
TFCEvents.data(event => {
event.itemDamageResistance(
'#kubejs:weak_to_slashing',
{
slashing: -30,
piercing: -2,
crushing: 5
}
)
})
Item Size
Add a size and weight definition
event.itemSize(
itemSize: ItemSizeDefinition,
id?: ResourceLocation
)
- 1st argument: A item size definition, a map of parameters to values
ingredient: Ingredient: The items the size applies tosize?: Size: The size, acceptstiny,very_small,small,normal,large,very_large, andhuge. Defaults tosmallweight: Weight: The weight, acceptsvery_light,light,medium,heavy, andvery_heavy. Defaults tolight
- Optional 2nd argument: A
ResourceLocation, the id of the size
Example
TFCEvents.data(event => {
event.itemSize({
ingredient: 'minecraft:netherite_ingot',
weight: 'very_heavy'
}, 'kubejs:heavy_nertherite')
})
Knapping Type
Add a new knapping type for use in knapping recipes
Method Signature
event.knappingType(
knappingType: KnappingType,
id: ResourceLocation
)
- 1st argument: The knapping type definition, a map of parameters to values
inputItem: SizedIngredient: The input for the knapping typeamountToConsume: int: How many items of input to consume when performing a recipeclickSound: Holder<SoundEvent>: The sound to play when knapping3consumeAfterComplete?: boolean: If the items should only be consumed after the recipe completes, defaults tofalsehasOffTexture?: boolean: If the knapping screen should display a second texture for tiles that are off, defaults tofalsespawnsParticles?: boolean: If knapping particles should spawn when clicking a knapping tile, defaults tofalseicon: ItemStack: The item to use as the category icon in recipe viewers
- 2nd argument: A
ResourceLocation, the id of the knapping type
Example
TFCEvents.data(event => {
event.knappingType({
inputItem: Ingredient.of('minecraft:flint', 5),
amountToConsume: 2,
clickSound: 'minecraft:entity.warden.roar',
icon: 'minecraft:flint',
spawnsParticles: true
}, 'kubejs:flint')
})
Lamp Fuel
Add a new lamp fuel
Method Signature
event.lampFuel(
lampFuel: LampFuel,
id?: ResouceLocation
)
- 1st argument: The lamp fuel data, a map of parameters to values
fluid: FluidIngredient: The fluids the fuel applies tolamps: BlockIngredient: The blocks the fuel is valid forburnRate: int: The burn rate, in ticks / mB, of the fuel
- Optional 2nd argument: A
ResourceLocation, the id of the fuel
Example
TFCEvents.data(event => {
event.lampFuel({
fluid: 'minecraft:milk',
lamps: [
'tfc:metal/lamp/blue_steel',
'tfc:metal/lamp/bronze'
],
burnRate: 6
})
})
Support
Add a support
Method Signature
event.support(
ingredient: BlockIngredient,
range: SupportRange,
id?: ResourceLocation
)
- 1st argument: A block ingredient, the blocks the support applies to
- 2nd argument: The support range, a map of parameters to values
up?: int: The number of blocks above the support that are supported, defaults to0down?: int: The number of blocks below the support that are supported, defaults to0horizontal?: int: The number of blocks away that are supported, defaults to0
- Optional 3rd argument: A
ResourceLocation, the id of the support
Example
TFCEvents.data(event => {
event.support(
'#kubejs:wacky_supports'
{
up: 6,
horizontal: 2
},
'kubejs:wacky_support'
)
})
-
A full list of mob effects can be obtained by running the command
/kubejs dump_registry minecraft:mob_effectin-game ↩ -
In TFC, the forging and welding temperatures of an item are typically 60% and 80% of its melting temperature ↩ ↩2
-
A full list of all sound events can be obtained by running the command
/kubejs dump_registry minecraft:sound_eventin-game ↩