Miscellaneous Bindings
- Rock Map
- Wood Map
- Heat utilities
- Food utilities
- Size Utilities
- Collapse Utilities
- Chunk Data Utilities
- Noise Utils
- Metal Utils
- Other Data Utils
Rock Map
A string to RegistryRock
map of all of TFC’s rock types
Example
TFC.misc.rock.get('dacite')
Wood Map
A string to NamedRegistryWood map of all of TFC’s wood types
Example
TFC.misc.wood.get('oak')
Heat Utilities
Get Heat
Gets the IHeat
of a given item stack, may be null
Method Signature:
TFC.misc.getHeat(stack: ItemStack): @Nullable IHeat
Example:
TFC.misc.getHeat('tfc:metal/ingot/cast_iron').getWeldingTemperature()
Has Heat
Returns true if the given item stack has an IHeat
Method Signature:
TFC.misc.hasHeat(stack: ItemStack): boolean
Example:
TFC.misc.hasHeat('tfc:powder/sulfur')
Get Heat Level
Gets the Heat
of the given temperature (°C), will be null for temperatures less than 1°C
TFC.misc.getHeatLevel(96)
Heat Levels
A string to Heat
map of all of TFC’s heat levels
Example:
TFC.misc.heatLevels.get('orange')
Food Utilities
Get Food
Gets the IFood
of the given stack, may be null
Method Signature:
TFC.misc.getFood(stack: ItemStack): @Nullable IFood
Example:
TFC.misc.getFood('tfc:food/red_apple').getDecayDateModifier()
Has Food
Returns true if the given item stack has an IFood
Method Signature:
TFC.misc.hasFood(stack: ItemStack): boolean
Example:
TFC.misc.hasFood('minecraft:dirt')
Set Rotten
Makes the provided stack rotten if possible and returns it
Method Signature:
TFC.misc.setRotten(stack: ItemStack): ItemStack
Set Never Expires
Makes it so the provided stack never expires
Method Signature:
TFC.misc.setNeverExpires(stack: ItemStack): void
Get Food Trait
Retrieves the food trait with the given registry name or null if not found
Method Signature:
TFC.misc.getFoodTrait(id: string): FoodTrait
Example:
TFC.misc.getFoodTrait('kubejs:my_food_trait')
Get Food Trait ID
Returns the id of the given food trait
Method Signature
TFC.misc.getFoodTraitId(trait: FoodTrait): string
Apply Trait
Applies the given trait to the stack, modifying it
Method Signature:
TFC.misc.applyFoodTrait(stack: ItemStack, trait: ResourceLocation): void
Remove Trait
Removes the given trait to the stack, modifying it
Method Signature:
TFC.misc.removeFoodTrait(stack: ItemStack, trait: ResourceLocation): void
Size Utilities
Get Size
Returns the Size
of the given item stack
Method Signature:
TFC.misc.getSize(stack: ItemStack): Size
Get Weight
Returns the Weight
if the given item stack
Method Signature:
TFC.misc.getWeight(stack: ItemStack): Weight
Collapse Utilities
Can Start Collapse
Returns true if the given level and position can start a collapse
Method Signature:
TFC.misc.canStartCollapse(level: LevelAccessor, pos: BlockPos): boolean
level
: The level being checkedpos
: The block pos being checked
Try Collapse
Attempts to cause a collapse at the given level and position, returns false if no collapse or a fake collapse occurred
Method Signature:
TFC.misc.tryCollapse(level: Level, pos: BlockPos): boolean
level
: The level where the collapse is trying to be createdpos
: The center of where the collapse is trying to be created
Force Collapse
Forces a collapse to happen at a position, returns true if any blocks started collapsing
Method Signature:
TFC.misc.forceCollapse(level: Level, pos: BlockPos)
level
: The level where the collapse will occurpos
: The center of the collapse
Find Unsupported Positions
Finds all positions in the given area that are unsupported
Methods Signatures:
TFC.misc.findUnsupportedPositions(level: BlockGetter, from: BlockPos, to: BlockPos): Set<BlockPos>
level
: The level to check infrom
: The minimum corner to checkto
: The maximum corner to check
TFC.misc.findUnsupportedPositions(level: BlockGetter, center: BlockPos, horizontal: number, up: number, down: number): Set<BlockPos>
level
: The level to check incenter
: The center position to checkhorizontal
: The number of blocks around the center to check horizontallyup
: The number of blocks to check above the centerdown
: The number of blocks to check below the center
Is Supported
Returns true if the position is supported
Method Signature:
TFC.misc.isSupported(level: BlockGetter, pos: BlockPos): boolean
Supported Area
Maximum Supported Area Around
Returns an iterable of all positions that could possibly be supported around the min and max positions
Method Signature:
TFC.misc.getMaximumSupportedAreaAround(minPoint: BlockPos, maxPoint: BlockPos): Iterable<BlockPos>
Get Support Check Range
Returns the SupportRange
that is used as a maximum for checking if an area is supported
Method Signature:
TFC.misc.getSupportCheckRange(): SupportRange
Get Support
Gets the support from the block, or null if it is not a supporting block
Method Signatures:
TFC.misc.getSupport(state: BlockState): @Nullable Support
TFC.misc.getSupport(level: BlockGetter, pos:BlockPos): @Nullable Support
Chunk Data Utilities
Chunk Data
Gets TFC’s ChunkData
for the given level and position
Method Signature:
TFC.misc.getChunkData(level: LevelReader, pos: BlockPos): ChunkData
level
: The level to get the data frompos
: The position to get the data from
Rock Data
Get’s TFC’s RockData
for the given level and position, may be null
Method Signature:
TFC.misc.getRockData(level: LevelReader, pos: BlockPos): @Nullable RockData
level
: The level to get the data frompos
: The position to get the data from
Rock Settings
Gets TFC’s RockSettings
, a collection of blocks that define a rock layer, see custom rock settings, may be null
Method Signatures:
TFC.misc.getRockSettings(level: LevelReader, pos: BlockPos): @Nullable RockSettings
level
: The level to get the settings frompos
: The position to get the settings from
TFC.misc.getRockSettings(level: LevelAccessor, block: Block): @Nullable RockSettings
level
: The level to check inblock
: The block to check
Forest Type
Gets TFC’s ForestType
for the given level and position
Method Signature:
TFC.misc.getForestType(level: LevelReader, pos: BlockPos): ForestType
level
: The level to get the forest type frompos
: The position to get the forest type from
Get Hydration
Returns a number, in the range [0, 100], an expression of how hydrated soil at the position would be
TFC.misc.getHydration(level: LevelAccessor, posL BlockPos): number
level
: The level to get the hydration level frompos
: The position to get the hydration level from
Noise Utils
Open Simplex
TFC uses open simplex noise for most, if not all, of its custom worldgen, these methods provide the ability to create and customize new 2D and 3D versions of TFC’s open simplex noise implementation
Method Signatures:
TFC.misc.newOpenSimplex2D(seed: number)
TFC.misc.newOpenSimplex3D(seed: number)
seed
: The seed for the noise’s algorithm
Metaballs
TFC uses metaballs for its generation of cluster veins, these methods provide the ability to create new 2D and 3D versions of TFC’s implementation
Method Signatures:
TFC.misc.newMetaballs2D(random: RandomSource, minBalls: number, maxBalls: number, minSize: number, maxSize: number, radius: number)
TFC.misc.newMetaballs3D(random: RandomSource, minBalls: number, maxBalls: number, minSize: number, maxSize: number, radius: number)
random
: The random source used by the metaballs to create variance between instancesminBalls
: The minimum number of individual ballsmaxBalls
: The maximum number of individual ballsminSize
: The minimum size of the metaballsmaxSize
: The maximum size of the metaballsradius
: The maximum radius of an individual ball
Metal Utils
Metal from Fluid
Returns the Metal
associated with the given fluid, may be null
TFC.misc.getMetal(fluid: Fluid): Metal
Metal from Ingot
Returns the first Metal
whose ingots match the given stack, may be null
TFC.misc.getMetalFromIngot(ingot: ItemStack): Metal
Metal from Plate
Returns the first Metal
whose sheets match the given stack, may be null
TFC.misc.getMetalFromSheet(stack: ItemStack): Metal
Other Data Utils
Lamp Fuel
Gets the first LampFuel
that matches the given fluid and blockstate, may be null
TFC.misc.getLampFuel(fluid: Fluid, state: BlockState): LampFuel
Drinkable
Gets the first Drinkable
that matches the given fluid, may be null
TFC.misc.getDrinkable(fluid: Fluid): Drinkable
Fertilizer
Gets the first Fertilizer
that matches the given stack, may be null
TFC.misc.getFertilizer(stack ItemStack): Fertilizer
Fuel
Gets the first Fuel
that matches the given stack, may be null
TFC.misc.getFuel(stack: ItemStack): Fuel
Pannable
Gets the first Pannable
that matches the given block state, may be null
TFC.misc.getPannable(state: BlockState): Pannable
Sluiceable
Gets the first Sluiceable
that matches the given item, may be null
TFC.misc.getSluiceable(stack: ItemStack): Sluiceable