Data Bindings
Bindings for interacting with/retrieving TFC’s various data systems
declare class DataBindings {
// These can be accessed via TFC.data.*
heatLevels: Map<String, Heat>
woods: Map<ResouceLocation, RegistryWood>
metals: Map<ResourceLocation, RegistryMetal>
rocks: Map<ResourceLocation, RegistryRock>
food: instanceof FoodBindings {
get(stack: ItemStack): @Nullable IFood
getDefinition(stack: ItemStack): @Nullable FoodDefinition
has(stack: ItemStack): boolean
applyTrait(stack: ItemStack, trait: Holder<FoodTrait>): ItemStack
removeTrait(stack: ItemStack, trait: Holder<FoodTrait>): ItemStack
hasTrait(stack: ItemStack, trait: Holder<FoodTrait>): boolean
isRotten(stack: ItemStack): boolean
setRotten(stack: ItemStack): ItemStack
setCreationDate(stack: ItemStack, calendarTick: int): ItemStack
setTransientNonDecaying(stack: ItemStack): ItemStack
setnonDecaying(stack: ItemStack, invisible: boolean): ItemStack
setBowl(stack: ItemStack, bowlStack: ItemStack): void
}
support: instanceof SupportBindings {
canStartCollapse(level: LevelAccessor, pos: BlockPos): boolean
tryStartCollapse(level: Level, pos: BlockPos): boolean
forceCollapse(level: Level, pos: BlockPos): boolean
findUnsupportedPositions(level: BlockGetter, from: BlockPos, to: BlockPos): Set<BlockPos>
isSupported(level: BlockGetter, pos: BlockPos): boolean
getMaximumSupportedAreaAround(minPoint: BlockPos, maxPointL BlockPos): Iterable<BlockPos>
getCheckRange(): SupportRange
get(state: BlockState): @Nullable Support
get(level: BlockGetter, pos: BlockPos): @Nullable Support
}
getPlayerInfo(player: Player): IPlayerInfo
getChunkData(level: LevelReader, pos: BlockPos): ChunkData
getChunkData(chunk: ChunkAccess): ChunkData
getHeat(stack: ItemStack): @Nullable IHeat
hasHeat(stack: ItemStack): boolean
getHeatLevel(temperature: number): @Nullable Heat
getSize(stack: ItemStack): Size
getWeight(stack: ItemStack): Weight
getFarmlandHydration(level: Level, pos: BlockPos, calendarTick?: int): int
getFluidHeat(fluid: Fluid): @Nullable FluidHeat
getLampFuel(fluid: Fluid, state: BlockState): @Nullable LampFuel
getDrinkable(fluid: Fluid): @Nullable Drinkable
getFertilizer(stack: ItemStack): @Nullable Fertilizer
getFuel(stack: ItemStack): @Nullable Fuel
getDeposit(stack: ItemStack): @Nullable Deposit
}
: A map between a name and a.heatLevelsHeat, can be used likeTFC.data.heatLevels.WARMING
: A map between a pseudo-official id and a.woodsRegistryWood, which have the following methods.woodColor(): MapColor: Gets theMapColorof the wood.barkColor(): MapColor: Gets theMapColorof the wood’s barks.tree(): TreeGrower: Gets the tree grower.ticksToGrow(): Supplier<int>: Gets the calendar ticks for a tree to grow.autumnIndex(): int: Gets the vertical coordinate, in the range[0, 255], on thefoilage_fallcolormap of the wood’s leaves.getBlock(type: Wood$BlockType): @Nullable Supplier<Block>: Gets the block of the specified typeReveal/hide list of block types
logstripped_logwoodstripped_woodleavesplankssaplingpotted_saplingbookshelfdoortrapdoorfencelog_fencefence_gatebuttonpressure_plateslabstairstool_racktwigfallen_leavesvertical_supporthorizontal_supportworkbenchtrapped_chestchestloomsluicesignwall_signbarrellecternscribing_tablesewing_tableshelfaxlebladed_axleencased_axleclutchgear_boxwindmillwater_wheel
.getBlockSet(): BlockSetType: Gets the block set type of the wood.getVanillaWoodType(): WoodType: Gets the vanilla-equivalentWoodTypeof the weed
: A map between a pseudo-official id and a.metalsRegistryMetal, which have the following methods.toolTier(): LevelTier: Gets the level-backed tool tier of the metal.armorMaterial(): Holder<ArmorMaterial>: Gets the armor material of the metal.armorDurability(type: ArmorItem$Type): int: Gets the armor durability of the metal for the given type of armor, acceptshelmet,chestplate,leggings,noots, andbody.getBlock(type: Metal$BlockType): @Nullable Block: Gets the block of the specified typeReveal/hide list of block types
blockexposed_blockweathered_blockoxidized_blockblock_slabexposed_block_slabweathered_block_slaboxidized_block_slabblock_stairsexposed_block_stairsweathered_block_stairsoxidized_block_stairsgrateexposed_grateweathered_grateoxidized_grateanvilbarschainlamptrapdoor
.mapColor(): MapColor: Gets theMapColorof the metal.rarity(): Rarity: Gets the metal’sRarity.weatheredParts(): boolean: If the metal has weathered blocks.weatheringResistance(): number: Gets the weathering resistance of the metal, either in the range[0, 1]or-1
: A map between a pseudo-official id and a.rocksRegistryRock, which have the following methods.displayCategory(): RockDisplayCategroy: Gets the display category of the rock.category(): RockCategory: Gets the geological category of the rock.color(): MapColor: Gets theMapColorof the rock.getBlock(type: Rock$BlockType): @Nullable Supplier<Block>: Gets the block of the specified typeReveal/hide list of block types
rawhardenedsmoothcobblebricksgravelspikecracked_bricksmossy_bricksmossy_cobblechiseledloosemossy_loosepressure_platebuttonaqueduct
.getAnvil(): @Nullable Supplier<Block>: Gets the anvil block of the rock.getSlab(type: Rock$BlockType): @Nullable Supplier<Block>: Gets the slab of the specified type.getStair(type: Rock$BlockType): @Nullable Supplier<Block>: Gets the stair of the specified type.getWall(type: Rock%BlockType): @Nullable Supplier<Block>: Gets the wall of the specified type
: Gets a sub-binding focusing on food data.food
: Gets the.get(stack: ItemStack)IFoodof the given stack if present
: Gets the.getDefinition(stack: ItemStack)FoodDefinitionof the given stack if present
: If the stack has a food capability.has(stack: ItemStack)
: Applies the given food trait to the stack if possible.applyTrait(stack: ItemStack, trait: Holder<FoodTrait>)
: Removes the given food trait from the stack.removeTrait(stack: ItemStack, trait: Holder<FoodTrait>)
: If the stack has the given food trait.hasTrait(stack: ItemStack, Holder<FoodTrait>)
: If the stack is rotten.isRotten(stack: ItemStack)
: Set the given stack as rotten.setRotten(stack: ItemStack)
: Sets the stack’s creation date to the given calendar tick.setCreationDate(stack: ItemStack, calendarTick: int)
: Sets the stack as non-decaying, transiently. This effect will not be carried through stack copying.setTransientNonDecaying(stack: ItemStack)
: Sets the stack as non-decaying, optionally including a tooltip on the stack.setNonDecaying(stack: ItemStack, invisible: boolean)
: Sets the.setBowl(stack: ItemStack, bowlStack: ItemStack)tfc:bowlcomponent of thestackas thebowlStack
: Gets a sub-binding focusing on the support and collapse mechanics.support
: If the given position can start a collapse.canStartCollapse(level: LevelAccessor, pos: BlockPos)
: Attempts to start a collapse at het he given position, returns.tryStartCollapse(level: Level, pos: BlockPos)trueif any blocks collapsed
: Forces a collapse to start at the given position, returns.forceCollapse(level: Level, pos: BlockPos)trueif any blocks collapsed
: Gets all positions in the given range that are unsupported.findUnsupportedPositions(level: BlockGetter, from: BlockPos, to: BlockPos)
: If the given position is supported.isSupported(level: BlockGetter, pos: BlockPos)
: Gets an iterable view of all positions that could possibly be supported around the box defined by the min and max points.getMaximumSupportedAreaAround(minPoint: BlockPos, maxPoint: BlockPos)
: Gets the.getCheckRange()SupportRangewhich is representative of the range TFC checks for supports in collapses
: Gets the first.get(state: BlockState)Supportassociated with the block
: Gets the first.get(level: BlockGetter, pos: BlockPos)Supportassociated with the block at the given position
: Gets TFC’s.getPlayerInfo(player: Player)IPlayerInfofor the given player, which has the following methods.onDrink(): void: Performs internal actions for completion of drinking from an in-world source.canDrink(): boolean: If the player can currently drink.chiselMode(): ChiselModel: Gets the player’s selectedChiselMode.cycleChiselMode(): void: Cycle the player’s selectedChiselMode.getIntoxication(): number: Get the player’s intoxication, in the range[0, 1].addIntoxication(ticks: int): Adds the given number of ticks to the player’s intoxication timer.getThirst(): number: Gets the player’s thirst value.setThirst(value: number): void: Set the player’s thirst value.getThirstContributionFromTemperature(): number: Gets the thirst loss resultant from ambient temperature.nutrition(): INutritionData: Gets the player’s nutrition data, see the event for creating custom nutrient data for an explanation of the data there.getHealthModifier(): number: Gets the modifier of the player’s health based it their nutrition.eat(stack: ItemStack): void: Makes the player eat the given item if it is a food item.eat(food: IFood): void: Makes the player eat the given food capability.eat(food: FoodData): void: Makes the player directly eat the food data
: Get the.getChunkData(level: Level, pos: BlockPos)ChunkDataat the given position
: Get the given chunk’s.getChunkData(chunk: ChunkAccess)ChunkData
: Gets the heat capability of the stack if present.getHeat(stack: ItemStack)
: If the stack has a heat capability.hasHeat(stack: ItemStack)
: Get the.getHeatLevel(temperature: number)Heatassociated with the given temperature, ornullif less than zero
: Gets the.getSize(stack: ItemStack)Sizeof the stack
: Gets the.getWeight(stack: ItemStack)Weightof the stack
: Gets the farmland hydration, in the range.getFarmlandHydrationLevel(level: Level, pos: BlockPos, calendarTick?: int)[0, 100], at the given position and, optionally, at a specific calendar tick
: Gets the fluid heat of a fluid if present.getFluidHeat(fluid: Fluid)
: Gets the lamp fuel for the fluid and state if present.getLampFuel(fluid: Fluid, state: BlockState)
: Gets the drinkable data of a fluid if present.getDrinkable(fluid: Fluid)
: Gets the fertilizer data of an item if present.getFertilizer(stack: ItemStack)
: Gets the fuel data of an item if present.getFuel(stack: ItemStack)
: Gets the deposit data of an item if present.getDeposit(stack: ItemStack)