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 classEntityType.Builder<T extends Entity>static interfaceEntityType.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> canSpawnInside, EntityDimensions dimensions, int maxTrackDistance, int trackTickInterval) -
Method Summary
Modifier and Type Method Description booleanalwaysUpdateVelocity()Tcreate(ServerWorld world, NbtCompound itemNbt, Text name, PlayerEntity player, BlockPos pos, SpawnReason spawnReason, boolean alignPosition, boolean invertY)Tcreate(World world)static EntitycreateInstanceFromId(int type, World world)BoxcreateSimpleBoundingBox(double feetX, double feetY, double feetZ)static Optional<EntityType<?>>fromNbt(NbtCompound nbt)static Optional<EntityType<?>>get(String id)EntityDimensionsgetDimensions()static Optional<Entity>getEntityFromNbt(NbtCompound nbt, World world)floatgetHeight()static IdentifiergetId(EntityType<?> type)IdentifiergetLootTableId()intgetMaxTrackDistance()Returns the tracking distance, in chunks, of this type of entity for clients.TextgetName()protected static doublegetOriginY(WorldView world, BlockPos pos, boolean invertY, Box boundingBox)SpawnGroupgetSpawnGroup()intgetTrackTickInterval()StringgetTranslationKey()floatgetWidth()booleanisFireImmune()booleanisIn(Tag<EntityType<?>> tag)booleanisInvalidSpawn(BlockState state)Returns whether the EntityType can spawn inside the given block.booleanisSaveable()booleanisSpawnableFarFromPlayer()booleanisSummonable()private static Optional<Entity>loadEntityFromNbt(NbtCompound nbt, World world)static EntityloadEntityWithPassengers(NbtCompound nbt, World world, Function<Entity,Entity> entityProcessor)static voidloadFromEntityNbt(World world, PlayerEntity player, Entity entity, NbtCompound itemNbt)private static EntitynewInstance(World world, EntityType<?> type)private static <T extends Entity>
EntityType<T>register(String id, EntityType.Builder<T> type)Tspawn(ServerWorld world, NbtCompound itemNbt, Text name, PlayerEntity player, BlockPos pos, SpawnReason spawnReason, boolean alignPosition, boolean invertY)EntityspawnFromItemStack(ServerWorld world, ItemStack stack, PlayerEntity player, BlockPos pos, SpawnReason spawnReason, boolean alignPosition, boolean invertY)StringtoString()
-
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> canSpawnInside, EntityDimensions dimensions, int maxTrackDistance, int trackTickInterval)
-
-
Method Details
-
register
-
getId
-
get
-
spawnFromItemStack
@Nullable public Entity spawnFromItemStack(ServerWorld world, @Nullable ItemStack stack, @Nullable PlayerEntity player, BlockPos pos, SpawnReason spawnReason, boolean alignPosition, boolean invertY) -
spawn
@Nullable public T spawn(ServerWorld world, @Nullable NbtCompound itemNbt, @Nullable Text name, @Nullable PlayerEntity player, BlockPos pos, SpawnReason spawnReason, boolean alignPosition, boolean invertY) -
create
@Nullable public T create(ServerWorld world, @Nullable NbtCompound itemNbt, @Nullable Text name, @Nullable PlayerEntity player, BlockPos pos, SpawnReason spawnReason, boolean alignPosition, boolean invertY) -
getOriginY
-
loadFromEntityNbt
public static void loadFromEntityNbt(World world, @Nullable PlayerEntity player, @Nullable Entity entity, @Nullable NbtCompound itemNbt) -
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
-
getEntityFromNbt
-
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
-
fromNbt
-
loadEntityWithPassengers
-
loadEntityFromNbt
-
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
-