Package net.minecraft.world.entity
Class EntityType<T extends Entity>
java.lang.Object
net.minecraft.world.entity.EntityType<T>
- All Implemented Interfaces:
FeatureElement,EntityTypeTest<Entity,T>
public class EntityType<T extends Entity>
extends Object
implements FeatureElement, EntityTypeTest<Entity,T>
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classEntityType.Builder<T extends Entity>static interfaceEntityType.EntityFactory<T extends Entity> -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final EntityType<Boat> static final EntityType<ChestBoat> static final EntityType<Allay> private final booleanstatic final EntityType<AreaEffectCloud> static final EntityType<Armadillo> static final EntityType<ArmorStand> static final EntityType<Arrow> static final EntityType<Axolotl> static final EntityType<ChestRaft> static final EntityType<Raft> static final EntityType<Bat> static final EntityType<Bee> static final EntityType<Boat> static final EntityType<ChestBoat> static final EntityType<Blaze> static final EntityType<Display.BlockDisplay> static final EntityType<Bogged> static final EntityType<Breeze> static final EntityType<BreezeWindCharge> private final Holder.Reference<EntityType<?>> static final EntityType<Camel> private final booleanstatic final EntityType<Cat> private final MobCategorystatic final EntityType<CaveSpider> static final EntityType<Boat> static final EntityType<ChestBoat> static final EntityType<MinecartChest> static final EntityType<Chicken> private final intstatic final EntityType<Cod> static final com.mojang.serialization.Codec<EntityType<?>> static final EntityType<MinecartCommandBlock> static final EntityType<CopperGolem> static final EntityType<Cow> static final EntityType<Creaking> static final EntityType<Creeper> static final EntityType<Boat> static final EntityType<ChestBoat> private Componentprivate final Stringprivate final EntityDimensionsprivate static final intstatic final EntityType<Dolphin> static final EntityType<Donkey> static final EntityType<DragonFireball> static final EntityType<Drowned> static final EntityType<ThrownEgg> static final EntityType<ElderGuardian> static final EntityType<EndCrystal> static final EntityType<EnderDragon> static final EntityType<ThrownEnderpearl> static final EntityType<EnderMan> static final EntityType<Endermite> static final EntityType<Evoker> static final EntityType<EvokerFangs> static final EntityType<ThrownExperienceBottle> static final EntityType<ExperienceOrb> static final EntityType<EyeOfEnder> private final EntityType.EntityFactory<T> static final EntityType<FallingBlockEntity> static final EntityType<LargeFireball> private final booleanstatic final EntityType<FireworkRocketEntity> static final EntityType<FishingHook> static final EntityType<Fox> static final EntityType<Frog> static final EntityType<MinecartFurnace> static final EntityType<Ghast> static final EntityType<Giant> static final EntityType<GlowItemFrame> static final EntityType<GlowSquid> static final EntityType<Goat> static final EntityType<Guardian> static final EntityType<HappyGhast> static final EntityType<Hoglin> static final EntityType<MinecartHopper> static final EntityType<Horse> static final EntityType<Husk> static final EntityType<Illusioner> private final ImmutableSet<Block> static final EntityType<Interaction> static final EntityType<IronGolem> static final EntityType<ItemEntity> static final EntityType<Display.ItemDisplay> static final EntityType<ItemFrame> static final EntityType<Boat> static final EntityType<ChestBoat> static final EntityType<LeashFenceKnotEntity> static final EntityType<LightningBolt> static final EntityType<ThrownLingeringPotion> static final EntityType<Llama> static final EntityType<LlamaSpit> private static final org.slf4j.Loggerprivate final Optional<ResourceKey<LootTable>> private static final floatstatic final EntityType<MagmaCube> static final EntityType<Boat> static final EntityType<ChestBoat> static final EntityType<Mannequin> static final EntityType<Marker> static final EntityType<Minecart> static final EntityType<MushroomCow> static final EntityType<Mule> static final EntityType<Boat> static final EntityType<ChestBoat> static final EntityType<Ocelot> static final EntityType<OminousItemSpawner> private final booleanprivate static final Set<EntityType<?>> static final EntityType<Painting> static final EntityType<Boat> static final EntityType<ChestBoat> static final EntityType<Panda> static final EntityType<Parrot> static final EntityType<Phantom> static final EntityType<Pig> static final EntityType<Piglin> static final EntityType<PiglinBrute> static final EntityType<Pillager> static final EntityType<Player> static final EntityType<PolarBear> static final EntityType<Pufferfish> static final EntityType<Rabbit> static final EntityType<Ravager> private final FeatureFlagSetstatic final EntityType<Salmon> private final booleanstatic final EntityType<Sheep> static final EntityType<Shulker> static final EntityType<ShulkerBullet> static final EntityType<Silverfish> static final EntityType<Skeleton> static final EntityType<SkeletonHorse> static final EntityType<Slime> static final EntityType<SmallFireball> static final EntityType<Sniffer> static final EntityType<SnowGolem> static final EntityType<Snowball> private final floatstatic final EntityType<MinecartSpawner> static final EntityType<SpectralArrow> static final EntityType<Spider> static final EntityType<ThrownSplashPotion> static final EntityType<Boat> static final EntityType<ChestBoat> static final EntityType<Squid> static final EntityType<Stray> static final StreamCodec<RegistryFriendlyByteBuf, EntityType<?>> static final EntityType<Strider> private final booleanstatic final EntityType<Tadpole> static final EntityType<Display.TextDisplay> static final EntityType<PrimedTnt> static final EntityType<MinecartTNT> private final Predicate<EntityType<?>> private final ToIntFunction<EntityType<?>> static final EntityType<TraderLlama> static final EntityType<ThrownTrident> static final EntityType<TropicalFish> static final EntityType<Turtle> private final intprivate final ToIntFunction<EntityType<?>> static final EntityType<Vex> static final EntityType<Villager> static final EntityType<Vindicator> static final EntityType<WanderingTrader> static final EntityType<Warden> static final EntityType<WindCharge> static final EntityType<Witch> static final EntityType<WitherBoss> static final EntityType<WitherSkeleton> static final EntityType<WitherSkull> static final EntityType<Wolf> static final EntityType<Zoglin> static final EntityType<Zombie> static final EntityType<ZombieHorse> static final EntityType<ZombieVillager> static final EntityType<ZombifiedPiglin> Fields inherited from interface net.minecraft.world.flag.FeatureElement
FILTERED_REGISTRIES -
Constructor Summary
ConstructorsConstructorDescriptionEntityType(EntityType.EntityFactory<T> pFactory, MobCategory pCategory, boolean pSerialize, boolean pSummon, boolean pFireImmune, boolean pCanSpawnFarFromPlayer, ImmutableSet<Block> pImmuneTo, EntityDimensions pDimensions, float pSpawnDimensionsScale, int pClientTrackingRange, int pUpdateInterval, String pDescriptionId, Optional<ResourceKey<LootTable>> pLootTable, FeatureFlagSet pRequiredFeatures, boolean pAllowdInPeaceful) EntityType(EntityType.EntityFactory<T> pFactory, MobCategory pCategory, boolean pSerialize, boolean pSummon, boolean pFireImmune, boolean pCanSpawnFarFromPlayer, ImmutableSet<Block> pImmuneTo, EntityDimensions pDimensions, float pSpawnDimensionsScale, int pClientTrackingRange, int pUpdateInterval, String pDescriptionId, Optional<ResourceKey<LootTable>> pLootTable, FeatureFlagSet pRequiredFeatures, boolean pAllowdInPeaceful, Predicate<EntityType<?>> trackDeltasSupplier, ToIntFunction<EntityType<?>> trackingRangeSupplier, ToIntFunction<EntityType<?>> updateIntervalSupplier, boolean onlyOpCanSetNbt) -
Method Summary
Modifier and TypeMethodDescriptionappendComponentsConfig(Consumer<T> pConsumer, ItemStack pStack) appendCustomEntityStackConfig(Consumer<T> pConsumer, Level pLevel, ItemStack pStack, LivingEntity pOwner) appendDefaultStackConfig(Consumer<T> pConsumer, Level pLevel, ItemStack pStack, LivingEntity pOwner) private static EntityType.EntityFactory<Boat> boatFactory(Supplier<Item> pBoatItemGetter) Deprecated.static Optional<EntityType<?>> by(ValueInput pInput) static Optional<EntityType<?>> Tries to get the entity type associated by the key.booleanbooleanbooleanprivate static EntityType.EntityFactory<ChestBoat> chestBoatFactory(Supplier<Item> pBoatItemGetter) private static EntityType.EntityFactory<ChestRaft> chestRaftFactory(Supplier<Item> pRaftItemGetter) intcreate(ServerLevel pLevel, Consumer<T> pConsumer, BlockPos pPos, EntitySpawnReason pReason, boolean pShouldOffsetY, boolean pShouldOffsetYMore) create(EntityType<?> pEntityType, ValueInput pInput, Level pLevel, EntitySpawnReason pSpawnReason) create(Level pLevel, EntitySpawnReason pSpawnReason) create(ValueInput pInput, Level pLevel, EntitySpawnReason pSpawnReason) createDefaultStackConfig(Level pLevel, ItemStack pStack, LivingEntity pOwner) private booleanprivate intprivate intbooleanfloatstatic ResourceLocationgetKey(EntityType<?> pEntityType) getSpawnAABB(double pX, double pY, double pZ) Stream<TagKey<EntityType<?>>> getTags()floatgetWidth()protected static doublegetYOffset(LevelReader pLevel, BlockPos pPos, boolean pShouldOffsetYMore, AABB pBox) booleanis(HolderSet<EntityType<?>> pEntityType) booleanis(TagKey<EntityType<?>> pTag) Checks if this entity type is contained in the tagbooleanbooleanisBlockDangerous(BlockState pState) loadEntitiesRecursive(ValueInput.ValueInputList pInput, Level pLevel, EntitySpawnReason pSpawnReason) static EntityloadEntityRecursive(CompoundTag pEntityTag, Level pLevel, EntitySpawnReason pSpawnReason, Function<Entity, Entity> pAdapter) static EntityloadEntityRecursive(EntityType<?> pEntityType, CompoundTag pTag, Level pLevel, EntitySpawnReason pSpawnReason, Function<Entity, Entity> pAdapter) static EntityloadEntityRecursive(EntityType<?> pEntityType, ValueInput pValueInput, Level pLevel, EntitySpawnReason pSpawnReason, Function<Entity, Entity> pAdapter) static EntityloadEntityRecursive(ValueInput pInput, Level pLevel, EntitySpawnReason pSpawnReason, Function<Entity, Entity> pAdapter) private static EntityloadPassengersRecursive(Entity pEntityType, ValueInput pValueInput, Level pLevel, EntitySpawnReason pSpawnReason, Function<Entity, Entity> pAdapter) loadStaticEntity(EntityType<?> pEntityType, ValueInput pValueInput, Level pLevel, EntitySpawnReason pSpawnReason) loadStaticEntity(ValueInput pInput, Level pLevel, EntitySpawnReason pSpawnReason) booleanprivate static EntityType.EntityFactory<Raft> raftFactory(Supplier<Item> pRaftItemGetter) private static <T extends Entity>
EntityType<T> register(String pKey, EntityType.Builder<T> pBuilder) private static <T extends Entity>
EntityType<T> register(ResourceKey<EntityType<?>> pKey, EntityType.Builder<T> pBuilder) spawn(ServerLevel pLevel, Consumer<T> pConsumer, BlockPos pPos, EntitySpawnReason pReason, boolean pShouldOffsetY, boolean pShouldOffsetYMore) spawn(ServerLevel pLevel, BlockPos pPos, EntitySpawnReason pReason) spawn(ServerLevel pLevel, ItemStack pSpawnedFrom, LivingEntity pOwner, BlockPos pPos, EntitySpawnReason pReason, boolean pShouldOffsetY, boolean pShouldOffsetYMore) toString()booleanstatic voidupdateCustomEntityTag(Level pLevel, LivingEntity pOwner, Entity pEntity, TypedEntityData<EntityType<?>> pData) intprivate static ResourceKey<EntityType<?>> vanillaEntityId(String pName) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface net.minecraft.world.flag.FeatureElement
isEnabled
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
builtInRegistryHolder
-
CODEC
-
STREAM_CODEC
-
MAGIC_HORSE_WIDTH
private static final float MAGIC_HORSE_WIDTH- See Also:
-
DISPLAY_TRACKING_RANGE
private static final int DISPLAY_TRACKING_RANGE- See Also:
-
ACACIA_BOAT
-
ACACIA_CHEST_BOAT
-
ALLAY
-
AREA_EFFECT_CLOUD
-
ARMADILLO
-
ARMOR_STAND
-
ARROW
-
AXOLOTL
-
BAMBOO_CHEST_RAFT
-
BAMBOO_RAFT
-
BAT
-
BEE
-
BIRCH_BOAT
-
BIRCH_CHEST_BOAT
-
BLAZE
-
BLOCK_DISPLAY
-
BOGGED
-
BREEZE
-
BREEZE_WIND_CHARGE
-
CAMEL
-
CAT
-
CAVE_SPIDER
-
CHERRY_BOAT
-
CHERRY_CHEST_BOAT
-
CHEST_MINECART
-
CHICKEN
-
COD
-
COPPER_GOLEM
-
COMMAND_BLOCK_MINECART
-
COW
-
CREAKING
-
CREEPER
-
DARK_OAK_BOAT
-
DARK_OAK_CHEST_BOAT
-
DOLPHIN
-
DONKEY
-
DRAGON_FIREBALL
-
DROWNED
-
EGG
-
ELDER_GUARDIAN
-
ENDERMAN
-
ENDERMITE
-
ENDER_DRAGON
-
ENDER_PEARL
-
END_CRYSTAL
-
EVOKER
-
EVOKER_FANGS
-
EXPERIENCE_BOTTLE
-
EXPERIENCE_ORB
-
EYE_OF_ENDER
-
FALLING_BLOCK
-
FIREBALL
-
FIREWORK_ROCKET
-
FOX
-
FROG
-
FURNACE_MINECART
-
GHAST
-
HAPPY_GHAST
-
GIANT
-
GLOW_ITEM_FRAME
-
GLOW_SQUID
-
GOAT
-
GUARDIAN
-
HOGLIN
-
HOPPER_MINECART
-
HORSE
-
HUSK
-
ILLUSIONER
-
INTERACTION
-
IRON_GOLEM
-
ITEM
-
ITEM_DISPLAY
-
ITEM_FRAME
-
JUNGLE_BOAT
-
JUNGLE_CHEST_BOAT
-
LEASH_KNOT
-
LIGHTNING_BOLT
-
LLAMA
-
LLAMA_SPIT
-
MAGMA_CUBE
-
MANGROVE_BOAT
-
MANGROVE_CHEST_BOAT
-
MANNEQUIN
-
MARKER
-
MINECART
-
MOOSHROOM
-
MULE
-
OAK_BOAT
-
OAK_CHEST_BOAT
-
OCELOT
-
OMINOUS_ITEM_SPAWNER
-
PAINTING
-
PALE_OAK_BOAT
-
PALE_OAK_CHEST_BOAT
-
PANDA
-
PARROT
-
PHANTOM
-
PIG
-
PIGLIN
-
PIGLIN_BRUTE
-
PILLAGER
-
POLAR_BEAR
-
SPLASH_POTION
-
LINGERING_POTION
-
PUFFERFISH
-
RABBIT
-
RAVAGER
-
SALMON
-
SHEEP
-
SHULKER
-
SHULKER_BULLET
-
SILVERFISH
-
SKELETON
-
SKELETON_HORSE
-
SLIME
-
SMALL_FIREBALL
-
SNIFFER
-
SNOWBALL
-
SNOW_GOLEM
-
SPAWNER_MINECART
-
SPECTRAL_ARROW
-
SPIDER
-
SPRUCE_BOAT
-
SPRUCE_CHEST_BOAT
-
SQUID
-
STRAY
-
STRIDER
-
TADPOLE
-
TEXT_DISPLAY
-
TNT
-
TNT_MINECART
-
TRADER_LLAMA
-
TRIDENT
-
TROPICAL_FISH
-
TURTLE
-
VEX
-
VILLAGER
-
VINDICATOR
-
WANDERING_TRADER
-
WARDEN
-
WIND_CHARGE
-
WITCH
-
WITHER
-
WITHER_SKELETON
-
WITHER_SKULL
-
WOLF
-
ZOGLIN
-
ZOMBIE
-
ZOMBIE_HORSE
-
ZOMBIE_VILLAGER
-
ZOMBIFIED_PIGLIN
-
PLAYER
-
FISHING_BOBBER
-
OP_ONLY_CUSTOM_DATA
-
factory
-
category
-
immuneTo
-
serialize
private final boolean serialize -
summon
private final boolean summon -
fireImmune
private final boolean fireImmune -
canSpawnFarFromPlayer
private final boolean canSpawnFarFromPlayer -
clientTrackingRange
private final int clientTrackingRange -
updateInterval
private final int updateInterval -
descriptionId
-
description
-
lootTable
-
dimensions
-
spawnDimensionsScale
private final float spawnDimensionsScale -
requiredFeatures
-
allowedInPeaceful
private final boolean allowedInPeaceful -
trackDeltasSupplier
-
trackingRangeSupplier
-
updateIntervalSupplier
-
onlyOpCanSetNbt
private final boolean onlyOpCanSetNbt
-
-
Constructor Details
-
EntityType
public EntityType(EntityType.EntityFactory<T> pFactory, MobCategory pCategory, boolean pSerialize, boolean pSummon, boolean pFireImmune, boolean pCanSpawnFarFromPlayer, ImmutableSet<Block> pImmuneTo, EntityDimensions pDimensions, float pSpawnDimensionsScale, int pClientTrackingRange, int pUpdateInterval, String pDescriptionId, Optional<ResourceKey<LootTable>> pLootTable, FeatureFlagSet pRequiredFeatures, boolean pAllowdInPeaceful) -
EntityType
public EntityType(EntityType.EntityFactory<T> pFactory, MobCategory pCategory, boolean pSerialize, boolean pSummon, boolean pFireImmune, boolean pCanSpawnFarFromPlayer, ImmutableSet<Block> pImmuneTo, EntityDimensions pDimensions, float pSpawnDimensionsScale, int pClientTrackingRange, int pUpdateInterval, String pDescriptionId, Optional<ResourceKey<LootTable>> pLootTable, FeatureFlagSet pRequiredFeatures, boolean pAllowdInPeaceful, Predicate<EntityType<?>> trackDeltasSupplier, ToIntFunction<EntityType<?>> trackingRangeSupplier, ToIntFunction<EntityType<?>> updateIntervalSupplier, boolean onlyOpCanSetNbt)
-
-
Method Details
-
register
private static <T extends Entity> EntityType<T> register(ResourceKey<EntityType<?>> pKey, EntityType.Builder<T> pBuilder) -
vanillaEntityId
-
register
private static <T extends Entity> EntityType<T> register(String pKey, EntityType.Builder<T> pBuilder) -
getKey
-
byString
Tries to get the entity type associated by the key. -
spawn
@Nullable public T spawn(ServerLevel pLevel, @Nullable ItemStack pSpawnedFrom, @Nullable LivingEntity pOwner, BlockPos pPos, EntitySpawnReason pReason, boolean pShouldOffsetY, boolean pShouldOffsetYMore) -
createDefaultStackConfig
public static <T extends Entity> Consumer<T> createDefaultStackConfig(Level pLevel, ItemStack pStack, @Nullable LivingEntity pOwner) -
appendDefaultStackConfig
-
appendComponentsConfig
-
appendCustomEntityStackConfig
-
spawn
-
spawn
@Nullable public T spawn(ServerLevel pLevel, @Nullable Consumer<T> pConsumer, BlockPos pPos, EntitySpawnReason pReason, boolean pShouldOffsetY, boolean pShouldOffsetYMore) -
create
@Nullable public T create(ServerLevel pLevel, @Nullable Consumer<T> pConsumer, BlockPos pPos, EntitySpawnReason pReason, boolean pShouldOffsetY, boolean pShouldOffsetYMore) -
getYOffset
protected static double getYOffset(LevelReader pLevel, BlockPos pPos, boolean pShouldOffsetYMore, AABB pBox) -
updateCustomEntityTag
public static void updateCustomEntityTag(Level pLevel, @Nullable LivingEntity pOwner, @Nullable Entity pEntity, TypedEntityData<EntityType<?>> pData) -
canSerialize
public boolean canSerialize() -
canSummon
public boolean canSummon() -
fireImmune
public boolean fireImmune() -
canSpawnFarFromPlayer
public boolean canSpawnFarFromPlayer() -
getCategory
-
getDescriptionId
-
getDescription
-
toString
-
toShortString
-
getDefaultLootTable
-
getWidth
public float getWidth() -
getHeight
public float getHeight() -
requiredFeatures
- Specified by:
requiredFeaturesin interfaceFeatureElement
-
create
-
create
public static Optional<Entity> create(ValueInput pInput, Level pLevel, EntitySpawnReason pSpawnReason) -
create
public static Optional<Entity> create(EntityType<?> pEntityType, ValueInput pInput, Level pLevel, EntitySpawnReason pSpawnReason) -
getSpawnAABB
-
isBlockDangerous
-
getDimensions
-
by
-
loadEntityRecursive
@Nullable public static Entity loadEntityRecursive(CompoundTag pEntityTag, Level pLevel, EntitySpawnReason pSpawnReason, Function<Entity, Entity> pAdapter) -
loadEntityRecursive
@Nullable public static Entity loadEntityRecursive(EntityType<?> pEntityType, CompoundTag pTag, Level pLevel, EntitySpawnReason pSpawnReason, Function<Entity, Entity> pAdapter) -
loadEntityRecursive
@Nullable public static Entity loadEntityRecursive(ValueInput pInput, Level pLevel, EntitySpawnReason pSpawnReason, Function<Entity, Entity> pAdapter) -
loadEntityRecursive
@Nullable public static Entity loadEntityRecursive(EntityType<?> pEntityType, ValueInput pValueInput, Level pLevel, EntitySpawnReason pSpawnReason, Function<Entity, Entity> pAdapter) -
loadPassengersRecursive
private static Entity loadPassengersRecursive(Entity pEntityType, ValueInput pValueInput, Level pLevel, EntitySpawnReason pSpawnReason, Function<Entity, Entity> pAdapter) -
loadEntitiesRecursive
public static Stream<Entity> loadEntitiesRecursive(ValueInput.ValueInputList pInput, Level pLevel, EntitySpawnReason pSpawnReason) -
loadStaticEntity
private static Optional<Entity> loadStaticEntity(ValueInput pInput, Level pLevel, EntitySpawnReason pSpawnReason) -
loadStaticEntity
private static Optional<Entity> loadStaticEntity(EntityType<?> pEntityType, ValueInput pValueInput, Level pLevel, EntitySpawnReason pSpawnReason) -
clientTrackingRange
public int clientTrackingRange() -
defaultTrackingRangeSupplier
private int defaultTrackingRangeSupplier() -
updateInterval
public int updateInterval() -
defaultUpdateIntervalSupplier
private int defaultUpdateIntervalSupplier() -
trackDeltas
public boolean trackDeltas() -
defaultTrackDeltasSupplier
private boolean defaultTrackDeltasSupplier() -
is
Checks if this entity type is contained in the tag -
is
-
tryCast
- Specified by:
tryCastin interfaceEntityTypeTest<Entity,T extends Entity>
-
getBaseClass
- Specified by:
getBaseClassin interfaceEntityTypeTest<Entity,T extends Entity>
-
builtInRegistryHolder
Deprecated. -
isAllowedInPeaceful
public boolean isAllowedInPeaceful() -
boatFactory
-
chestBoatFactory
-
raftFactory
-
chestRaftFactory
-
onlyOpCanSetNbt
public boolean onlyOpCanSetNbt() -
getTags
-