Class FabricEntityTypeBuilder.Mob<T extends MobEntity>
java.lang.Object
net.fabricmc.fabric.api.object.builder.v1.entity.FabricEntityTypeBuilder<T>
net.fabricmc.fabric.api.object.builder.v1.entity.FabricEntityTypeBuilder.Living<T>
net.fabricmc.fabric.api.object.builder.v1.entity.FabricEntityTypeBuilder.Mob<T>
- Type Parameters:
T
- Entity class.
- Enclosing class:
FabricEntityTypeBuilder<T extends Entity>
public static class FabricEntityTypeBuilder.Mob<T extends MobEntity>
extends FabricEntityTypeBuilder.Living<T>
An extended version of
FabricEntityTypeBuilder
with support for features on present on mob entities
, such as spawn restrictions.-
Nested Class Summary
Nested classes/interfaces inherited from class net.fabricmc.fabric.api.object.builder.v1.entity.FabricEntityTypeBuilder
FabricEntityTypeBuilder.Living<T extends LivingEntity>, FabricEntityTypeBuilder.Mob<T extends MobEntity>
-
Constructor Summary
ModifierConstructorDescriptionprotected
Mob
(SpawnGroup spawnGroup, EntityType.EntityFactory<T> function) -
Method Summary
Modifier and TypeMethodDescriptionbuild()
Creates the entity type.defaultAttributes
(Supplier<DefaultAttributeContainer.Builder> defaultAttributeBuilder) Sets the default attributes for a type of living entity.dimensions
(EntityDimensions dimensions) Sets the dimensions of this entity type.Whether this entity type is summonable using the/summon
command.<N extends T>
FabricEntityTypeBuilder.Mob<N>entityFactory
(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
(SpawnGroup group) spawnRestriction
(SpawnRestriction.Location location, Heightmap.Type heightmap, SpawnRestriction.SpawnPredicate<T> spawnPredicate) Registers a spawn restriction for this entity.specificSpawnBlocks
(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.Methods inherited from class net.fabricmc.fabric.api.object.builder.v1.entity.FabricEntityTypeBuilder
create, create, create, createLiving, createMob
-
Constructor Details
-
Mob
-
-
Method Details
-
spawnGroup
- Overrides:
spawnGroup
in classFabricEntityTypeBuilder.Living<T extends MobEntity>
-
entityFactory
public <N extends T> FabricEntityTypeBuilder.Mob<N> entityFactory(EntityType.EntityFactory<N> factory) - Overrides:
entityFactory
in classFabricEntityTypeBuilder.Living<T extends MobEntity>
-
disableSummon
Description copied from class:FabricEntityTypeBuilder
Whether this entity type is summonable using the/summon
command.- Overrides:
disableSummon
in classFabricEntityTypeBuilder.Living<T extends MobEntity>
- Returns:
- this builder for chaining
-
disableSaving
- Overrides:
disableSaving
in classFabricEntityTypeBuilder.Living<T extends MobEntity>
-
fireImmune
Description copied from class:FabricEntityTypeBuilder
Sets this entity type to be fire immune.- Overrides:
fireImmune
in classFabricEntityTypeBuilder.Living<T extends MobEntity>
- Returns:
- this builder for chaining
-
spawnableFarFromPlayer
Description copied from class:FabricEntityTypeBuilder
Sets whether this entity type can be spawned far away from a player.- Overrides:
spawnableFarFromPlayer
in classFabricEntityTypeBuilder.Living<T extends MobEntity>
- Returns:
- this builder for chaining
-
dimensions
Description copied from class:FabricEntityTypeBuilder
Sets the dimensions of this entity type.- Overrides:
dimensions
in classFabricEntityTypeBuilder.Living<T extends MobEntity>
- Parameters:
dimensions
- the dimensions representing the entity's size- Returns:
- this builder for chaining
-
trackable
@Deprecated public FabricEntityTypeBuilder.Mob<T> trackable(int trackRangeBlocks, int trackedUpdateRate) Deprecated.- Overrides:
trackable
in classFabricEntityTypeBuilder.Living<T extends MobEntity>
-
trackable
@Deprecated public FabricEntityTypeBuilder.Mob<T> trackable(int trackRangeBlocks, int trackedUpdateRate, boolean forceTrackedVelocityUpdates) Deprecated.- Overrides:
trackable
in classFabricEntityTypeBuilder.Living<T extends MobEntity>
-
trackRangeChunks
Description copied from class:FabricEntityTypeBuilder
Sets the maximum chunk tracking range of this entity type.- Overrides:
trackRangeChunks
in classFabricEntityTypeBuilder.Living<T extends MobEntity>
- Parameters:
range
- the tracking range in chunks- Returns:
- this builder for chaining
-
trackRangeBlocks
Description copied from class:FabricEntityTypeBuilder
Sets the maximum block range at which players can see this entity type.- Overrides:
trackRangeBlocks
in classFabricEntityTypeBuilder.Living<T extends MobEntity>
- Parameters:
range
- the tracking range in blocks- Returns:
- this builder for chaining
-
trackedUpdateRate
- Overrides:
trackedUpdateRate
in classFabricEntityTypeBuilder.Living<T extends MobEntity>
-
forceTrackedVelocityUpdates
public FabricEntityTypeBuilder.Mob<T> forceTrackedVelocityUpdates(boolean forceTrackedVelocityUpdates) - Overrides:
forceTrackedVelocityUpdates
in classFabricEntityTypeBuilder.Living<T extends MobEntity>
-
specificSpawnBlocks
Description copied from class:FabricEntityTypeBuilder
Sets theImmutableSet
of blocks this entity can spawn on.- Overrides:
specificSpawnBlocks
in classFabricEntityTypeBuilder.Living<T extends MobEntity>
- Parameters:
blocks
- the blocks the entity can spawn on- Returns:
- this builder for chaining
-
defaultAttributes
public FabricEntityTypeBuilder.Mob<T> defaultAttributes(Supplier<DefaultAttributeContainer.Builder> defaultAttributeBuilder) Description copied from class:FabricEntityTypeBuilder.Living
Sets the default attributes for a type of living entity.This can be used in a fashion similar to this:
FabricEntityTypeBuilder.createLiving() .spawnGroup(SpawnGroup.CREATURE) .entityFactory(MyCreature::new) .defaultAttributes(LivingEntity::createLivingAttributes) ... .build();
- Overrides:
defaultAttributes
in classFabricEntityTypeBuilder.Living<T extends MobEntity>
- Parameters:
defaultAttributeBuilder
- a function to generate the default attribute builder from the entity type- Returns:
- this builder for chaining
-
spawnRestriction
public FabricEntityTypeBuilder.Mob<T> spawnRestriction(SpawnRestriction.Location location, Heightmap.Type heightmap, SpawnRestriction.SpawnPredicate<T> spawnPredicate) Registers a spawn restriction for this entity.This is used by mobs to determine whether Minecraft should spawn an entity within a certain context.
- Returns:
- this builder for chaining.
-
build
Description copied from class:FabricEntityTypeBuilder
Creates the entity type.- Overrides:
build
in classFabricEntityTypeBuilder.Living<T extends MobEntity>
- Returns:
- a new
EntityType
-
trackRangeBlocks(int)
,trackedUpdateRate(int)
andforceTrackedVelocityUpdates(boolean)