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

public class FabricEntityTypeBuilder<T extends net.minecraft.entity.Entity> extends Object
Extended version of EntityType.Builder with added registration for server->client entity tracking values.
  • Constructor Details

    • FabricEntityTypeBuilder

      protected FabricEntityTypeBuilder(net.minecraft.entity.SpawnGroup spawnGroup, net.minecraft.entity.EntityType.EntityFactory<T> factory)
  • Method Details

    • create

      public static <T extends net.minecraft.entity.Entity> FabricEntityTypeBuilder<T> 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 group
      factory - 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

      public FabricEntityTypeBuilder<T> spawnGroup(net.minecraft.entity.SpawnGroup group)
    • entityFactory

      public <N extends T> FabricEntityTypeBuilder<N> entityFactory(net.minecraft.entity.EntityType.EntityFactory<N> factory)
    • disableSummon

      public FabricEntityTypeBuilder<T> disableSummon()
      Whether this entity type is summonable using the /summon command.
      Returns:
      this builder for chaining
    • disableSaving

      public FabricEntityTypeBuilder<T> disableSaving()
    • fireImmune

      public FabricEntityTypeBuilder<T> fireImmune()
      Sets this entity type to be fire immune.
      Returns:
      this builder for chaining
    • spawnableFarFromPlayer

      public FabricEntityTypeBuilder<T> spawnableFarFromPlayer()
      Sets whether this entity type can be spawned far away from a player.
      Returns:
      this builder for chaining
    • dimensions

      public FabricEntityTypeBuilder<T> dimensions(net.minecraft.entity.EntityDimensions 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)
    • trackable

      @Deprecated public FabricEntityTypeBuilder<T> trackable(int trackRangeBlocks, int trackedUpdateRate, boolean forceTrackedVelocityUpdates)
    • trackRangeChunks

      public FabricEntityTypeBuilder<T> trackRangeChunks(int range)
      Sets the maximum chunk tracking range of this entity type.
      Parameters:
      range - the tracking range in chunks
      Returns:
      this builder for chaining
    • trackRangeBlocks

      public FabricEntityTypeBuilder<T> trackRangeBlocks(int range)
      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

      public FabricEntityTypeBuilder<T> trackedUpdateRate(int rate)
    • forceTrackedVelocityUpdates

      public FabricEntityTypeBuilder<T> forceTrackedVelocityUpdates(boolean forceTrackedVelocityUpdates)
    • specificSpawnBlocks

      public FabricEntityTypeBuilder<T> specificSpawnBlocks(net.minecraft.block.Block... blocks)
      Sets the ImmutableSet of blocks this entity can spawn on.
      Parameters:
      blocks - the blocks the entity can spawn on
      Returns:
      this builder for chaining
    • build

      public net.minecraft.entity.EntityType<T> build()
      Creates the entity type.
      Returns:
      a new EntityType