Entities
If EntityJS is installed, some TFC entity types will be available
In addition, there is a new method, .withFaunaDefinition(placement: SpawnPlacements$Type, heightMap: Heightmap$Types)
for all living entity builders that registers a fauna definition for the entity. It returns the builder and has the following parameters
placement: SpawnPlacements$Type
: The placement type, may be any of on_ground
, in_water
, no_restictions
, or in_lava
heightMap: Heightmap$Types
: The height map to use for spawning, may be any of world_surface_wg
, world_surface
, ocean_floor_wg
, ocean_floor
, motion_blocking
, or motion_blocking_no_leaves
. See the Minecraft Wiki for an explanation of what each of those means
StartupEvents.register("entity_type", event => {
event.create("my_entity", "tfc:mammal")
.withFaunaDefinition("on_ground", "world_surface_wg")
})
In addition, there is a new method, .withFaunaDefinition(placement: SpawnPlacements$Type, heightMap: Heightmap$Types)
for all living entity builders that registers a fauna definition for the entity. It returns the builder and has the following parameters
placement: SpawnPlacements$Type
: The placement type, may be any ofon_ground
,in_water
,no_restictions
, orin_lava
heightMap: Heightmap$Types
: The height map to use for spawning, may be any ofworld_surface_wg
,world_surface
,ocean_floor_wg
,ocean_floor
,motion_blocking
, ormotion_blocking_no_leaves
. See the Minecraft Wiki for an explanation of what each of those means
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
: Sets the default values of the type’s config.configs(configBuilder: Consumer<MammalConfigBuilder>)
.gestationDays(i: number)
: Sets the number of days the mammal will gestate young for.childCount(i: number)
: Sets the number of children the mammal will have.animalName(name: String)
: Sets the name of the mammal in the config file.daysToAdult(i: number)
: Sets the number of days the mammal will take to reach adulthood.uses(i: number)
: Sets the number of uses the mammal has.maxFamiliarity(d: number)
: Sets the maximum familiarity, in the range [0, 1], that an adult mammal may be brought up to.eastRottenFood(eats: boolean)
: Sets if the animal will eat rotten food
: Sets the item tag the mammal will consider food.foodTag(tag: String)
: Accepts the registry ids of and sets the sound events the entity uses,.sounds(ambient: String, death: String, hurt: String, step: String, attack: @Nullable String, sleep: @Nullable String)
attack
, andsleep
may benull
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
: If the animal should crow every so often, defaults to.crows(crows: boolean)
false
: Sets the message displayed when the animal has a product ready.productReadyMessage(message: Component)
: Sets the default values of the type’s config.configs(configBuilder: Consumer<OviparousConfigBuilder>)
.hatchDays(i: number)
: Sets the number of days the animal will take to hatch.animalName(name: String)
: Sets the name of the animal in the config file.daysToAdult(i: number)
: Sets the number of days the animal will take to reach adulthood.uses(i: number)
: Sets the number of uses the animal has.maxFamiliarity(d: number)
: Sets the maximum familiarity, in the range [0, 1], that an adult animal may be brought up to.eastRottenFood(eats: boolean)
: Sets if the animal will eat rotten food
: Sets the item tag the mammal will consider food.foodTag(tag: String)
.sounds(ambient: String, death: String, hurt: String, step: String, attack: @Nullable String, sleep: @Nullable String)
: Accepts the registry ids of and sets the sound events the entity uses,attack
, andsleep
may benull
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
: Sets the default values of the type’s config.configs(configBuilder: Consumer<ProducingConfigBuilder>)
.ticksToProduce(i: number)
: Sets the number of ticks the animal will take to create produce.produceFamiliarity(d: number)
: Sets the familiarity, in the range [0, 1], that is required for the animal to have its product harvested.animalName(name: String)
: Sets the name of the animal in the config file.daysToAdult(i: number)
: Sets the number of days the animal will take to reach adulthood.uses(i: number)
: Sets the number of uses the animal has.maxFamiliarity(d: number)
: Sets the maximum familiarity, in the range [0, 1], that an adult animal may be brought up to.eastRottenFood(eats: boolean)
: Sets if the animal will eat rotten food
: Sets the item tag the mammal will consider food.foodTag(tag: String)
: Accepts the registry ids of and sets the sound events the entity uses,.sounds(ambient: String, death: String, hurt: String, step: String, attack: @Nullable String, sleep: @Nullable String)
attack
, andsleep
may benull
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
: Sets the default values of the type’s config.configs(configBuilder: Consumer<ProducingConfigBuilder>)
.ticksToProduce(i: number)
: Sets the number of ticks the animal will take to create produce.produceFamiliarity(d: number)
: Sets the familiarity, in the range [0, 1], that is required for the animal to have its product harvested.animalName(name: String)
: Sets the name of the animal in the config file.daysToAdult(i: number)
: Sets the number of days the animal will take to reach adulthood.uses(i: number)
: Sets the number of uses the animal has.maxFamiliarity(d: number)
: Sets the maximum familiarity, in the range [0, 1], that an adult animal may be brought up to.eastRottenFood(eats: boolean)
: Sets if the animal will eat rotten food
: Sets the item tag the mammal will consider food.foodTag(tag: String)
: Accepts the registry ids of and sets the sound events the entity uses,.sounds(ambient: String, death: String, hurt: String, step: String, attack: @Nullable String, sleep: @Nullabe String)
attack
, andsleep
may benull
Example
StartupEvents.registry('entity_type', event => {
event.create('my_dairy_animal', 'tfc:dairy_animal')
.configs(config => {
config.eatsRottenFood(true)
config.daysToAdult(12)
})
})