Package net.minecraft.entity
Class EntityType<T extends Entity>
java.lang.Object
net.minecraft.entity.EntityType<T>
public class EntityType<T extends Entity> extends Object
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
EntityType.Builder<T extends Entity>
static interface
EntityType.EntityFactory<T extends Entity>
-
Field Summary
-
Constructor Summary
Constructors Constructor Description EntityType(EntityType.EntityFactory<T> factory, SpawnGroup spawnGroup, boolean saveable, boolean summonable, boolean fireImmune, boolean spawnableFarFromPlayer, ImmutableSet<Block> immutableSet, EntityDimensions entityDimensions, int int2, int int3)
-
Method Summary
Modifier and Type Method Description boolean
alwaysUpdateVelocity()
T
create(ServerWorld serverWorld, CompoundTag itemTag, Text name, PlayerEntity player, BlockPos pos, SpawnReason spawnReason, boolean alignPosition, boolean invertY)
T
create(World world)
static Entity
createInstanceFromId(int type, World world)
Box
createSimpleBoundingBox(double feetX, double feetY, double feetZ)
static Optional<EntityType<?>>
fromTag(CompoundTag compoundTag)
static Optional<EntityType<?>>
get(String id)
EntityDimensions
getDimensions()
static Optional<Entity>
getEntityFromTag(CompoundTag tag, World world)
float
getHeight()
static Identifier
getId(EntityType<?> type)
Identifier
getLootTableId()
int
getMaxTrackDistance()
Returns the tracking distance, in chunks, of this type of entity for clients.Text
getName()
protected static double
getOriginY(WorldView world, BlockPos pos, boolean invertY, Box boundingBox)
SpawnGroup
getSpawnGroup()
int
getTrackTickInterval()
String
getTranslationKey()
float
getWidth()
boolean
isFireImmune()
boolean
isIn(Tag<EntityType<?>> tag)
boolean
isInvalidSpawn(BlockState blockState)
Returns whether the EntityType can spawn inside the given block.boolean
isSaveable()
boolean
isSpawnableFarFromPlayer()
boolean
isSummonable()
private static Optional<Entity>
loadEntityFromTag(CompoundTag compoundTag, World world)
static Entity
loadEntityWithPassengers(CompoundTag compoundTag, World world, Function<Entity,Entity> entityProcessor)
static void
loadFromEntityTag(World world, PlayerEntity player, Entity entity, CompoundTag itemTag)
private static Entity
newInstance(World world, EntityType<?> type)
private static <T extends Entity>
EntityType<T>register(String id, EntityType.Builder<T> type)
T
spawn(ServerWorld serverWorld, CompoundTag itemTag, Text name, PlayerEntity player, BlockPos pos, SpawnReason spawnReason, boolean alignPosition, boolean invertY)
Entity
spawnFromItemStack(ServerWorld serverWorld, ItemStack stack, PlayerEntity player, BlockPos pos, SpawnReason spawnReason, boolean alignPosition, boolean invertY)
String
toString()
-
Field Details
-
LOGGER
-
AREA_EFFECT_CLOUD
-
ARMOR_STAND
-
ARROW
-
BAT
-
BEE
-
BLAZE
-
BOAT
-
CAT
-
CAVE_SPIDER
-
CHICKEN
-
COD
-
COW
-
CREEPER
-
DOLPHIN
-
DONKEY
-
DRAGON_FIREBALL
-
DROWNED
-
ELDER_GUARDIAN
-
END_CRYSTAL
-
ENDER_DRAGON
-
ENDERMAN
-
ENDERMITE
-
EVOKER
-
EVOKER_FANGS
-
EXPERIENCE_ORB
-
EYE_OF_ENDER
-
FALLING_BLOCK
-
FIREWORK_ROCKET
-
FOX
-
GHAST
-
GIANT
-
GUARDIAN
-
HOGLIN
-
HORSE
-
HUSK
-
ILLUSIONER
-
IRON_GOLEM
-
ITEM
-
ITEM_FRAME
-
FIREBALL
-
LEASH_KNOT
-
LIGHTNING_BOLT
-
LLAMA
-
LLAMA_SPIT
-
MAGMA_CUBE
-
MINECART
-
CHEST_MINECART
-
COMMAND_BLOCK_MINECART
-
FURNACE_MINECART
-
HOPPER_MINECART
-
SPAWNER_MINECART
-
TNT_MINECART
-
MULE
-
MOOSHROOM
-
OCELOT
-
PAINTING
-
PANDA
-
PARROT
-
PHANTOM
-
PIG
-
PIGLIN
-
PIGLIN_BRUTE
-
PILLAGER
-
POLAR_BEAR
-
TNT
-
PUFFERFISH
-
RABBIT
-
RAVAGER
-
SALMON
-
SHEEP
-
SHULKER
-
SHULKER_BULLET
-
SILVERFISH
-
SKELETON
-
SKELETON_HORSE
-
SLIME
-
SMALL_FIREBALL
-
SNOW_GOLEM
-
SNOWBALL
-
SPECTRAL_ARROW
-
SPIDER
-
SQUID
-
STRAY
-
STRIDER
-
EGG
-
ENDER_PEARL
-
EXPERIENCE_BOTTLE
-
POTION
-
TRIDENT
-
TRADER_LLAMA
-
TROPICAL_FISH
-
TURTLE
-
VEX
-
VILLAGER
-
VINDICATOR
-
WANDERING_TRADER
-
WITCH
-
WITHER
-
WITHER_SKELETON
-
WITHER_SKULL
-
WOLF
-
ZOGLIN
-
ZOMBIE
-
ZOMBIE_HORSE
-
ZOMBIE_VILLAGER
-
ZOMBIFIED_PIGLIN
-
PLAYER
-
FISHING_BOBBER
-
factory
-
spawnGroup
-
canSpawnInside
-
saveable
private final boolean saveable -
summonable
private final boolean summonable -
fireImmune
private final boolean fireImmune -
spawnableFarFromPlayer
private final boolean spawnableFarFromPlayer -
maxTrackDistance
private final int maxTrackDistance -
trackTickInterval
private final int trackTickInterval -
translationKey
-
name
-
lootTableId
-
dimensions
-
-
Constructor Details
-
EntityType
public EntityType(EntityType.EntityFactory<T> factory, SpawnGroup spawnGroup, boolean saveable, boolean summonable, boolean fireImmune, boolean spawnableFarFromPlayer, ImmutableSet<Block> immutableSet, EntityDimensions entityDimensions, int int2, int int3)
-
-
Method Details
-
register
-
getId
-
get
-
spawnFromItemStack
@Nullable public Entity spawnFromItemStack(ServerWorld serverWorld, @Nullable ItemStack stack, @Nullable PlayerEntity player, BlockPos pos, SpawnReason spawnReason, boolean alignPosition, boolean invertY) -
spawn
@Nullable public T spawn(ServerWorld serverWorld, @Nullable CompoundTag itemTag, @Nullable Text name, @Nullable PlayerEntity player, BlockPos pos, SpawnReason spawnReason, boolean alignPosition, boolean invertY) -
create
@Nullable public T create(ServerWorld serverWorld, @Nullable CompoundTag itemTag, @Nullable Text name, @Nullable PlayerEntity player, BlockPos pos, SpawnReason spawnReason, boolean alignPosition, boolean invertY) -
getOriginY
-
loadFromEntityTag
public static void loadFromEntityTag(World world, @Nullable PlayerEntity player, @Nullable Entity entity, @Nullable CompoundTag itemTag) -
isSaveable
public boolean isSaveable() -
isSummonable
public boolean isSummonable() -
isFireImmune
public boolean isFireImmune() -
isSpawnableFarFromPlayer
public boolean isSpawnableFarFromPlayer() -
getSpawnGroup
-
getTranslationKey
-
getName
-
toString
-
getLootTableId
-
getWidth
public float getWidth() -
getHeight
public float getHeight() -
create
-
createInstanceFromId
-
getEntityFromTag
-
newInstance
@Environment(CLIENT) @Nullable private static Entity newInstance(World world, @Nullable EntityType<?> type) -
createSimpleBoundingBox
-
isInvalidSpawn
Returns whether the EntityType can spawn inside the given block.By default, non-fire-immune mobs can't spawn in/on blocks dealing fire damage. Any mob can't spawn in wither roses, sweet berry bush, or cacti.
This can be overwritten via
EntityType.Builder.allowSpawningInside(Block[])
-
getDimensions
-
fromTag
-
loadEntityWithPassengers
-
loadEntityFromTag
-
getMaxTrackDistance
public int getMaxTrackDistance()Returns the tracking distance, in chunks, of this type of entity for clients. This will be then modified by the server's tracking distance multiplier. -
getTrackTickInterval
public int getTrackTickInterval() -
alwaysUpdateVelocity
public boolean alwaysUpdateVelocity() -
isIn
-