Data
KubeJS TFC allows users to easily write TFC’s custom data types in the TFCEvents.data event
- Climate Ranges
- Damage Resistances
- Drinkables
- Fauna
- Fertilizers
- Food Items
- Fuels
- Item Heats
- Item Size
- Knapping Types
- Lamp Fuels
- Metals
- Supports
- Sluicing
- Panning
If FirmaLife
is installed, the following are also available
If Beneath
is installed, the following are also available
This event goes in the server_events folder.
Additionally, the ability to access and manipulate some of TFC’s non-datapack accessible data TFC adds to the player is accessible form a Player object in scripts. See Attached TFC Data for specifics
Most of these methods have an optional final argument which specifies the ‘name’ of the definition
This refers to the directory location of the virtual json file, for instance if, for a entity resistance, you gave it the name kubejs:fish_get_pierced, the resulting file would act as if it had been placed in data/kubejs/tfc/entity_damage_resistances/fish_get_pierced.json, the tfc/<dataType> folders do not need to be provided
If no name is provided, one will be automatically generated with the namespace kubejs_tfc and, unless otherwise noted, a path matching a base 16 hash of the (usually) 1st argument’s .toString() value
Additionally, for definitions that use ingredients, if there are multiple definitions that have the same valid item/block/fluid, then there is no guarantee your custom definition will take precedence. This can be fixed by overriding the existing definition or modifying the tag that is used for it
Most of these methods have an optional final argument which specifies the ‘name’ of the definition
This refers to the directory location of the virtual json file, for instance if, for a entity resistance, you gave it the name kubejs:fish_get_pierced, the resulting file would act as if it had been placed in data/kubejs/tfc/entity_damage_resistances/fish_get_pierced.json, the tfc/<dataType> folders do not need to be provided
If no name is provided, one will be automatically generated with the namespace kubejs_tfc and, unless otherwise noted, a path matching a base 16 hash of the (usually) 1st argument’s .toString() value
Additionally, for definitions that use ingredients, if there are multiple definitions that have the same valid item/block/fluid, then there is no guarantee your custom definition will take precedence. This can be fixed by overriding the existing definition or modifying the tag that is used for it
Climate Ranges
See the main page!
Climate ranges cannot be added through this, only existing, registered ones can be modified
Method Signature
event.climateRange(
climateRange: Consumer<BuildClimateRangeData>,
name: ResourceLocation
)
- 1st argument: A consumer with several additional methods:
: Accepts a number, in the range.minHydration(i: number)[0, 100], specifying the minimum hydration, defaults to0
: Accepts a number, in the range.maxHydration(i: number)[0, 100], specifying the maximum hydration, defaults to100
: Accepts a number, specifying the wiggle range for hydration when consulting wiggliness is enabled, defaults to.hydrationWiggle(i: number)0
: Accepts a number, in the range.minTemperature(f: number)[-100, 100], specifying the minimum temperature, defaults to-100
: Accepts a number, in the range.maxTemperature(f: number)[-100, 100], specifying the maximum temperature, defaults to100
: Accepts a number specifying the wiggle range for temperature when consulting wiggliness is enabled, defaults to.temperatureWiggle(f: number)0
- 2nd argument: A
ResourceLocation, the name of the climate range
Example
TFCEvents.data(event => {
event.climateRange(climate => {
climate.maxHydration(45)
climate.minHydration(30)
climate.minTemperature(50)
}, 'tfc:barley')
})
Damage Resistances
See the main page!
Method Signatures
event.itemDamageResistance(
ingredient: Ingredient,
piercing: @Nullable number,
slashing: @Nullable number,
crushing: @Nullable number,
name?: ResourceLocation
)
event.entityDamageResistance(
entityTag: String,
piercing: @Nullable number,
slashing: @Nullable number,
crushing: @Nullable number,
name?: ResourceLocation
)
- 1st argument:
- For items: An ingredient, the armor items the resistance applies to
- For entities: A string, the entity tag to be given the resistance
- 2nd argument: A number, the piercing resistance, may be
nullto not specify a resistance - 3rd argument: A number, the slashing resistance, may be
nullto not specify a resistance - 4th argument: A number, the crushing resistance, may be
nullto not specify a resistance - Optional 5th argument: A
ResourceLocation, the name of the resistance
Examples
TFCEvents.data(event => {
event.itemDamageResistance(
'minecraft:iron_helmet',
300,
2,
null
)
event.entityDamageResistance(
'tfc:small_fish',
-500,
null,
3,
'kubejs:fish_get_pierced'
)
})
Drinkables
See the main page!
Method Signature
event.drinkable(
fluidIngredient: FluidIngredient,
drinkableData: Consumer<BuildDrinkableData>,
name?: ResourceLocation
)
- 1st argument: A fluid ingredient which defines which fluids the drinkable applies to
- 2nd argument: A consumer with several additional methods:
: Accepts a number, in the range.consumeChance(f: number)[0, 1], and sets the chance that a source block will be removed when drank from, defaults to0
: Accepts a number, in the range.thirst(i: number)[0, 100], the amount of thirst the drinkable consumes per 25mB drank, defaults to0
: Accepts a number, ≥ 0, and sets the number of ticks the player will be intoxicated for per 25mB drank, defaults to.intoxication(i: number)0
: Accepts a string, the name of the effect1 to be applied, and an optional consumer with several additional methods:.effect(effect: String, effectData?: Consumer<BuildEffectData>).duration(i: number): Accepts a number specifying the number of ticks the effect is applied for, defaults to20.amplifier(i: number): Accepts a number specifying the level of the potion effect applied, defaults to0.chance(f: number): Accepts a number, in the range[0, 1], specifying the chance the effect will be applied per 25mB drank, defaults to1
: Accepts a consumer with the same methods as the one in food items.food(foodData: Consumer<BuildFoodItemData>)
- Optional 3rd argument: A
ResourceLocation, the name of the drinkable
Example
TFCEvents.data(event => {
event.drinkable('minecraft:lava', data => {
data.thirst(25)
data.effect('minecraft:wither', effect => {
effect.amplifier(5)
effect.duration(200)
})
data.food(food => {
food.protein(3)
food.hunger(2)
})
})
})
Fauna
See the main page!
Faunas cannot be added through this, only existing, registered ones can be modified
To register a fauna definition see the event for registering them
Faunas cannot be added through this, only existing, registered ones can be modified
To register a fauna definition see the event for registering them
Method Signature
event.fauna(
climateData: Consumer<PlacedFeatureProperties$Climate>,
faunaData: Consumer<BuildFaunaData>,
name: ResourceLocation
)
- 1st argument: A consumer with methods matching those of the placed feature climate decorator
- 2nd argument: A consumer with several additional methods:
: Accepts a number, sets the chance in.chance(i: number)1/Nchunks that something will spawn, defaults to1
: Accepts a number, sets the distance below sea level something must spawn, should only be set for underwater creatures.distanceBelowSeaLevel(i: number)
: Accepts a boolean, determines if the mob is required to spawn on a block tagged.solidGround(b: boolean)minecraft:valid_spawn, defaults tofalse
: Accepts a number, sets the maximum light level the mob may spawn in.maxBrightness(i: number)
- 3rd argument: A
ResourceLocation, the name of the fauna
Example
TFCEvents.data(event => {
event.fauna(climate => {
climate.minTemp(90)
}, fauna => {
fauna.chance(30)
fauna.maxBrightness(4)
}, 'tfc:pufferfish')
})
Fertilizers
See the main page!
Method Signature
event.fertilizer(
ingredient: Ingredient,
nitrogen: @Nullable number,
posphorus: @Nullable number,
potassium: @Nullable number,
name?: ResourceLocation
)
- 1st argument: An item ingredient, the items the fertilizer applies to
- 2nd argument: A number, sets the nitrogen value of the fertilizer, may be
nullto not set a value, defaults to0 - 3rd argument: A number, sets the phosphorus value of the fertilizer, may be
nullto not set a value, defaults to0 - 4th argument: A number, sets the potassium value of the fertilizer, may be
nullto not set a value, defaults to0 - Optional 5th argument: A
ResourceLocation, the name of the fertilizer
Example
TFCEvents.data(event => {
event.fertilizer(
'minecraft:rooted_dirt',
0.2,
null,
0.1,
'kubejs:root_fertilizer'
)
})
Food Items
See the main page!
Items with food data still require vanilla’s food properties in order for the game to know they are consumable
Method Signature
event.foodItem(
ingredient: Ingredient,
foodItemData: Consumer<BuildFoodItemData>,
name?: ResourceLocation
)
- 1st argument: An item ingredient, the items to which the food item definition applies to
- 2nd argument: A consumer with several additional methods:
: Accepts a string, sets the food definition to be a special type, accepts either.type(type: String)dynamicordynamic_bowl. See the main page for specifications on what this is used for. If this is set, other values should not be set
: Accepts a number, sets how much hunger the food restores, defaults to.hunger(i: number)4. A full hunger bar is20
: Accepts a number, sets how much saturation the food restores, defaults to.saturation(f: number)0
: Accepts a number, sets how much water the food restores, defaults to.water(f: number)0. A full water bar is equal to100
: Accepts a number, sets how quickly the food decays, defaults to.decayModifier(f: number)1. A higher number indicates a faster decay rate
: Accepts a number, sets the amount of grain nutrient the food restores, defaults to.grain(f: number)0
: Accepts a number, sets the amount of fruit nutrient the food restores, defaults to.fruit(f: number)0
: Accepts a number, sets the amount of vegetable nutrient the food restores, defaults to.vegetables(f: number)0
: Accepts a number, sets the amount of protein nutrient the food restores, defaults to.protein(f: number)0
: Accepts a number, sets the amount of dairy nutrient the food restores, defaults to.dairy(f: number)0
- Optional 3rd argument: A
ResourceLocation, the name of the food definition
Example
TFCEvents.data(event => {
event.foodItem('minecraft:cooked_porkchop', food => {
food.hunger(3)
food.protein(1.3)
food.decayModifier(1.5)
})
})
Fuels
See the main page!
Method Signature
event.fuel(
ingredient: Ingredient,
temperature: number,
duration: number,
purity: @Nullable number,
name?: ResourceLocation
)
- 1st argument: An item ingredient, the items the fuel applies to
- 2nd argument: A number, the temperature °C that the fuel burns at
- 3rd argument: A number, the number of ticks the fuel burns for
- 4th argument: A number, the purity of the fuel, may be
nullto not specify a value - Optional 5th argument: A
ResourceLocation, the name of the fuel
Example
TFCEvents.data(event => {
event.fuel('minecraft:coal_block', 1575, 3500, 0.95)
})
Item Heats
See the main page!
Method Signature
event.itemHeat(
ingredient: Ingredient,
heatCapacity: number,
forgingTemperature: @Nullable number,
weldingTemperature: @Nullable number,
name?: ResourceLocation
)
- 1st argument: An item ingredient, the items the heat definition applies to
- 2nd argument: A number, specifies how fast the the item heats up relative to others, measured in Energy / °C
- 3rd argument: A number, specifies the temperature at which the item can be worked, may be
nullto allow working at any temperature - 4th argument: A number, specifies the temperature at which the item can be welded, may be
nullto allow welding at any temperature - Optional 5th argument: A
ResourceLocation, the name of the heat definition
Example
TFCEvents.data(event => {
event.itemHeat('minecraft:netherite_ingot', 0.7, null, 1700)
})
Item Size
See the main page!
Method Signature
event.itemSize(
ingredient: Ingredient,
size: @Nullable Size,
weight: @Nullable Weight,
name?: ResourceLocation
)
- 1st argument: An item ingredient, the items the size applies to
- 2nd argument: A
Size, sets the size of the item, may betiny,very_small,small,normal,large,very_large,huge, ornullto not specify a size - 3rd argument: A
Weight, sets the weight of the item, may bevery_light,light,medium,heavy,very_heavy, ornullto not specify a weight - Optional 4th argument: A
ResourceLocation, the name of the size definition
Example
TFCEvents.data(event => {
event.itemSize('minecraft:gold_ingot', 'huge', 'very_heavy')
})
Knapping Types
See the main page!
Knapping ingredients must have the tfc:any_knapping tag. While this tag can be reloaded at runtime, a game restart is required for any changes to affect knapping interactions
Additionally, the textures used by the screen itself should be placed in /assets/tfc/textures/gui/knapping/<item_path>.png and /assets/tfc/textures/gui/knapping/<item_path>_disabled.png if a disabled texture is used
Knapping ingredients must have the tfc:any_knapping tag. While this tag can be reloaded at runtime, a game restart is required for any changes to affect knapping interactions
Additionally, the textures used by the screen itself should be placed in /assets/tfc/textures/gui/knapping/<item_path>.png and /assets/tfc/textures/gui/knapping/<item_path>_disabled.png if a disabled texture is used
Method Signature
event.knappingType(
ingredient: Ingredient,
ingredientCount: number,
amountToConsume: number,
clickSound: String,
consumeAfterComplete: boolean,
useDisabledTexture: boolean,
spawnsParticles: boolean,
jeiIconItem: ItemStack,
name: ResourceLocation
)
- 1st argument: An item ingredient, the ingredient for what item has to be knapped, must be part of the
tfc:any_knappingtag to work. You may also need to restart the MC instance for the game to recognize the item has been added to the tag - 2nd argument: A number, the minimum number of items matching the ingredient that must be held in order open the knapping menu
- 3rd argument: A number, the number of items that gets used by a recipe
- 4th argument: A string, the registry name of a sound event that plays when knapping occurs2
- 5th argument: A boolean, determines if the inputs should be consumed when the first square is clicked or when the result is removed
- 6th argument: A boolean, if true, a clicked spot will show a different texture rather than nothing
- 7th argument: A boolean, determines if the screen should spawn small particles when clicking buttons
- 8th argument: An
ItemStack, the icon item for the JEI recipe category - 9th argument: A
ResourceLocation, the name of the knapping type
Example
TFCEvents.data(event => {
event.knappingType(
'minecraft:deepslate',
1,
5,
'minecraft:entity.warden.roar',
false,
true,
true,
'minecraft:deepslate',
'kubejs:deepslate'
)
})
Lamp Fuels
See the main page!
Method Signature
event.lampFuel(
fluidIngredient: FluidIngredient,
blockIngredient: BlockIngredient,
burnRate: number,
name?: ResourceLocation
)
- 1st argument: A FluidIngredient, determines which fluids the lamp fuel applies to
- 2nd argument: A BlockIngredient, determines what (lamp) blocks are valid for this fuel to be added to
- 3rd argument: A number, represents how fast the fuel is consumed, in ticks per mB
- Optional 4th argument: A
ResourceLocation, the name of the lamp fuel
Example
TFCEvents.data(event => {
event.lampFuel('tfc:salt_water', '#tfc:lamps', 1)
})
Metals
See the main page!
Method Signature
event.metal(
fluid: Fluid,
meltTemperature: number,
heatCapacity: number,
ingot: @Nullable Ingredient,
doubleIngot: @Nullable Ingredient,
sheet: @Nullable Ingredient,
tier: number,
name?: ResourceLocation
)
- 1st argument: A
Fluid, the fluid this metal is built upon - 2nd argument: A number, the melting temperature of the metal
- 3rd argument: A number, specifies how fast the metal heats up relative to others, measured in Energy / (mB * °C)
- 4th argument: An item ingredient, defines the ingots of the metal, may be
nullto indicate the metal does not have any ingots. The item also requires thetfc:pileable_ingotstag in order to be placeable - 5th argument: An item ingredient, defines the double ingots of the metal, may be
nullto indicate the metal does not have any double ingots. The item also requires thetfc:pileable_double_ingotstag in order to be placeable - 6th argument: An item ingredient, defines the sheets of the metal, may be
nullto indicate the metal does not have any sheets. The item also requires thetfc:pileable_sheetstag in order to be placeable - 7th argument: A number, the tier of the metal
- Optional 8th argument: A
ResourceLocation, the name of the metal
If no name is provided, one will be automatically generated from the fluid
The name is generated like so:
- The namespace becomes
kubejs_tfc - the path becomes the name of the fluid with the following applied:
- All non
a-z0-9 characters are replaced with _ - All repeating
_s are shortened to just one _ - Any preceding or trailing
_s are removed - The string is limited to its first 65 characters if applicable
If no name is provided, one will be automatically generated from the fluid
The name is generated like so:
- The namespace becomes
kubejs_tfc - the path becomes the name of the fluid with the following applied:
- All non
a-z0-9characters are replaced with_ - All repeating
_s are shortened to just one_ - Any preceding or trailing
_s are removed - The string is limited to its first 65 characters if applicable
- All non
Example
TFCEvents.data(event => {
event.metal(
'minecraft:lava',
2000,
0.5,
null,
null,
'kubejs:lava_sheet',
3,
'kubejs:lava' // If the name had not be specified, it would have been 'kubejs_tfc:minecraft_lava'
)
})
Supports
See the main page!
Method Signature
event.support(
blockIngredient: BlockIngredient,
up: number,
down: number,
horizontal: number,
name?: ResourceLocation
)
- 1st argument: A BlockIngredient, determines what blocks the support applies to
- 2nd argument: A number, the number of blocks up the block supports
- 3rd argument: A number, the number of blocks down the block supports
- 4th argument: A number, the number of blocks horizontally the block supports
- Optional 5th argument: A
ResourceLocation, the name of the support
Example
TFCEvents.data(event => {
event.support('minecraft:cobblestone_wall', 3, 4, 10)
})
Sluicing
See the main page!
Method Signature
event.sluicing(
ingredient: Ingredient,
lootTable: String,
name?: ResourceLocation
)
- 1st argument: An item ingredient, the items the sluicing definition applies to
- 2nd argument: A string, the location of a loot table to be dropped for this item
- Optional 3rd argument: A
ResourceLocation, the name of the sluicing definition
Example
TFCEvents.data(event => {
event.sluicing('minecraft:rooted_dirt', 'kubejs:roots')
})
Panning
See the main page!
Method Signature
event.panning(
blockIngredient: BlockIngredient,
lootTable: String,
models: String[],
name?: ResourceLocation
)
- 1st argument: A BlockIngredient, the blocks that will go into the pan
- 2nd argument: A string, the location of a loot table to be dropped for the ingredient
- 3rd argument: A list of strings which are model locations to be iterated through as panning progresses
- Optional 4th argument: A
ResourceLocation, the name of the panning definition
Example
TFCEvents.data(event => {
event.panning(
'minecraft:gravel',
'kubejs:gravel_panning',
[
'tfc:item/pan/native_gold/quartzite_full',
'tfc:item/pan/native_gold/result'
]
)
})
Firmalife Greenhouse Type
See the main page!
Method Signature
event.firmalifeGreenhouseType(
ingredient: BlockIngredient,
tier: number,
name?: ResourceLocation
)
- 1st argument: A BlockIngredient, the blocks that will be accepted by the greenhouse type
- 2nd argument: A number, the tier of the greenhouse, values for the default types are as follows:
- Wood: 5
- Copper: 10
- Iron: 15
- Stainless Steel: 20
- Optional 3rd argument: A
ResourceLocation, the name of the greenhouse type
Example
TFCEvents.data(event => {
event.firmalifeGreenhouseType('#kubejs:greenhouse_glass', 7)
})
Firmalife Planter
See the main page!
Method Signature
event.firmalifePlantable(
ingredient: Ingredient,
planterType: @Nullable PlanterType,
tier: @Nullable number,
stages: @Nullable number,
extraSeedChance: @Nullable number,
seed: @Nullable ItemStack,
crop: ItemStack,
nutrient: @Nullable NutrientType,
textures: String[],
special: @Nullable String,
name?: ResourceLocation
)
- 1st argument: An item ingredient, the seed items to be used for the plantable definition
- 2nd argument: The planter type to use, may be
quad,large,hanging,trellis,bonsai, orhydroponic, may benullto default toquad - 3rd argument: The minimum greenhouse tier needed for the plant to grow, defaults to
0 - 4th argument: How many stages the planter has, one less than the number of textures the planter must cycle through, may be
nullfortrellis, andbonsaiplanter types - 5th argument: A number, in the range
[0, 1], determines the chance of getting an extra seed stack back when harvesting, may benullto default to0.5 - 6th argument: An item stack, the seed item returned when harvested, may be
nullto not drop a seed item - 7th argument: An item stack, the product of the crop
- 8th argument: A
NutrientType, the nutrient the crop consumes, may benitrogen,phosphorous, orpotassium, may benullto default tonitrogen - 9th argument: An array of strings, the path of textures to use. Has different rules for different planter types
- For
large,quad,hydroponic, andhangingplanter types: Order the textures in the same order as the growth order - For the
trellisplanter type: Order the textures in the order growing, dry, flowering, fruiting - For the
bonsaiplanter type: Order the textures in the order fruiting, dry, flowering, branch, leaves
- For
- 10th argument: A string, the extra texture used by
hangingplanter types. Pass in the fruit texture if the planter type ishangingelse pass innull - Optional 11th argument: A
ResourceLocation, the name of the planter definition
Example
TFCEvents.data(event => {
event.firmalifePlantable(
'minecraft:beetroot_seeds',
'bonsai',
15,
null,
0.1,
'minecraft:beetroot_seeds',
'minecraft:beetroots',
'potassium',
[
'kubejs:block/planter/beet_fruiting',
'kubejs:block/planter/beet_dry',
'kubejs:block/planter/beet_flowering',
'kubejs:block/planter/beet_branch',
'kubejs:block/planter/beet_leaves'
],
null
)
})
Beneath Nether Fertilizer
Defines a new nether fertilizer
Method Signature
event.beneathNetherFertilizer(
ingredient: Ingredient,
death: @Nullable number,
destruction: @Nullable number,
decay: @Nullable number,
sorrow: @Nullable number,
flame: @Nullable number,
name?: ResourceLocation
)
- 1st argument: An item ingredient, the items this definition applies to
- 2nd argument: A number, in the range
[0, 1], sets thedeathvalue of the fertilizer, may benullto omit specifying a value - 3rd argument: A number, in the range
[0, 1], sets thedestructionvalue of the fertilizer, may benullto omit specifying a value - 4th argument: A number, in the range
[0, 1], sets thedecayvalue of the fertilizer, may benullto omit specifying a value - 5th argument: A number, in the range
[0, 1], sets thesorrowvalue of the fertilizer, may benullto omit specifying a value - 6th argument: A number, in the range
[0, 1], sets theflamevalue of the fertilizer, may benullto omit specifying the value - optional 7th argument: A
ResourceLocation, the name of the nether fertilizer definition
Example
TFCEvents.data(event => {
event.beneathNetherFertilizer(
'minecraft:nether_wart',
0.1,
null,
null,
0.25,
null,
'kubejs:sorrow_wart'
)
})
Beneath Lost Page
Defines a new lost page ritual, added to the pool of possible rituals that may be acquired when a lost page is ‘activated’
Method Definition
event.beneathLostPage(
ingredient: Ingredient,
reward: Item,
costs: number[],
rewards: number[],
punishments: Punishment[],
langKey: @Nullable String,
name?: ResourceLocation
)
- 1st argument: An item ingredient, the ingredient required to perform the ritual
- 2nd argument: A item, the reward for completing the ritual
- 3rd argument: A number array, must contain at least one value. When a lost page is ‘activated’, one of these numbers will be chosen and used as the number of ingredients required
- 4th argument: A number array, must contain at least one value. When a lost page is ‘activated’, one of these numbers will be chosen and used as the number of reward items the ritual gives
- 5th argument: A
Punishmentarray, must contain at least one value. When a lost page is ‘activated’, one of these punishments will be chosen and for application on ritual completion. The available punishments are as followsnone: Does nothinglevitation: Makes nearby living entities levitate brieflydrunkenness: Makes the player drunk and nauseousblaze_inferno: Spawns a handful of blazes nearby and alights the groundinfestation: Spawns a handful of silverfish nearbywithering: Spawns a handful of wither skeletons nearby and gives the player witheringslime: Spawns a handful of slimes nearby, drops some slimeballs on the ground, and replaces certain blocks nearby with slimed netherrackunknown: Randomly selects one of the other punishments to enact
- 6th argument: A string, the lang key to use instead of the ingredients when a ‘activated’ lost page’s info screen is present. Useful for ingredients that are not single items. may be
nullto default to the ingredient’s first valid item - optional 7th argument: A
ResourceLocation, the name of the lost page definition
Example
TFCEvents.data(event => {
event.beneathLostPage(
'#forge:cobblestone',
'minecraft:blackstone',
[
50,
89,
32,
78,
65,
120
],
[
20,
45,
8
],
[
'withering'
],
'block.minecraft.cobblestone'
)
})
Attached TFC data
In order to add nutrition, the chisel mode, and a few other things TFC attaches some extra data to the player. This can be accessed through a Player object through the .getData() method which returns a Map<String, Object>. TFC’s data can be accessed through tfc:player_data
There are several methods to access and modify the state of TFC’s additional data
Method Signatures
data.getChiselMode(): ChiselMode
data.setChiselMode(mode: ChiselMode): void
data.getIntoxicatedTicks(): number
data.addIntoxicatedTicks(ticks: number): void
data.getLastDrinkTick(): number
data.setLastDrinkTick(tick: number): void
data.playerEat(item: ItemStack): void
data.getFoodLevel(): number
data.setFoodLevel(i: number): void
data.needsFood(): boolean
data.addExhaustion(f: number): void
data.getSaturationLevel(): number
data.setSaturationLevel(f: number): void
data.getThirstModifier(): number
data.getThirstContributionFromTemperature(): number
data.getThirst(): number
data.setThirst(f: number): void
data.addThirst(f: number): void
data.getAverageNutrition(): number
data.getNutrient(nutrient: NutrientType): number
data.getNutrients(): number[]
: Returns the player’s current.getChiselMode()ChiselMode, will be eithersmooth,stair, orslab
: Sets the player’s current chisel mode, will accept.setChiselMode(mode: ChiselMode)smooth,stair, orslab
: Returns the number of ticks the player is intoxicated for.getIntoxicatedTicks()
: Adds to the player’s intoxicated ticks.addIntoxicatedTicks(ticks: number)
: Returns the last tick the player drank something.getLastDrinkTick()
: Sets the last tick the player drank something.setLastDrinkTick(tick: number)
: Makes the player eat the provided.playerEat(item: ItemStack)ItemStack
: Returns the player’s current food level.getFoodLevel()
: Sets the player’s current food level.setFoodLevel(i: number)
: Returns true if the player needs food.needsFood()
: Adds the given exhaustion to the player.addExhaustion(f: number)
: Returns the player’s saturation level.getSaturationLevel()
: Sets the player’s saturation level.setSaturationLevel(f: number)
: Returns the player’s total thirst loss per tick, on a scale of [0, 100].getThirstModifier()
: Returns the player’s total thirst lost per tick from ambient temperature in addition to regular loss.getThirstContributionFromTemperature()
: Returns the player’s thirst.getThirst()
: Sets the player’s thirst.setThirst(f: number)
: Adds the provided thirst the the player’s thirst.addThirst(f: number)
: Returns the average nutrition level of the player.getAverageNutrition()
: Returns the player’s nutrition level for the given nutrient, accepts.getNutrient(nutrient: NutrientType)grain,fruit,vegetables,protein, anddairy
: Returns an array of 5 numbers, corresponding to each nutrient in the order.getNutrients()grain,fruit,vegetables,protein,dairy
Example
/*
* @ param {Internal.Player} player
*/
function doThing(player) {
let tfcData = player.data['tfc:player_data']
if (tfcData.thirst < 20 && tfcData.averageNutrition < 0.3) {
tfcData.addExhaustion(12)
}
}