Data

TFC’s data types can be created through the TFCEvents.data event in the server_scripts folder

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 to 0
    • maxHydration?: int: The maximum hydration the plant can grow in, defaults to 100
    • hydrationWiggleRange?: int: Additional hydration range in which the plant can survive, but not necessarily grow, in. Defaults to 0
    • minTemperature?: number: The minimum temperature, in °C, the plant can grow in, defaults to -Infinity
    • maxTemperature?: number: The maximum temperature, in °C, the plant can grow in, defaults to Inifinity
    • temperatureWiggleRange?: number: Additional temperature range in which the plant can survive, but not necessarily grow, in. Defaults to 0
  • 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 to
    • consumeChance?: number: The chance, in the range [0, 1], a block of fluid will be consumed when drinking from in-world
    • mayDrinkWhenFull?: 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 definitions
    • effects?: List<Effect>: A list of effects to apply, an effect can be specified as a map of
      • type: Holder<ModEffect>: The effect to apply1
      • duration: int: How many ticks the effect should be active for
      • amplifier?: int: The level of the effect, defaults to 0
      • chance?: 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 to 0
    • slashing?: number: The slashing resistance, may be negative to make the entity weak to slashing. Defaults to 0
    • crushing?: number: The crushing resistance, may be negative to make the entity weak to crushing. Defaults to 0
  • 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 to 1 and absolute rain variance to false)
    • .maxRainVariance(max: number): Sets the maximum rain variance (and minimum rain variance to -1 and absolute rain variance to false)
    • 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 to 4)
    • .maxForest(max: int): Sets the maximum forest density (and minimum forest density to 0)
    • .forest(min: int, max: int): Sets the permissible forest density, in the range [0, 4]
    • .forestType(types...: ForestType[]): Restricts spawning to within the given ForestTypes
    • .minElevation(min: int): Sets the minimum elevation (and maximum elevation to 320)
    • .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 the Months 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 tagged minecraft: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 to
    • nitrogen?: number: The nitrogen amount, in the range [0, 1], defaults to 0
    • phosphorus?: number: The phosphorus amount, in the range [0, 1], defaults to 0
    • potassium?: number: The potassium amount, in the range [0, 1], defaults to 0
  • 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 to
    • meltTemperature: number: The temperature, in °C
    • specificHeatCapacity: 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

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 values
      • hunger?: int: The amount of hunger to add. A full hunger bar is 20. Defaults to 0
      • water?: number: The amount of thirst to restore. A full thirst bar is 100, defaults to 0
      • saturation?: number: The amount of saturation to provide, defaults to 0
      • intoxication?: int: The number of ticks of intoxication to add to the player, defaults to 0
      • nutrients?: number[5]: The nutrient amounts to add to the player, ordered as grain, fruit, vegetables, protein, and dairy. Defaults to values of 0 for all nutrients
      • decayModifier?: number: The decay modifier to apply, a higher value means a quicker decay
    • edible?: boolean: If the food is edible, defaults to true

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 to
    • duration?: int: The number of ticks the fuel burns for. Defaults to 0
    • temperature?: number: The temperature, in °C, the fuel burns at. Defaults to 0
    • purity?: number: The purity of the fuel, effects how much smoke the firepit makes when burning the fuel. Defaults to 1
  • 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 to
    • heatCapacity: number: The heat capacity of the item, a higher values makes the item take longer to heat up
    • forgingTemperature?: number: The temperature at which the item can be forged2
    • weldingTemperature?: 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 to 0
    • slashing?: number: The slashing resistance, may be negative to make the entity weak to slashing. Defaults to 0
    • crushing?: number: The crushing resistance, may be negative to make the entity weak to crushing. Defaults to 0
  • 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 to
    • size?: Size: The size, accepts tiny, very_small, small, normal, large, very_large, and huge. Defaults to small
    • weight: Weight: The weight, accepts very_light, light, medium, heavy, and very_heavy. Defaults to light
  • 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 type
    • amountToConsume: int: How many items of input to consume when performing a recipe
    • clickSound: Holder<SoundEvent>: The sound to play when knapping3
    • consumeAfterComplete?: boolean: If the items should only be consumed after the recipe completes, defaults to false
    • hasOffTexture?: boolean: If the knapping screen should display a second texture for tiles that are off, defaults to false
    • spawnsParticles?: boolean: If knapping particles should spawn when clicking a knapping tile, defaults to false
    • icon: 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 to
    • lamps: BlockIngredient: The blocks the fuel is valid for
    • burnRate: 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 to 0
    • down?: int: The number of blocks below the support that are supported, defaults to 0
    • horizontal?: int: The number of blocks away that are supported, defaults to 0
  • 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'
    )
})
  1. A full list of mob effects can be obtained by running the command /kubejs dump_registry minecraft:mob_effect in-game 

  2. In TFC, the forging and welding temperatures of an item are typically 60% and 80% of its melting temperature  2

  3. A full list of all sound events can be obtained by running the command /kubejs dump_registry minecraft:sound_event in-game