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 Heat, can be used like TFC.data.heatLevels.WARMING
  • : A map between a pseudo-official id and a RegistryWood, which have the following methods
    • .woodColor(): MapColor: Gets the MapColor of the wood
    • .barkColor(): MapColor: Gets the MapColor of 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 the foilage_fall colormap of the wood’s leaves
    • .getBlock(type: Wood$BlockType): @Nullable Supplier<Block>: Gets the block of the specified type
      Reveal/hide list of block types
      • log
      • stripped_log
      • wood
      • stripped_wood
      • leaves
      • planks
      • sapling
      • potted_sapling
      • bookshelf
      • door
      • trapdoor
      • fence
      • log_fence
      • fence_gate
      • button
      • pressure_plate
      • slab
      • stairs
      • tool_rack
      • twig
      • fallen_leaves
      • vertical_support
      • horizontal_support
      • workbench
      • trapped_chest
      • chest
      • loom
      • sluice
      • sign
      • wall_sign
      • barrel
      • lectern
      • scribing_table
      • sewing_table
      • shelf
      • axle
      • bladed_axle
      • encased_axle
      • clutch
      • gear_box
      • windmill
      • water_wheel
    • .getBlockSet(): BlockSetType: Gets the block set type of the wood
    • .getVanillaWoodType(): WoodType: Gets the vanilla-equivalent WoodType of the weed
  • : A map between a pseudo-official id and a RegistryMetal, 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, accepts helmet, chestplate, leggings, noots, and body
    • .getBlock(type: Metal$BlockType): @Nullable Block: Gets the block of the specified type
      Reveal/hide list of block types
      • block
      • exposed_block
      • weathered_block
      • oxidized_block
      • block_slab
      • exposed_block_slab
      • weathered_block_slab
      • oxidized_block_slab
      • block_stairs
      • exposed_block_stairs
      • weathered_block_stairs
      • oxidized_block_stairs
      • grate
      • exposed_grate
      • weathered_grate
      • oxidized_grate
      • anvil
      • bars
      • chain
      • lamp
      • trapdoor
    • .mapColor(): MapColor: Gets the MapColor of the metal
    • .rarity(): Rarity: Gets the metal’s Rarity
    • .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 RegistryRock, 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 the MapColor of the rock
    • .getBlock(type: Rock$BlockType): @Nullable Supplier<Block>: Gets the block of the specified type
      Reveal/hide list of block types
      • raw
      • hardened
      • smooth
      • cobble
      • bricks
      • gravel
      • spike
      • cracked_bricks
      • mossy_bricks
      • mossy_cobble
      • chiseled
      • loose
      • mossy_loose
      • pressure_plate
      • button
      • aqueduct
    • .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
    • : Gets the IFood of the given stack if present
    • : Gets the FoodDefinition of the given stack if present
    • : If the stack has a food capability
    • : Applies the given food trait to the stack if possible
    • : Removes the given food trait from the stack
    • : If the stack has the given food trait
    • : If the stack is rotten
    • : Set the given stack as rotten
    • : Sets the stack’s creation date to the given calendar tick
    • : Sets the stack as non-decaying, transiently. This effect will not be carried through stack copying
    • : Sets the stack as non-decaying, optionally including a tooltip on the stack
    • : Sets the tfc:bowl component of the stack as the bowlStack
  • : Gets a sub-binding focusing on the support and collapse mechanics
    • : If the given position can start a collapse
    • : Attempts to start a collapse at het he given position, returns true if any blocks collapsed
    • : Forces a collapse to start at the given position, returns true if any blocks collapsed
    • : Gets all positions in the given range that are unsupported
    • : If the given position is supported
    • : Gets an iterable view of all positions that could possibly be supported around the box defined by the min and max points
    • : Gets the SupportRange which is representative of the range TFC checks for supports in collapses
    • : Gets the first Support associated with the block
    • : Gets the first Support associated with the block at the given position
  • : Gets TFC’s IPlayerInfo for 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 selected ChiselMode
    • .cycleChiselMode(): void: Cycle the player’s selected ChiselMode
    • .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 ChunkData at the given position
  • : Get the given chunk’s ChunkData
  • : Gets the heat capability of the stack if present
  • : If the stack has a heat capability
  • : Get the Heat associated with the given temperature, or null if less than zero
  • : Gets the Size of the stack
  • : Gets the Weight of the stack
  • : Gets the farmland hydration, in the range [0, 100], at the given position and, optionally, at a specific calendar tick
  • : Gets the fluid heat of a fluid if present
  • : Gets the lamp fuel for the fluid and state if present
  • : Gets the drinkable data of a fluid if present
  • : Gets the fertilizer data of an item if present
  • : Gets the fuel data of an item if present
  • : Gets the deposit data of an item if present