Type Explanations
There are several Java types which can be encountered fairly frequently in the docs or are too complex to describe in-line along with other, perhaps more pertinent, information. Those are collected here
Throughout the docs on this page (and elsewhere for the mod) you may notice some odd type declarations/specifications for JavaScript. This primarily stems from the fact JS/TS types do not perfectly align with Java’s type system and a prioritization of displaying the correct Java type over a valid JS type
However there are some compromises on that front in the 1.21 docs. In 1.20 there were many cases where the Java primitives int, long, float, and double were used instead of JavaScript’s number, but the where and when of their usage is rather inconsistent. For 1.21, only int and number will be used; int will be used for Java int and long types and indicate “a number that will only be/coerced to an integer number” while number will be used for Java float and double types. Other primitives which don’t have an equivalent JavaScript type (byte/short) will use their Java type.
In addition to the primitive type shenanigans, there are some additional colors for specific categories of Java types with special behavior
- Types colored
#ff23d2 are Java enums which have a defined set of values. They can be wrapped from JavaScript as either a case-insensitive string of a value’s name or its ordinal - Types colored
#8bffce are Java functional interfaces. They can be wrapped from JavaScript as a function or callback with the appropriate arguments. See the Rhino docs, any moderately sized modpack, or many of the examples here for examples of this
Throughout the docs on this page (and elsewhere for the mod) you may notice some odd type declarations/specifications for JavaScript. This primarily stems from the fact JS/TS types do not perfectly align with Java’s type system and a prioritization of displaying the correct Java type over a valid JS type
However there are some compromises on that front in the 1.21 docs. In 1.20 there were many cases where the Java primitives int, long, float, and double were used instead of JavaScript’s number, but the where and when of their usage is rather inconsistent. For 1.21, only int and number will be used; int will be used for Java int and long types and indicate “a number that will only be/coerced to an integer number” while number will be used for Java float and double types. Other primitives which don’t have an equivalent JavaScript type (byte/short) will use their Java type.
In addition to the primitive type shenanigans, there are some additional colors for specific categories of Java types with special behavior
- Types colored
#ff23d2are Java enums which have a defined set of values. They can be wrapped from JavaScript as either a case-insensitive string of a value’s name or its ordinal - Types colored
#8bffceare Java functional interfaces. They can be wrapped from JavaScript as a function or callback with the appropriate arguments. See the Rhino docs, any moderately sized modpack, or many of the examples here for examples of this
ChunkData
ChunkData is TFC’s additional data it attaches to chunks during world generation for use during after world generation. It has the following methods available
: Get the.getPos(): ChunkPosChunkPosthe data is attached to
: Get the chunk’s.getRockData(): RockDataRockData
: Gets the chunk’s aquifer surface heights as an array of.getAquiferSurfaceHeights(): int[16]161ints representing the aquifer surface elevations
: Get the minimum hydration a block at the given position can experience due to rain.getMinRainfallHydration(pos: BlockPos): number
: Get the maximum hydration a block at the given position can experience due to rain.getMaxRainfallHydration(pos: BlockPos): number
: Get the time-invariant rainfall at the given position.getAverageRainfall(pos: BlockPos): number
: Get the time-invariant rainfall at the given position.getAverageRainfall(x: int, z: int): number
: Get the rain variance at the given position.getRainVariance(pos: BlockPos): number
: Get the rain variance at the given position.getRainVariance(x: int, z: int): number
: Get the base groundwater at the given position.getBaseGroundwater(pos: BlockPos): number
: Gets the base groundwater at the given position.getBaseGroundwater(x: int, z: int): number
: Get the time-invariant total groundwater (rivers + rainfall) at the given position.getAverageGroundwater(pos: BlockPos): number
: Get the time-invariant total groundwater (rivers + rainfall) at the given position.getAverageGroundwater(x: int, z: int): number
: Get the average sea-level temperature at the given position.getAverageSeaLevelTemp(pos: BlockPos): number
: Get the average sea-level temperature at the given position.getAverageSeaLevelTemp(x: int, z: int)
: Get the.getForestType(): ForestTypeForestTypeof the chunk
: Get the.status(): ChunkData$StatusStatusof the chunk
: The last calendar timestamp the chunk was random ticked in.lastRandomTick(): int
: Sets the last random tick of the chunk.setLastRandomTick(chunk: ChunkAccess, lastRandomTick: int): voidchunk: ChunkAccess: The chunk the data is for, required to mark it as unsaved and sync the data to clientslastRandomTick: int: The calendar tick at which the chunk was last randomly ticked
: Get the next position that will be snowed on in the chunk, the y-coordinate will always be 0.getNextSnowPos(chunkPos: ChunkPos): BlockPos
: Moves the chunk to the next snow pos and marks the chunk as unsaved.iterateSnowPos(chunk: ChunkAccess): void
: Promotes the chunk data from.generatePartial(rainfallLayer: LerpFloatLayer, rainVarianceLayer: LerpFLoatLayer, baseGroundwaterLayer: LerpFloatLayer, temperatureLayer: LerpFloatLayer, forestType: ForestType): voidemptytopartialstatus by setting some of its propertiesrainfallLayer: LerpFloatLayer: ALerpFloatLayerof the yearly average rainfall at the corners of the chunk. Used in the default climate model to determine the rainfall at a positionrainVarianceLayer: LerpFloatLayer: ALerpFloatLayerof the rainfall variance at the corners of the chunk. used by the default climate model for rain variance at a pointbaseGroundwaterLayer: LerpFloatLayer: ALerpFloatLayerof the base groundwater at the corners of the chunk. Used by the default climate model for base groundwater valuestemperatureLayer: LerpFloatLayer: ALerpFloatLayerof the average temperature at the corners of the chunk. Used by the default climate model for average seal-level temperaturesforestType: ForestType: TheForestTypeof the chunk
: Promotes the chunk data from.generateFull(surfaceHeight: int[256], aquiferSurfaceHeight: int[16]): voidpartialtofullby setting the surface heightssurfaceHeight: int[256]: An array of integer values of size2562 representing the surface height of the world. Values are indexed asx + 16 * zwherexandzare the local x and z coordinates within the chunk and are in the range[0, 15]. For custom chunk data providers, this is where thesurfaceYparameters of theRocksGettercallback is gotten fromaquiferSurfaceHeights[16]: An array of integer values of size161 representing the height of aquifer surfaces. Only used byTFCAquifers
: Tweaks the chunks base groundwater layer according to the surface height.modifyBaseGroundwater(surfaceHeight: int[256]): void
: Modifies an individual groundwater point, used by.modifyBaseGroundwaterPoint(height: int, startingWater: number): number.modifyBaseGroundwater(int,number)
RockData
RockData is a component of ChunkData focusing on rock-related information
: Get the ‘surface’ (.getSurfaceRock(x: int, z: int): RockSettingsy=0)RockSettings
: Get the.getRock(pos: BlockPos): RockSettingsRockSettingsat the position
: Get the.getRock(x: int, y: int, z: int): RockSettingsRockSettingsat the position
ClimateModel
A climate model is TFC’s way of calculating information about a level’s temperature, rainfall, groundwater, wind, and other climatic properties at a position at a specific time or for a yearly average
Climate models have several methods to retrieve the above mentioned information
: The hemisphere scale. Effectively the distance between the polar and equatorial region in blocks.hemisphereScale(): number
: Get the yearly average temperature, in °C, at the given position.getAverageTemperature(level: LevelReader, pos: BlockPos): number
: Get the current temperature, in °C, at the given position.getInstantTemperature(level: LevelReader, pos: BlockPos): number
: Get the temperature, in °C, at the given calendar tick and position.getInstantTemperature(level: LevelReader, pos: BlockPos, calendarTick: int, daysInMonth: int): number
: Get the average temperature, in °C, at the given position over the given calendar tick range.getTimeAverageTemperature(level: LevelReader, pos: BlockPos, fromTick: int, toTick: int, daysInMonth: int): number
: Get the yearly average rainfall, in mm/yr, at the given position.getAverageRainfall(level: LevelReader, pos: BlockPos): number
: Get the annual rainfall variance, in the range.getRainfallVariance(level: LevelReader, pos: BlockPos): number[-1, 1], at the given position. Positive values indicate wet summers, while negative values indicate wet winters
: Get the current rainfall, in mm/yr, at the given position.getInstantRainfall(level: LevelReader, pos: BlockPos): number
: Get the rainfall, in mm/yr, at the given calendar tick and position.getInstantRainfall(level: LevelReader, pos: BlockPos, calendarTick: int, daysInMonth: int): number
: Get the average rainfall, in mm/yr, at the given position over the given calendar tick range.getTimeAverageRainfall(level: LevelReader, pos: BlockPos, fromTick: int, toTick: int, daysInMonth: int): number
: Get the base groundwater level, in mm, at the given position.getBaseGroundwater(level: LevelReader, pos: BlockPos): number
: Get the yearly average base groundwater level, in mm, at the given position.getAverageGroundwater(level: LevelReader, pos: BlockPos): number
: Get the current groundwater level, in mm, at the given position.getInstantGroundwater(level: LevelReader, pos: BlockPos): number
: Get the base groundwater, in mm, at the given calendar tick and position.getInstantGroundwater(level: LevelReader, pos: BlockPos, calendarTick: int, daysInMonth: int): number
: Get the average groundwater level, in mm, at the given position over the given calendar tick range.getTimeAverageGroundwater(level: LevelReader, pos: BlockPos, fromTick: int, toTick: int, daysInMonth: int): number
: Get the rainfall intensity, generally in the range.getRain(calendarTick: int): number[0, 1], at the given calendar tick
: Get if it is thundering at the given calendar tick.getThunder(calendarTick: int): boolean
: If the model supports historical querying of rainfall and if TFC should override a level’s rainfall intensity with that of the model.supportsRain(): boolean
: Get the current wind vector at the given position.getWind(level: Level, pos: BlockPos): Vec2
: Ge the wind vector at the given calendar tick and position.getWind(level: Level, pos: BlockPos, calendarTick: int, daysInMonth: int): Vec2
: Get the current fog value, in the range.getFog(level: LevelReader, pos: BlockPos): number[0, 1], for the given position
ForestType Enum
There are 29 forest types, each with values for
- The type/category
- The numeric density, in the range
[0, 4] - The number of trees to place per chunk
- The number of groundcover objects to place per chunk
- The number of leaf piles to place per chunk
- The number of bushes to place per chunk
- The maximum number of tree types in a forest entry that can spawn
- The chance per chunk, in the range
[0, 1], a tree will be placed in a forest entry -
The maximum number of forest entries alternatives that may be dropped when placing a forest
grassland; ordinal0- Type:
none - Density:
0 - Trees:
0 - Groundcover:
0 - Leaf piles:
0 - Bushes:
0 - Tree types:
2 - Chance:
0 - Alternatives:
0
- Type:
clearing; ordinal1- All values are the same as
grassland
- All values are the same as
shrubland; ordinal2- Type:
none - Density:
0 - Trees:
0 - Groundcover:
10 - Leaf piles:
[0, 1] - Bushes:
[2, 7] - Tree types:
2 - Chance:
1 - Alternatives:
0
- Type:
sparse; ordinal3- Type:
none - Density:
0 - Trees:
2 - Groundcover:
6 - Leaf piles:
0 - Bushes:
[0, 2] - Tree types:
2 - Chance:
0.08 - Alternatives:
0
- Type:
savanna_monoculture; ordinal4- Type:
savanna - Density:
1 - Trees:
3 - Groundcover:
6 - Leaf piles:
0 - Bushes:
[0, 2] - Tree types:
1 - Chance:
0.55 - Alternatives:
0
- Type:
savanna_diverse; ordinal5- Type:
savanna - Density:
1 - Trees:
3 - Groundcover:
6 - Leaf piles:
0 - Bushes:
[0, 2] - Tree types:
2 - Chance:
0.65 - Alternatives:
0
- Type:
savanna_alternative; ordinal6- Type:
savanna - Density:
1 - Trees:
3 - Groundcover:
6 - Leaf piles:
0 - Bushes:
[0, 2] - Tree types:
3 - Chance:
0.4 - Alternatives:
2
- Type:
savanna_shrub_monoculture; ordinal7- Type:
savanna - Density:
1 - Trees:
1 - Groundcover:
6 - Leaf piles:
0 - Bushes:
[3, 6] - Tree types:
1 - Chance:
0.9 - Alternatives:
0
- Type:
savanna_shrub_diverse; ordinal8- Type:
savanna - Density:
1 - Trees:
1 - Groundcover:
6 - Leaf piles:
0 - Bushes:
[3, 6] - Tree types:
2 - Chance:
1 - Alternatives:
0
- Type:
savanna_shrub_alternative; ordinal9- Type:
savanna - Density:
1 - Trees:
1 - Groundcover:
6 - Leaf piles:
0 - Bushes:
[3, 6] - Tree types:
3 - Chance:
0.8 - Alternatives:
2
- Type:
primary_monoculture; ordinal10- Type:
primary - Density:
3 - Trees:
5 - Groundcover:
25 - Leaf piles:
[0, 1] - Bushes:
0 - Tree types:
1 - Chance:
1 - Alternatives:
0
- Type:
primary_diverse; ordinal11- Type:
primary - Density:
4 - Trees:
7 - Groundcover:
40 - Leaf piles:
[0, 1] - Bushes:
[0, 3] - Tree types:
2 - Chance:
1 - Alternatives:
0
- Type:
primary_alternative; ordinal12- Type:
primary - Density:
7 - Trees:
40 - Groundcover:
40 - Leaf piles:
[0, 1] - Bushes:
[0, 3] - Tree types:
3 - Chance:
1 - Alternatives:
2
- Type:
secondary_monoculture; ordinal13- Type:
secondary - Density:
3 - Trees:
5 - Groundcover:
25 - Leaf piles:
0 - Bushes:
[1, 2] - Tree types:
1 - Chance:
1 - Alternatives:
0
- Type:
secondary_monoculture_tall; ordinal14- Type:
secondary - Density:
3 - Trees:
5 - Groundcover:
25 - Leaf piles:
0 - Bushes:
[1, 2] - Tree types:
1 - Chance:
1 - Alternatives:
0
- Type:
secondary_diverse; ordinal15- Type:
secondary - Density:
3 - Trees:
5 - Groundcover:
25 - Leaf piles:
0 - Bushes:
[1, 2] - Tree types:
2 - Chance:
1 - Alternatives:
0
- Type:
secondary_bamboo; ordinal16- Type:
secondary - Density:
3 - Trees:
1 - Groundcover:
25 - Leaf piles:
[0, 1] - Bushes:
[0, 1] - Tree types:
2 - Chance:
0.3 - Alternatives:
0
- Type:
secondary_diverse_tall; ordinal17- Type:
secondary - Density:
3 - Trees:
5 - Groundcover:
25 - Leaf piles:
0 - Bushes:
[1, 2] - Tree types:
2 - Chance:
1 - Alternatives:
0
- Type:
secondary_dense; ordinal18- Type:
secondary - Density:
4 - Trees:
7 - Groundcover:
40 - Leaf piles:
[0, 1] - Bushes:
3 - Tree Types:
2 - Chance:
1 - Alternatives:
0
- Type:
secondary_dense_tall; ordinal19- Type:
secondary - Density:
4 - Trees:
7 - Groundcover:
40 - Leaf piles:
[0, 1] - Bushes:
3 - Tree types:
2 - Chance:
1 - Alternatives:
0
- Type:
secondary_alternative; ordinal20- Type:
secondary - Density:
3 - Trees:
5 - Groundcover:
25 - Leaf piles:
0 - Bushes:
[1, 2] - Tree types:
3 - Chance:
1 - Alternatives:
2
- Type:
edge_monoculture; ordinal21- Type:
edge - Density:
2 - Trees:
2 - Groundcover:
10 - Leaf piles:
[0, 1] - Bushes:
[0, 1] - Tree types:
1 - Chance:
1 - Alternatives:
0
- Type:
edge_diverse; ordinal22- Type:
edge - Density:
2 - Trees:
2 - Groundcover:
10 - Leaf piles:
[0, 1] - Bushes:
[0, 1] - Tree types:
2 - Chance:
1 - Alternatives:
0
- Type:
edge_alternative; ordinal23- Type:
edge - Density:
2 - Trees:
2 - Groundcover:
2 - Leaf piles:
[0, 1] - Bushes:
[0, 1] - Tree types:
3 - Chance:
1 - Alternatives:
2
- Type:
edge_bamboo; ordinal24- Type:
edge - Density:
2 - Trees:
1 - Groundcover:
10 - Leaf piles:
[0, 1] - Bushes:
[0, 1] - Tree types:
1 - Chance:
0.7 - Alternatives:
0
- Type:
dead_monoculture; ordinal25- Type:
dead - Density:
2 - Trees:
5 - Groundcover:
25 - Leaf piles:
0 - Bushes:
[2, 4] - Tree types:
1 - Chance:
1 - Alternatives:
0
- Type:
dead_diverse; ordinal26- Type:
dead - Density:
2 - Trees:
5 - Groundcover:
25 - Leaf piles:
0 - Bushes:
[2, 4] - Tree types:
2 - Chance:
1 - Alternatives:
0
- Type:
dead_alternative; ordinal27- Type:
dead - Density:
3 - Trees:
4 - Groundcover:
40 - Leaf piles:
[0, 1] - Bushes:
[0, 3] - Tree types:
3 - Chance:
1 - Alternatives:
2
- Type:
dead_bamboo; ordinal28- Type:
dead - Density:
3 - Trees:
4 - Groundcover:
25 - Leaf piles:
[0, 1] - Bushes:
[2, 4] - Tree types:
2 - Chance:
1 - Alternatives:
0
- Type:
ICalendar
A calendar instance that holds information about the world time and TFC’s system of tracking ticks. ICalendars can be retrieved via the TFC.calendar sub-binding. Calendars have two internal tick counts
playerTicks, or simplyticks, are a monotonic, constantly increasing count of how many ticks have passed since the world began. They are global across dimensions and not synced with the day/night cycle. These should be used for saving/comparing timestampscalendarTicksare a representation of the seasonal and daytime calendar and may pause or be reversed. These are never safe to use as timestamps
Calendars have several methods from which time information can be gotten
: Get the absolute amount of ticks passed since the world was created, pausing only when players are offline. Safe to use for calendar timestamps.getTicks(): int
: Get the number of ticks in a single calendar tick hour.getTicksInHour(): int
: Get the number of ticks since Jan 1, 1000.getCalendarTicks(): int
: Get the number of days in a month.getCalendarDaysInMonth(): int
: Get the expected calendar tick after the given player tick offset.getCalendarTickFromOffset(offsetTick: int): int
: Get the expected calendar ticks (duration) represented by the player tick offset. This should be independent with respect to time, but should not be used for incrementing from a calendar tick, use.getFixedCalendarTicksFromTick(offsetTick: int): int.getCalendarTickFromOffset(int)for that instead
: Get the total amount of days passed since Jan 1, 1000.getTotalCalendarDays(): int
: Get the display year, starting at 1000.getCalendarYear(): int
: Get the numeric day of the month.getCalendarDayOfMonth(): int
: Get the fractional progress, in the range.getCalendarFractionOfHour(): number[0, 1], of the current hour
: Get the fractional progress, in the range.getCalendarFractionOfDay(): number[0, 1], of the current day, where0indicates midnight and0.5is noon
: Get the fraction progress, in the range.getCalendarFractionOfMonth(): number[0, 1], of the current month
: Get the fraction progress, in the range.getCalendarFractionOfYear(): number[0, 1], of the current year
: Get a text component representation of the current day.getCalendarDayOfYear(): MutableComponent
: Get a text component of the current birthday, or an empty component if none.getBirthDay(): MutableComponent
: Get the current.getHemisphericalCalendarMonthOfYear(northernHemisphere: boolean): MonthMonthof the ‘seasonal year’ for a hemisphere
: Get the.getHemisphericalCalendarMonthOfYear(northernHemisphere: boolean, calendarTicks: int, daysInMonth: int): MonthMonthof the ‘seasonal year’ for the hemisphere and calendar tick
: Get the current.getAbsoluteCalendarMonthOfYear(): MonthMonthof the year in calendar time. Should be used when displaying a calendar month by name or when using absolute time, rather than time-of-year
: Get the total number of ticks in a month.getCalendarTicksInMonth(): int
: Get the total number of ticks in a year.getCalendarTicksInYear(): int
: Get a text component displaying the current time and date in.getTimeAndDate(): MutabelComponentHH:MM month DD, YYYYform
: Get a text component displaying the current time in.getDayTime(): MutableComponentHH:MMform
: Get the current hour of the day, in the range.getHourOfDay(): int[0, 23]
: Get the current minute of the hour, in the range.getMinuteOfHour(): int[0, 59]
: Get a text component displaying the given timestamp in.getExactTimeAndDate(playerTick: int): MutableComponentHH:MM month DD, YYYYform
: Get a text component displaying the time, in.getOffsetTimeAndDate(offsetTick: int): MutableComponentHH:MM month DD, YYYYform, at the given player tick offset from now
: Get a text component displaying a time delta of the given number of player ticks.getTimeDelta(playerTick: int): MutableComponent
: Get a text component displaying a length of time equal to the given player tick offset.getCalendarTimeDelta(offsetTick: int): MutableComponent
: Get the current timestamp, returns the save value as.getTimestamp(): int.getTicks()
: If the calendar is for the logical server side.isServerCalendar(): boolean
: Performs a calendar transaction, allowing the player tick of the calendar to be transiently modified..transaction(transaction: Consumer<Transaction>): voidTransactions have two methods which change the player tick, but only within the callback.add(ticks: int): void: Add a certain amount of ticks to the calendar within the transaction.ticks(): int: Get the total number of ticks that have been added within the transaction
ItemStackProvider
An ItemStackProvider is a recipe output, effectively an ItemStack with a list of transformations which are applied to it at completion of the recipe. It can be created using the dedicated sub-binding or, when required as a method argument, by passing in an ItemStack or anything that will wrap to an ItemStack
Providers have several methods by which they can be used and modified
: Get the base output.stack(): ItemStackItemStackof the provider
: Get the provider’s list of modifiers.modifiers(): List<ItemStackModifier>
: Get the output stack of the provider, for the given input stack, assuming the input is a single item.getSingleStack(input: ItemStack): ItemStack
:.getSingleStackDisplayOnly(input: ItemStack): ItemStack.getSingleStack(ItemStack)but for display-only (no_random_chance) contexts
: Get the output stack of the provider, without taking the input stack into consideration.getEmptyStack(): ItemStack
: Get the output stack of the provider, for the given input stack. Note: The presence of.getStack(input: ItemStack): ItemStackCopyInputModifiers may cause the resultant stack to have the same stack size as the input, if that is not desired use.getSingleStack(ItemStack)
: Get the output stack of the provider, for the given input stack and context. The context may be either.getStack(input: ItemStack, context: StackModifierContext): ItemStackdefaultorno_random_chanceand the note in.getStack(ItemStack)also applies
: If any of the provider’s modifiers depend on the input stack.dependsOnInput(): boolean
: If the provider has no modifiers and its stack is empty.isEmpty(): boolean
: Serializes the provider to json.toJson(): JsonElement
: Serializes the provider to nbt.toNBT(): Tag
: Copies the provider with a mutable modifier list.copy(): ItemStackProvider
: Copies the provider with an immutable modifier list.copyImmutable(): ItemStackProvider
: Adds the given modifier to the provider.addModifier(modifier: ItemStackModifier): @Self ItemStackProvider
: Parses the given json as an.addJsonModifier(json: JsonObject): @Self ItemStackProviderItemStackModiferand adds it to the provider
: Adds a modifier of the given type, only valid for modifiers with no additional parameters.addSimpleModifier(type: ResourceLocation): @Self ItemStackProvider
: Adds a.copyInputStack(): @Self ItemStackProvidertfc:copy_inputmodifier to the provider
: Adds a.copyFood(): @Self ItemStackProvidertfc:copy_foodmodifier to the provider
: Adds a.copyOldestFood(): @Self ItemStackProvidertfc:copy_oldest_foodmodifier to the provider
: Adds a.copyHeat(): @Self ItemStackProvidertfc:copy_heatmodifier to the provider. Copies the input stack’s temperature to the output stack
: Adds a.copyForgingBonus(): @Self ItemStackProvidertfc:copy_forging_bonusmodifier to the provider. Copies the input stack’s forging bonus to the output
: Adds a.resetFood(): @Self ItemStackProvidertfc:reset_foodmodifier to the provider
: Adds a.emptyBowl(): @Self ItemStackProvidertfc:empty_bowlmodifier to the provider. Sets the output stack to the contents of the input’stfc:bowlcomponent orminecraft:bowlif not present
: Adds a.addBaitToRod(): @Self ItemStackProvidertfc:add_bait_to_rodmodifier to the provider
: Adds a.addGlass(): @Self ItemStackProvidertfc:add_glassmodifier to the provider
: Adds a.addPowder(): @Self ItemStackProvidertfc:add_powdermodifier to the provider
: Adds a.craftingRemainder(): @Self ItemStackProvidertfc:crafting_remaindermodifier to the provider. Sets the output to the crafting remainder of the input stack
: Adds a.damageInput(): @Self ItemStackProvidertfc:damage_crafting_remaindermodifier to the provider. Sets the output to the input if it has durability and removes durability if possible
: Adds a.addTrait(trait: Holder<FoodTrait>): @Self ItemStackProvidertfc:add_traitmodifier to the provider. Adds the given trait to the output
: Adds a.removeTrait(trait: Holder<FoodTrait>): @Self ItemStackProvidertfc:remove_traitmodifier to the provider. Removes the given trait from the output
: Adds a.addHeat(temperature: number): @Self ItemStackProvidertfc:add_heatmodifier to the provider. Increases the output’s temperature by the given amount, in °C
: Adds a.dyeLeather(color: DyeColor): @Self ItemStackProvidertfc:dye_leathermodifier, which adds the given color to dyeable items, to the provider. Adds the given color to dyable items
: Adds a.removeDye(): @Self ItemStackProvidertfc:remove_dyemodifier to the provider
: Adds a.meal(food: FoodData, portions...: MealPortion[]): @Self ItemStackProvidertfc:mealmodifier to the providerfood: FoodData: …portions...: MealPortion[]: …
: Adds a.extraProduct(stack: ItemStack): @Self ItemStackProvidertfc:extra_productsmodifier to the provider. Gives the provided stack to the player, if present
: Adds a.chance(chance: number): @Self ItemStackProvidertfc:chancemodifier to the provider. Applies the chance, in the range[0, 1], to the output
LayeredArea
LayeredArea is a specialized version of TFC’s Area, an AreaSource overlaid with multiple TransformLayers which can be though of as a pseudo-Noise2D, designed to be easily made, edited, and used in scripts. It has the following methods:
: Gets the value at the given x-z point.getAt(x: int, z: int): int
: Applies a zoom layer to the area, effectively doubling the ‘resolution’ of the area. The params are:.zoom(fuzzy: boolean, seed: int): @Self LayeredAreafuzzy: boolean: If the zooming function should apply a smoothing/dither-like operation along value boundariesseed: int: The seed for theAreaContext’s random
: Applies a smoothing layer to the area. The param is the seed used by the.smooth(seed: int): @Self LayeredAreaAreaContext’s random
: Applies an arbitrary.transform(transformer: TransformLayer, seed: int): @Self LayeredAreaTransformLayerto the area. The params are:transformer: TransformLayer: The transformerseed: int: The seed used by theAreaContext’s random
: Applies an arbitrary.adjacentTransform(transformer: AdjacentTransformerLayer, seed: int): @Self LayeredAreaTransformlayerthat has access to neighboring values. The params are:transformer: AdjacentTransformLayer: The transformerseed: int: The seed used by theAreaContext’s random
: Merges the.merge(merge: MergeLayer, otherLayeredArea: LayeredArea, seed: int): @Self LayeredAreaLayeredAreawith another via the givenMergeLayer. The params are:merger: MergeLayer: A callback which merges the twoLayeredAreas together. Has the following params:context: AreaContext: The seededAreaContextat the pointfirst: Area: TheAreafrom theLayeredAreabeing merged intosecond: Area: TheAreafrom the otherLayeredAreax: int: The x position being queriedz: int: The z position being queriedreturn: int: The resultant value of the merge
otherLayeredArea: LayeredArea: TheLayeredAreato merge with this oneseed: int: The seed used by theAreaContext’s random
SourceLayer
SourceLayer is a functional interface that originates a LayeredArea. It can be created in scripts as a callback with the params
context: AreaContext: The seededAreaContextat the pointx: int: The x position being queriedz: int: The z position being queriedreturn: int: The return value
TransformLayer
TransformLayer is a functional interface that transforms the result of a LayeredArea. It can be created in scripts as a callback with the following params:
context: AreaContext: TheAreaContextof the layerarea: Area: TheAreaof theLayeredAreax: int: The x position being queriedz: int: The z position being queriedreturn: int: The return value
AdjacentTransformLayer
AdjacentTransformLayer is a functional interface that transforms the result of a LayeredArea. It can be created in scripts as a callback with the following params:
context: AreaContext: TheAreaContextof the layernorth: int: The value immediately north of thecenterpositioneast: int: The value immediately east of thecenterpositionsouth: int: The value immediately south of thecenterpositionwest: int: The value immediately west of thecenterpositioncenter: int: The value at the queried positionreturn: int: The return value
AreaContext
AreaContexts provide some utility methods for making random choices in a thread-safe manner in layer transformation and sourcing. It has the following methods:
.random(): RandomSource: Gets theRandomSourceused by the context to make choices.choose(first: int, second: int): int: Makes a random choice between the two given values.choose(first: int, second: int, third: int, fourth: int): int: Makes a random choice between the four given values.choose(choices: int[]): int: Makes a random choice from the given values
Area
Areas represent a value source and the sum contribution of all layers applied to a LayeredArea. It has one method:
.get(x: int, z: int): int: Gets the value at the given x-z point
Month Enum
If you didn’t know, there are 12 months. Each month has values for
- The Northern hemisphere temperature modifier, in the range
[-1, 1] -
The season
january; ordinal0- Modifier:
-1 - Season:
winter
- Modifier:
february; ordinal1- Modifier:
-0.866 - Season:
winter
- Modifier:
march; ordinal2- Modifier”
-0.5 - Season:
spring
- Modifier”
april; ordinal3- Modifier:
0 - Season:
spring
- Modifier:
may; ordinal4- Modifier:
0.5 - Season:
spring
- Modifier:
june; ordinal5- Modifier:
0.866 - Season:
summer
- Modifier:
july; ordinal6- Modifier:
1 - Season:
summer
- Modifier:
august; ordinal7- Modifier:
0.866 - Season:
summer
- Modifier:
september; ordinal8- Modifier:
0.5 - Season:
fall
- Modifier:
october; ordinal9- Modifier:
0 - Season:
fall
- Modifier:
november; ordinal10- Modifier:
-0.5 - Season:
fall
- Modifier:
december; ordinal11- Modifier:
-0.866 - Season:
fall
- Modifier:
Noise2D
Noise2D is a functional interface which serves as a wrapper for a 2D noise layer. It can be created in scripts as a callback with the params:
x: number: The x coordinate being queriedz: number: The z coordinate being queriedreturn: number: The value at the queried position
Noise2D objects can be created from several methods in the noise sub-binding. Instances of Noise2D also have several methods available
: Gets the value of the noise the given position.noise(x: number, z: number): number
: Applies an octave function to the noise, overlaying weaker, more spread copies of the noise on top of itself.octaves(octaves: int): Noise2Doctaves: int: The number of octaves to overlay
: Creates a ridged noise using absolute values. Expects the noise’s value to be in the range.ridged(): Noise2D[-1, 1]
: Takes the absolute value of the function.abs(): Noise2D
: Creates ‘terraces’ by rounding the value to the nearest level. Expects the noise’s value to be in the range.terraces(levels: int): Noise2D[-1, 1]levels: int: The number of levels to round to
: Scales the input coordinates of the noise function by the given scale factor.spread(scaleFactor: number): Noise2D
: Re-scales the noise value to the new range, old values are expected to be in the range.scaled(min: number, max: number): Noise2D[-1, 1]
: Re-scales the noise value from the old range to the new range.scaled(oldMin: number, oldMax: number, min: number, max: number): Noise2D
: Scales then shifts the noise value.affine(scale: number, shift: number): Noise2Dscale: number: The factor to multiply the noise value byshift: number: The amount to add to the scaled value
:.clampedScaled(min: number, max: number): Noise2D.scaled(number,number)but also clamping the noise value to theminandmaxvalues
:.clampedScaled(oldMin: number, oldMax: number, min: number, max: number): Noise2D.scaled(number,number,number,number), but clamping the noise value to theminandmaxvalues
: Uses the.warped(warp: OpenSimplex2D): Noise2DFastNoiseLiteof the simplex noise to warp the domain of the noise
: Clamps the noise to the given range.clamped(min: number, max: number): Noise2D
: Sums this noise with the other.add(other: Noise2D): Noise2D
: Adds a constant value to the noise.addConstant(constant: number): Noise2D
: Takes the minimum value of this noise and the other.min(other: Noise2D): Noise2D
: Takes the maximum value of this noise and the other.max(other: Noise2D): Noise2D
: Multiplies this noise with the other.lazyProduct(other: Noise2D): Noise2D
: Maps the output of the noise using the given function.map(mappingFunction: Function<number, number>): Noise2D
: Creates varying-height cliffs.cliffMap(compare: Noise2D, addend: Noise2D): Noise2Dcompare: Noise2D: The noise to compare to, cliffs will be added when the noise is greater than thecomparevalueaddend: Noise2D: The cliff noise to add
: Creates caring-height cliffs with slopes.slopedCliffMap(compareNoise: Noise2D, addendNoise: Noise2D, slopeNoise: Noise2D): Noise2DcompareNoise: Noise2D: The noise to compare to, cliffs will be added when sum of the noise and the addend is greater than thecomparevalueaddendNoise: Noise2D: The cliff noise to addslopeNoise: Noise2D: The slope noise to use
: Stretches the z coordinate by the given factor.stretchX(stretch: number): Noise2D
: Stretches the x coordinate by the given factor.stretchZ(stretch: number): Noise2D
: Swaps the x and z coordinates.transpose(): Noise2D
: Rotates the coordinate grid around the origin by the given angle, in degrees.rotate(angle: number): Noise2D
: Evaluates the noise at the corners of the chunk and returns them as a.overChunk(pos: ChunkPos): LerpFloatLayerLerpFloatLayer
: Evaluates the noise at the corners of the grid coordinate and returns them as a.overGrid(x: int, z: int): LerpFloatLayerLerpFloatLayer
Noise3D
Noise3D is a functional interface which serves as a wrapper for a 3D noise layer. It can be created in scripts as a callback with the params:
x: number: The x coordinate being queriedy: number: The y coordinate being queriedz: number: The z coordinate being queriedreturn: number: The value at the queried position
Noise3D objects can be created from several methods in the noise sub-binding. instances of Nosie3D also have several methods available
: Gets the value of the noise at the given position.noise(x: number, y: number, z: number): number
: Applies an octave function to the noise, overlaying weaker, more spread copies of the noise on top of itself.octaves(octaves: int): Noise3Doctaves: int: The number of octaves to overlay
: Scales the input coordinates of the noise function by the given scale factor.spread(scaleFactor: number): Noise3D
: Re-scales the noise values to the new range, old values are expected to be in the range.scaled(min: number, max: number): Noise3D[-1, 1]
: Re-scaled the noise value from the old range to the new range.scaled(oldMin: number, oldMax: number, min: number, max: number): Noise3D
: Uses the.warped(warp: OpenSimplex3D): Noise3DFastNoiseLiteof the simplex noise to warp the domain of the noise
: Swaps the x and z coordinates.transposeXZ(): Noise3D
: Swaps the x and y coordinates.transposeXY(): Noise3D
: Swaps the y and z coordinates.transposeYZ(): Noise3D
: Dissolves the noise to a.dissolve(yNoise: Noise2D): Noise2DNoise2Dusing the givenNoise2D’s as the y coordinate at each point
: Rotates the coordinate grid around the x-axis by the given angle, in degrees.rotateX(angle: number): Noise3D
: Rotates the coordinate grid around the y-axis by the given angle, in degrees.rotateY(angle: number): Noise3D
: Rotates the coordinate grid around the z-axis by the given angle, in degrees.rotateZ(angle: number): Noise3D