Entities
If EntityJS is installed, some TFC entity types will be available
In addition, there is a new method, withFaunaDefinition
for all living entity builders that registers a fauna definition for the entity. This method takes a SpawnPlacements$Type
and a Heightmap$Types
and returns the builder
StartupEvents.register('entity_type', event => {
event.create('my_entity', 'tfc:mammal')
.withFaunaDefinition('on_ground', 'world_surface_wg')
})
Mammal
Creates a new mammal entity type
Inherits the methods of animal builders
Type: tfc:mammal
Extra methods
.configs(configBuilder: Consumer<MammalConfigBuilder>)
: Sets the default values of the type’s configgestationDays(i: number)
: Sets the number of days the mammal will gestate young forchildCount(i: number)
: Sets the number of children the mammal will haveanimalName(name: string)
: Sets the name of the mammal in hte config filedaysToAdult(i: number)
: Sets the number of days the mammal will take to reach adulthooduses(i: number)
: Sets the number of uses the mammal hasmaxFamiliarity(d: number)
: Sets the maximum familiarity, in the range [0, 1], that an adult mammal may be brought up toeastRottenFood(eats: boolean)
: Sets if the animal will eat rotten food
foodTag(tag: string)
: Sets the item tag the mammal will consider foodsounds(ambient: string, death: string, hurt: string, step: string, attack: string, sleep: string)
: Accepts the registry ids of and sets the sound events the entity uses,attack
, andsleep
may be null
Example
StartupEvents.registry('entity_type', event => {
event.create('my_mammal', 'tfc:mammal')
.foodTag('kubejs:my_very_special_food_type_only_for_my_mammal')
})
Oviparous
Creates a new oviparous entity type
Inherits the methods of animal builders
Type: tfc:oviparous
Extra Methods
.crows(crows: boolean)
: If the animal should crow every so often, defaults tofalse
.productReadyMessage(message: Component)
: Sets the message displayed when the animal has a product ready.configs(configBuilder: Consumer<OviparousConfigBuilder>)
: Sets the default values of the type’s confighatchDays(i: number)
: Sets the number of days the animal will take to hatchanimalName(name: string)
: Sets the name of the animal in hte config filedaysToAdult(i: number)
: Sets the number of days the animal will take to reach adulthooduses(i: number)
: Sets the number of uses the animal hasmaxFamiliarity(d: number)
: Sets the maximum familiarity, in the range [0, 1], that an adult animal may be brought up toeastRottenFood(eats: boolean)
: Sets if the animal will eat rotten food
foodTag(tag: string)
: Sets the item tag the mammal will consider foodsounds(ambient: string, death: string, hurt: string, step: string, attack: string, sleep: string)
: Accepts the registry ids of and sets the sound events the entity uses,attack
, andsleep
may be null
Example
StartupEvents.registry('entity_type', event => {
event.create('oviparous_example', 'tfc:oviparous')
.crows(true)
.productReadyMessage("Egg's Ready!")
.configs(config => {
config.hatchDays(5)
config.uses(56)
})
})
Wooly
Creates a new wooly animal entity type
Inherits the methods of animal builders
Type: tfc:wooly_animal
Extra Methods
.configs(configBuilder: Consumer<ProducingConfigBuilder>)
: Sets the default values of the type’s configticksToProduce(i: number)
: Sets the number of ticks the animal will take to create produceproduceFamiliarity(d: number)
: Sets the familiarity, in the range [0, 1], that is required for the animal to have its product harvestedanimalName(name: string)
: Sets the name of the animal in hte config filedaysToAdult(i: number)
: Sets the number of days the animal will take to reach adulthooduses(i: number)
: Sets the number of uses the animal hasmaxFamiliarity(d: number)
: Sets the maximum familiarity, in the range [0, 1], that an adult animal may be brought up toeastRottenFood(eats: boolean)
: Sets if the animal will eat rotten food
foodTag(tag: string)
: Sets the item tag the mammal will consider foodsounds(ambient: string, death: string, hurt: string, step: string, attack: string, sleep: string)
: Accepts the registry ids of and sets the sound events the entity uses,attack
, andsleep
may be null
Example
StartupEvents.registry('entity_type', event => {
event.create('my_wooly_animal', 'tfc:wooly_animal')
.sounds('kubejs:wooly.ambient', 'kubejs:wooly.death', 'kubejs:wooly.hurt', 'kubejs:wooly.step', null, null)
})
Dairy
Create a new dairy animal entity type
Inherits the methods of animal builders
Type: tfc:dairy_animal
Extra Methods
.configs(configBuilder: Consumer<ProducingConfigBuilder>)
: Sets the default values of the type’s configticksToProduce(i: number)
: Sets the number of ticks the animal will take to create produceproduceFamiliarity(d: number)
: Sets the familiarity, in the range [0, 1], that is required for the animal to have its product harvestedanimalName(name: string)
: Sets the name of the animal in hte config filedaysToAdult(i: number)
: Sets the number of days the animal will take to reach adulthooduses(i: number)
: Sets the number of uses the animal hasmaxFamiliarity(d: number)
: Sets the maximum familiarity, in the range [0, 1], that an adult animal may be brought up toeastRottenFood(eats: boolean)
: Sets if the animal will eat rotten food
foodTag(tag: string)
: Sets the item tag the mammal will consider foodsounds(ambient: string, death: string, hurt: string, step: string, attack: string, sleep: string)
: Accepts the registry ids of and sets the sound events the entity uses,attack
, andsleep
may be null
Example
StartupEvents.registry('entity_type', event => {
event.create('my_dairy_animal', 'tfc:dairy_animal')
.configs(config => {
config.eatsRottenFood(true)
config.daysToAdult(12)
})
})