Class FabricEntityTypeBuilder<T extends net.minecraft.entity.Entity>
java.lang.Object
net.fabricmc.fabric.api.object.builder.v1.entity.FabricEntityTypeBuilder<T>
- Type Parameters:
T
- Entity class.
- Direct Known Subclasses:
FabricEntityTypeBuilder.Living
Extended version of
EntityType.Builder
with added registration for
server->client entity tracking values.-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
FabricEntityTypeBuilder.Living<T extends net.minecraft.entity.LivingEntity>
An extended version ofFabricEntityTypeBuilder
with support for features on present onliving entities
, such as default attributes.static class
FabricEntityTypeBuilder.Mob<T extends net.minecraft.entity.mob.MobEntity>
An extended version ofFabricEntityTypeBuilder
with support for features on present onmob entities
, such as spawn restrictions. -
Constructor Summary
ModifierConstructorDescriptionprotected
FabricEntityTypeBuilder(net.minecraft.entity.SpawnGroup spawnGroup, net.minecraft.entity.EntityType.EntityFactory<T> factory)
-
Method Summary
Modifier and TypeMethodDescriptionnet.minecraft.entity.EntityType<T>
build()
Creates the entity type.static <T extends net.minecraft.entity.Entity>
FabricEntityTypeBuilder<T>create()
Creates an entity type builder.static <T extends net.minecraft.entity.Entity>
FabricEntityTypeBuilder<T>create(net.minecraft.entity.SpawnGroup spawnGroup)
Creates an entity type builder.static <T extends net.minecraft.entity.Entity>
FabricEntityTypeBuilder<T>create(net.minecraft.entity.SpawnGroup spawnGroup, net.minecraft.entity.EntityType.EntityFactory<T> factory)
Creates an entity type builder.static <T extends net.minecraft.entity.LivingEntity>
FabricEntityTypeBuilder.Living<T>Creates an entity type builder for a living entity.static <T extends net.minecraft.entity.mob.MobEntity>
FabricEntityTypeBuilder.Mob<T>Creates an entity type builder for a mob entity.dimensions(net.minecraft.entity.EntityDimensions dimensions)
Sets the dimensions of this entity type.Whether this entity type is summonable using the/summon
command.<N extends T>
FabricEntityTypeBuilder<N>entityFactory(net.minecraft.entity.EntityType.EntityFactory<N> factory)
Sets this entity type to be fire immune.forceTrackedVelocityUpdates(boolean forceTrackedVelocityUpdates)
Sets whether this entity type can be spawned far away from a player.spawnGroup(net.minecraft.entity.SpawnGroup group)
specificSpawnBlocks(net.minecraft.block.Block... blocks)
Sets theImmutableSet
of blocks this entity can spawn on.trackable(int trackRangeBlocks, int trackedUpdateRate)
Deprecated.trackable(int trackRangeBlocks, int trackedUpdateRate, boolean forceTrackedVelocityUpdates)
Deprecated.trackedUpdateRate(int rate)
trackRangeBlocks(int range)
Sets the maximum block range at which players can see this entity type.trackRangeChunks(int range)
Sets the maximum chunk tracking range of this entity type.
-
Constructor Details
-
FabricEntityTypeBuilder
protected FabricEntityTypeBuilder(net.minecraft.entity.SpawnGroup spawnGroup, net.minecraft.entity.EntityType.EntityFactory<T> factory)
-
-
Method Details
-
create
Creates an entity type builder.This entity's spawn group will automatically be set to
SpawnGroup.MISC
.- Type Parameters:
T
- the type of entity- Returns:
- a new entity type builder
-
create
public static <T extends net.minecraft.entity.Entity> FabricEntityTypeBuilder<T> create(net.minecraft.entity.SpawnGroup spawnGroup)Creates an entity type builder.- Type Parameters:
T
- the type of entity- Parameters:
spawnGroup
- the entity spawn group- Returns:
- a new entity type builder
-
create
public static <T extends net.minecraft.entity.Entity> FabricEntityTypeBuilder<T> create(net.minecraft.entity.SpawnGroup spawnGroup, net.minecraft.entity.EntityType.EntityFactory<T> factory)Creates an entity type builder.- Type Parameters:
T
- the type of entity- Parameters:
spawnGroup
- the entity spawn groupfactory
- the entity factory used to create this entity- Returns:
- a new entity type builder
-
createLiving
public static <T extends net.minecraft.entity.LivingEntity> FabricEntityTypeBuilder.Living<T> createLiving()Creates an entity type builder for a living entity.This entity's spawn group will automatically be set to
SpawnGroup.MISC
.- Type Parameters:
T
- the type of entity- Returns:
- a new living entity type builder
-
createMob
public static <T extends net.minecraft.entity.mob.MobEntity> FabricEntityTypeBuilder.Mob<T> createMob()Creates an entity type builder for a mob entity.- Type Parameters:
T
- the type of entity- Returns:
- a new mob entity type builder
-
spawnGroup
-
entityFactory
public <N extends T> FabricEntityTypeBuilder<N> entityFactory(net.minecraft.entity.EntityType.EntityFactory<N> factory) -
disableSummon
Whether this entity type is summonable using the/summon
command.- Returns:
- this builder for chaining
-
disableSaving
-
fireImmune
Sets this entity type to be fire immune.- Returns:
- this builder for chaining
-
spawnableFarFromPlayer
Sets whether this entity type can be spawned far away from a player.- Returns:
- this builder for chaining
-
dimensions
Sets the dimensions of this entity type.- Parameters:
dimensions
- the dimensions representing the entity's size- Returns:
- this builder for chaining
-
trackable
@Deprecated public FabricEntityTypeBuilder<T> trackable(int trackRangeBlocks, int trackedUpdateRate)Deprecated. -
trackable
@Deprecated public FabricEntityTypeBuilder<T> trackable(int trackRangeBlocks, int trackedUpdateRate, boolean forceTrackedVelocityUpdates)Deprecated. -
trackRangeChunks
Sets the maximum chunk tracking range of this entity type.- Parameters:
range
- the tracking range in chunks- Returns:
- this builder for chaining
-
trackRangeBlocks
Sets the maximum block range at which players can see this entity type.- Parameters:
range
- the tracking range in blocks- Returns:
- this builder for chaining
-
trackedUpdateRate
-
forceTrackedVelocityUpdates
-
specificSpawnBlocks
Sets theImmutableSet
of blocks this entity can spawn on.- Parameters:
blocks
- the blocks the entity can spawn on- Returns:
- this builder for chaining
-
build
Creates the entity type.- Returns:
- a new
EntityType
-
trackRangeBlocks(int)
,trackedUpdateRate(int)
andforceTrackedVelocityUpdates(boolean)