Paper/Spigot-Server-Patches/0389-Use-EntityTypes-for-living-entities.patch
Aikar b66154b26e
Fix a concurrency issue with legacy structure data loading
This code could get hit by many threads at once, causing multiple
chunk loads to convert legacy data, leading to all sorts of fun.

Additionally, go ahead and preload it async on world load.
2019-03-29 03:38:22 -04:00

873 lines
52 KiB
Diff

From 122ff2211ce676b485e6deb97917c3828d83e3fc Mon Sep 17 00:00:00 2001
From: BillyGalbreath <Blake.Galbreath@GMail.com>
Date: Thu, 4 Oct 2018 10:08:02 -0500
Subject: [PATCH] Use EntityTypes for living entities
diff --git a/src/main/java/net/minecraft/server/BlockMonsterEggs.java b/src/main/java/net/minecraft/server/BlockMonsterEggs.java
index 5a0cc6d05..d385f647e 100644
--- a/src/main/java/net/minecraft/server/BlockMonsterEggs.java
+++ b/src/main/java/net/minecraft/server/BlockMonsterEggs.java
@@ -35,7 +35,7 @@ public class BlockMonsterEggs extends Block {
public void dropNaturally(IBlockData iblockdata, World world, BlockPosition blockposition, float f, int i) {
if (!world.isClientSide && world.getGameRules().getBoolean("doTileDrops")) {
- EntitySilverfish entitysilverfish = new EntitySilverfish(world);
+ EntitySilverfish entitysilverfish = EntityTypes.SILVERFISH.create(world); // Paper
entitysilverfish.setPositionRotation((double) blockposition.getX() + 0.5D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.5D, 0.0F, 0.0F);
world.addEntity(entitysilverfish, SpawnReason.SILVERFISH_BLOCK); // CraftBukkit - add SpawnReason
diff --git a/src/main/java/net/minecraft/server/BlockPumpkinCarved.java b/src/main/java/net/minecraft/server/BlockPumpkinCarved.java
index 75622fbdf..265369984 100644
--- a/src/main/java/net/minecraft/server/BlockPumpkinCarved.java
+++ b/src/main/java/net/minecraft/server/BlockPumpkinCarved.java
@@ -52,7 +52,7 @@ public class BlockPumpkinCarved extends BlockFacingHorizontal {
blockList.setTypeAndData(shapedetectorblock1.getPosition(), Blocks.AIR.getBlockData(), 2); // CraftBukkit
}
- EntitySnowman entitysnowman = new EntitySnowman(world);
+ EntitySnowman entitysnowman = EntityTypes.SNOW_GOLEM.create(world); // Paper
BlockPosition blockposition1 = shapedetector_shapedetectorcollection.a(0, 2, 0).getPosition();
entitysnowman.setPositionRotation((double) blockposition1.getX() + 0.5D, (double) blockposition1.getY() + 0.05D, (double) blockposition1.getZ() + 0.5D, 0.0F, 0.0F);
@@ -87,7 +87,7 @@ public class BlockPumpkinCarved extends BlockFacingHorizontal {
}
BlockPosition blockposition2 = shapedetector_shapedetectorcollection.a(1, 2, 0).getPosition();
- EntityIronGolem entityirongolem = new EntityIronGolem(world);
+ EntityIronGolem entityirongolem = EntityTypes.IRON_GOLEM.create(world); // Paper
entityirongolem.setPlayerCreated(true);
entityirongolem.setPositionRotation((double) blockposition2.getX() + 0.5D, (double) blockposition2.getY() + 0.05D, (double) blockposition2.getZ() + 0.5D, 0.0F, 0.0F);
diff --git a/src/main/java/net/minecraft/server/BlockTurtleEgg.java b/src/main/java/net/minecraft/server/BlockTurtleEgg.java
index 0f0872c1e..1c1bf85a0 100644
--- a/src/main/java/net/minecraft/server/BlockTurtleEgg.java
+++ b/src/main/java/net/minecraft/server/BlockTurtleEgg.java
@@ -94,7 +94,7 @@ public class BlockTurtleEgg extends Block {
if (!world.isClientSide) {
for (int j = 0; j < (Integer) iblockdata.get(BlockTurtleEgg.b); ++j) {
world.triggerEffect(2001, blockposition, Block.getCombinedId(iblockdata));
- EntityTurtle entityturtle = new EntityTurtle(world);
+ EntityTurtle entityturtle = EntityTypes.TURTLE.create(world); // Paper
entityturtle.setAgeRaw(-24000);
entityturtle.g(blockposition);
diff --git a/src/main/java/net/minecraft/server/BlockWitherSkull.java b/src/main/java/net/minecraft/server/BlockWitherSkull.java
index 93bf32dc1..e6063bb46 100644
--- a/src/main/java/net/minecraft/server/BlockWitherSkull.java
+++ b/src/main/java/net/minecraft/server/BlockWitherSkull.java
@@ -52,7 +52,7 @@ public class BlockWitherSkull extends BlockSkull {
}
BlockPosition blockposition1 = shapedetector_shapedetectorcollection.a(1, 0, 0).getPosition();
- EntityWither entitywither = new EntityWither(world);
+ EntityWither entitywither = EntityTypes.WITHER.create(world); // Paper
BlockPosition blockposition2 = shapedetector_shapedetectorcollection.a(1, 2, 0).getPosition();
entitywither.setPositionRotation((double) blockposition2.getX() + 0.5D, (double) blockposition2.getY() + 0.55D, (double) blockposition2.getZ() + 0.5D, shapedetector_shapedetectorcollection.getFacing().k() == EnumDirection.EnumAxis.X ? 0.0F : 90.0F, 0.0F);
diff --git a/src/main/java/net/minecraft/server/EnderDragonBattle.java b/src/main/java/net/minecraft/server/EnderDragonBattle.java
index aad7ce93f..09eabf123 100644
--- a/src/main/java/net/minecraft/server/EnderDragonBattle.java
+++ b/src/main/java/net/minecraft/server/EnderDragonBattle.java
@@ -412,7 +412,7 @@ public class EnderDragonBattle {
private EntityEnderDragon n() {
this.d.getChunkAtWorldCoords(new BlockPosition(0, 128, 0));
- EntityEnderDragon entityenderdragon = new EntityEnderDragon(this.d);
+ EntityEnderDragon entityenderdragon = EntityTypes.ENDER_DRAGON.create(this.d); // Paper
entityenderdragon.getDragonControllerManager().setControllerPhase(DragonControllerPhase.HOLDING_PATTERN);
entityenderdragon.setPositionRotation(0.0D, 128.0D, 0.0D, this.d.random.nextFloat() * 360.0F, 0.0F);
diff --git a/src/main/java/net/minecraft/server/EntityChicken.java b/src/main/java/net/minecraft/server/EntityChicken.java
index ee159e0a8..070a9e7b1 100644
--- a/src/main/java/net/minecraft/server/EntityChicken.java
+++ b/src/main/java/net/minecraft/server/EntityChicken.java
@@ -96,7 +96,7 @@ public class EntityChicken extends EntityAnimal {
}
public EntityChicken createChild(EntityAgeable entityageable) {
- return new EntityChicken(this.world);
+ return EntityTypes.CHICKEN.create(world); // Paper
}
public boolean f(ItemStack itemstack) {
diff --git a/src/main/java/net/minecraft/server/EntityCow.java b/src/main/java/net/minecraft/server/EntityCow.java
index 5874d2993..cc53e915d 100644
--- a/src/main/java/net/minecraft/server/EntityCow.java
+++ b/src/main/java/net/minecraft/server/EntityCow.java
@@ -88,7 +88,7 @@ public class EntityCow extends EntityAnimal {
}
public EntityCow createChild(EntityAgeable entityageable) {
- return new EntityCow(this.world);
+ return EntityTypes.COW.create(world); // Paper
}
public float getHeadHeight() {
diff --git a/src/main/java/net/minecraft/server/EntityEnderPearl.java b/src/main/java/net/minecraft/server/EntityEnderPearl.java
index 961afa5c4..a372f6508 100644
--- a/src/main/java/net/minecraft/server/EntityEnderPearl.java
+++ b/src/main/java/net/minecraft/server/EntityEnderPearl.java
@@ -74,7 +74,7 @@ public class EntityEnderPearl extends EntityProjectile {
if (!teleEvent.isCancelled() && !entityplayer.playerConnection.isDisconnected()) {
if (this.random.nextFloat() < 0.05F && this.world.getGameRules().getBoolean("doMobSpawning")) {
- EntityEndermite entityendermite = new EntityEndermite(this.world);
+ EntityEndermite entityendermite = EntityTypes.ENDERMITE.create(world); // Paper
entityendermite.setPlayerSpawned(true);
entityendermite.setPositionRotation(entityliving.locX, entityliving.locY, entityliving.locZ, entityliving.yaw, entityliving.pitch);
diff --git a/src/main/java/net/minecraft/server/EntityEvoker.java b/src/main/java/net/minecraft/server/EntityEvoker.java
index 963b6fbb9..fc20bbe27 100644
--- a/src/main/java/net/minecraft/server/EntityEvoker.java
+++ b/src/main/java/net/minecraft/server/EntityEvoker.java
@@ -188,8 +188,7 @@ public class EntityEvoker extends EntityIllagerWizard {
protected void j() {
for (int i = 0; i < 3; ++i) {
BlockPosition blockposition = (new BlockPosition(EntityEvoker.this)).a(-2 + EntityEvoker.this.random.nextInt(5), 1, -2 + EntityEvoker.this.random.nextInt(5));
- EntityVex entityvex = new EntityVex(EntityEvoker.this.world);
-
+ EntityVex entityvex = EntityTypes.VEX.create(EntityEvoker.this.world); // Paper
entityvex.setPositionRotation(blockposition, 0.0F, 0.0F);
entityvex.prepare(EntityEvoker.this.world.getDamageScaler(blockposition), (GroupDataEntity) null, (NBTTagCompound) null);
entityvex.a((EntityInsentient) EntityEvoker.this);
diff --git a/src/main/java/net/minecraft/server/EntityHorse.java b/src/main/java/net/minecraft/server/EntityHorse.java
index 4e8a97c55..1b9425f3e 100644
--- a/src/main/java/net/minecraft/server/EntityHorse.java
+++ b/src/main/java/net/minecraft/server/EntityHorse.java
@@ -208,11 +208,11 @@ public class EntityHorse extends EntityHorseAbstract {
Object object;
if (entityageable instanceof EntityHorseDonkey) {
- object = new EntityHorseMule(this.world);
+ object = EntityTypes.MULE.create(world); // Paper
} else {
EntityHorse entityhorse = (EntityHorse) entityageable;
- object = new EntityHorse(this.world);
+ object = EntityTypes.HORSE.create(world); // Paper
int i = this.random.nextInt(9);
int j;
diff --git a/src/main/java/net/minecraft/server/EntityHorseDonkey.java b/src/main/java/net/minecraft/server/EntityHorseDonkey.java
index 72eed22eb..65c40e72b 100644
--- a/src/main/java/net/minecraft/server/EntityHorseDonkey.java
+++ b/src/main/java/net/minecraft/server/EntityHorseDonkey.java
@@ -33,7 +33,7 @@ public class EntityHorseDonkey extends EntityHorseChestedAbstract {
}
public EntityAgeable createChild(EntityAgeable entityageable) {
- Object object = entityageable instanceof EntityHorse ? new EntityHorseMule(this.world) : new EntityHorseDonkey(this.world);
+ Object object = entityageable instanceof EntityHorse ? EntityTypes.MULE.create(world) : EntityTypes.DONKEY.create(world); // Paper
this.a(entityageable, (EntityHorseAbstract) object);
return (EntityAgeable) object;
diff --git a/src/main/java/net/minecraft/server/EntityHorseSkeleton.java b/src/main/java/net/minecraft/server/EntityHorseSkeleton.java
index eae2b2665..0a092acdf 100644
--- a/src/main/java/net/minecraft/server/EntityHorseSkeleton.java
+++ b/src/main/java/net/minecraft/server/EntityHorseSkeleton.java
@@ -134,7 +134,7 @@ public class EntityHorseSkeleton extends EntityHorseAbstract {
@Nullable
public EntityAgeable createChild(EntityAgeable entityageable) {
- return new EntityHorseSkeleton(this.world);
+ return EntityTypes.SKELETON_HORSE.create(world); // Paper
}
public boolean a(EntityHuman entityhuman, EnumHand enumhand) {
diff --git a/src/main/java/net/minecraft/server/EntityHorseZombie.java b/src/main/java/net/minecraft/server/EntityHorseZombie.java
index c23bc72fc..a1873f557 100644
--- a/src/main/java/net/minecraft/server/EntityHorseZombie.java
+++ b/src/main/java/net/minecraft/server/EntityHorseZombie.java
@@ -41,7 +41,7 @@ public class EntityHorseZombie extends EntityHorseAbstract {
@Nullable
public EntityAgeable createChild(EntityAgeable entityageable) {
- return new EntityHorseZombie(this.world);
+ return EntityTypes.ZOMBIE_HORSE.create(world); // Paper
}
public boolean a(EntityHuman entityhuman, EnumHand enumhand) {
diff --git a/src/main/java/net/minecraft/server/EntityLlama.java b/src/main/java/net/minecraft/server/EntityLlama.java
index 5e1976871..82a32c61e 100644
--- a/src/main/java/net/minecraft/server/EntityLlama.java
+++ b/src/main/java/net/minecraft/server/EntityLlama.java
@@ -285,7 +285,7 @@ public class EntityLlama extends EntityHorseChestedAbstract implements IRangedEn
}
public EntityLlama createChild(EntityAgeable entityageable) {
- EntityLlama entityllama = new EntityLlama(this.world);
+ EntityLlama entityllama = EntityTypes.LLAMA.create(world); // Paper
this.a(entityageable, (EntityHorseAbstract) entityllama);
EntityLlama entityllama1 = (EntityLlama) entityageable;
diff --git a/src/main/java/net/minecraft/server/EntityMushroomCow.java b/src/main/java/net/minecraft/server/EntityMushroomCow.java
index dde9f1e61..638dbe978 100644
--- a/src/main/java/net/minecraft/server/EntityMushroomCow.java
+++ b/src/main/java/net/minecraft/server/EntityMushroomCow.java
@@ -40,7 +40,7 @@ public class EntityMushroomCow extends EntityCow {
this.world.addParticle(Particles.u, this.locX, this.locY + (double) (this.length / 2.0F), this.locZ, 0.0D, 0.0D, 0.0D);
if (!this.world.isClientSide) {
// this.die(); // CraftBukkit - moved down
- EntityCow entitycow = new EntityCow(this.world);
+ EntityCow entitycow = EntityTypes.COW.create(world); // Paper
entitycow.setPositionRotation(this.locX, this.locY, this.locZ, this.yaw, this.pitch);
entitycow.setHealth(this.getHealth());
@@ -74,7 +74,7 @@ public class EntityMushroomCow extends EntityCow {
}
public EntityMushroomCow createChild(EntityAgeable entityageable) {
- return new EntityMushroomCow(this.world);
+ return EntityTypes.MOOSHROOM.create(world); // Paper
}
@Nullable
diff --git a/src/main/java/net/minecraft/server/EntityOcelot.java b/src/main/java/net/minecraft/server/EntityOcelot.java
index ba074c10c..13c84bda8 100644
--- a/src/main/java/net/minecraft/server/EntityOcelot.java
+++ b/src/main/java/net/minecraft/server/EntityOcelot.java
@@ -154,7 +154,7 @@ public class EntityOcelot extends EntityTameableAnimal {
}
public EntityOcelot createChild(EntityAgeable entityageable) {
- EntityOcelot entityocelot = new EntityOcelot(this.world);
+ EntityOcelot entityocelot = EntityTypes.OCELOT.create(world); // Paper
if (this.isTamed()) {
entityocelot.setOwnerUUID(this.getOwnerUUID());
@@ -237,7 +237,7 @@ public class EntityOcelot extends EntityTameableAnimal {
groupdataentity = super.prepare(difficultydamagescaler, groupdataentity, nbttagcompound);
if (spawnBonus && this.getCatType() == 0 && this.world.random.nextInt(7) == 0) { // Spigot
for (int i = 0; i < 2; ++i) {
- EntityOcelot entityocelot = new EntityOcelot(this.world);
+ EntityOcelot entityocelot = EntityTypes.OCELOT.create(world); // Paper
entityocelot.setPositionRotation(this.locX, this.locY, this.locZ, this.yaw, 0.0F);
entityocelot.setAgeRaw(-24000);
diff --git a/src/main/java/net/minecraft/server/EntityPig.java b/src/main/java/net/minecraft/server/EntityPig.java
index 9dc2d8be2..d1689dc33 100644
--- a/src/main/java/net/minecraft/server/EntityPig.java
+++ b/src/main/java/net/minecraft/server/EntityPig.java
@@ -153,7 +153,7 @@ public class EntityPig extends EntityAnimal {
public void onLightningStrike(EntityLightning entitylightning) {
if (!this.world.isClientSide && !this.dead) {
- EntityPigZombie entitypigzombie = new EntityPigZombie(this.world);
+ EntityPigZombie entitypigzombie = EntityTypes.ZOMBIE_PIGMAN.create(world); // Paper
entitypigzombie.setSlot(EnumItemSlot.MAINHAND, new ItemStack(Items.GOLDEN_SWORD));
entitypigzombie.setPositionRotation(this.locX, this.locY, this.locZ, this.yaw, this.pitch);
@@ -242,7 +242,7 @@ public class EntityPig extends EntityAnimal {
}
public EntityPig createChild(EntityAgeable entityageable) {
- return new EntityPig(this.world);
+ return EntityTypes.PIG.create(world); // Paper
}
public boolean f(ItemStack itemstack) {
diff --git a/src/main/java/net/minecraft/server/EntityPolarBear.java b/src/main/java/net/minecraft/server/EntityPolarBear.java
index a02020d5f..dbb534c9c 100644
--- a/src/main/java/net/minecraft/server/EntityPolarBear.java
+++ b/src/main/java/net/minecraft/server/EntityPolarBear.java
@@ -18,7 +18,7 @@ public class EntityPolarBear extends EntityAnimal {
}
public EntityAgeable createChild(EntityAgeable entityageable) {
- return new EntityPolarBear(this.world);
+ return EntityTypes.POLAR_BEAR.create(world); // Paper
}
public boolean f(ItemStack itemstack) {
diff --git a/src/main/java/net/minecraft/server/EntityRabbit.java b/src/main/java/net/minecraft/server/EntityRabbit.java
index e545b1c9b..d6bac06a7 100644
--- a/src/main/java/net/minecraft/server/EntityRabbit.java
+++ b/src/main/java/net/minecraft/server/EntityRabbit.java
@@ -251,7 +251,7 @@ public class EntityRabbit extends EntityAnimal {
}
public EntityRabbit createChild(EntityAgeable entityageable) {
- EntityRabbit entityrabbit = new EntityRabbit(this.world);
+ EntityRabbit entityrabbit = EntityTypes.RABBIT.create(world); // Paper
int i = this.dJ();
if (this.random.nextInt(20) != 0) {
diff --git a/src/main/java/net/minecraft/server/EntitySheep.java b/src/main/java/net/minecraft/server/EntitySheep.java
index f7a25c148..c35d1eef4 100644
--- a/src/main/java/net/minecraft/server/EntitySheep.java
+++ b/src/main/java/net/minecraft/server/EntitySheep.java
@@ -247,7 +247,7 @@ public class EntitySheep extends EntityAnimal {
public EntitySheep createChild(EntityAgeable entityageable) {
EntitySheep entitysheep = (EntitySheep) entityageable;
- EntitySheep entitysheep1 = new EntitySheep(this.world);
+ EntitySheep entitysheep1 = EntityTypes.SHEEP.create(world); // Paper
entitysheep1.setColor(this.a((EntityAnimal) this, (EntityAnimal) entitysheep));
return entitysheep1;
diff --git a/src/main/java/net/minecraft/server/EntitySpider.java b/src/main/java/net/minecraft/server/EntitySpider.java
index a42b8d554..9ef1c9baf 100644
--- a/src/main/java/net/minecraft/server/EntitySpider.java
+++ b/src/main/java/net/minecraft/server/EntitySpider.java
@@ -111,7 +111,7 @@ public class EntitySpider extends EntityMonster {
Object object = super.prepare(difficultydamagescaler, groupdataentity, nbttagcompound);
if (this.world.random.nextInt(100) == 0) {
- EntitySkeleton entityskeleton = new EntitySkeleton(this.world);
+ EntitySkeleton entityskeleton = EntityTypes.SKELETON.create(world); // Paper
entityskeleton.setPositionRotation(this.locX, this.locY, this.locZ, this.yaw, 0.0F);
entityskeleton.prepare(difficultydamagescaler, (GroupDataEntity) null, (NBTTagCompound) null);
diff --git a/src/main/java/net/minecraft/server/EntityTurtle.java b/src/main/java/net/minecraft/server/EntityTurtle.java
index a533e0eb5..270b95082 100644
--- a/src/main/java/net/minecraft/server/EntityTurtle.java
+++ b/src/main/java/net/minecraft/server/EntityTurtle.java
@@ -218,7 +218,7 @@ public class EntityTurtle extends EntityAnimal {
@Nullable
public EntityAgeable createChild(EntityAgeable entityageable) {
- return new EntityTurtle(this.world);
+ return EntityTypes.TURTLE.create(world); // Paper
}
public boolean f(ItemStack itemstack) {
diff --git a/src/main/java/net/minecraft/server/EntityTypes.java b/src/main/java/net/minecraft/server/EntityTypes.java
index d74bfa120..24ca35119 100644
--- a/src/main/java/net/minecraft/server/EntityTypes.java
+++ b/src/main/java/net/minecraft/server/EntityTypes.java
@@ -269,6 +269,7 @@ public class EntityTypes<T extends Entity> {
return this.aX;
}
+ @Nullable public T create(World world) { return a(world); } // Paper - OBFHELPER
@Nullable
public T a(World world) {
return this.aT.apply(world); // CraftBukkit - decompile error
diff --git a/src/main/java/net/minecraft/server/EntityVillager.java b/src/main/java/net/minecraft/server/EntityVillager.java
index f01e776fe..40b3ffd8c 100644
--- a/src/main/java/net/minecraft/server/EntityVillager.java
+++ b/src/main/java/net/minecraft/server/EntityVillager.java
@@ -592,7 +592,7 @@ public class EntityVillager extends EntityAgeable implements NPC, IMerchant {
}
public EntityVillager createChild(EntityAgeable entityageable) {
- EntityVillager entityvillager = new EntityVillager(this.world);
+ EntityVillager entityvillager = EntityTypes.VILLAGER.create(world); // Paper
entityvillager.prepare(this.world.getDamageScaler(new BlockPosition(entityvillager)), (GroupDataEntity) null, (NBTTagCompound) null);
return entityvillager;
@@ -604,7 +604,7 @@ public class EntityVillager extends EntityAgeable implements NPC, IMerchant {
public void onLightningStrike(EntityLightning entitylightning) {
if (!this.world.isClientSide && !this.dead) {
- EntityWitch entitywitch = new EntityWitch(this.world);
+ EntityWitch entitywitch = EntityTypes.WITCH.create(world); // Paper
// Paper start
if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityZapEvent(this, entitylightning, entitywitch).isCancelled()) {
diff --git a/src/main/java/net/minecraft/server/EntityWolf.java b/src/main/java/net/minecraft/server/EntityWolf.java
index 4f1696d01..46d8e0a1f 100644
--- a/src/main/java/net/minecraft/server/EntityWolf.java
+++ b/src/main/java/net/minecraft/server/EntityWolf.java
@@ -342,7 +342,7 @@ public class EntityWolf extends EntityTameableAnimal {
}
public EntityWolf createChild(EntityAgeable entityageable) {
- EntityWolf entitywolf = new EntityWolf(this.world);
+ EntityWolf entitywolf = EntityTypes.WOLF.create(world); // Paper
UUID uuid = this.getOwnerUUID();
if (uuid != null) {
diff --git a/src/main/java/net/minecraft/server/EntityZombie.java b/src/main/java/net/minecraft/server/EntityZombie.java
index 7998b80c1..81cc0c3b3 100644
--- a/src/main/java/net/minecraft/server/EntityZombie.java
+++ b/src/main/java/net/minecraft/server/EntityZombie.java
@@ -208,7 +208,7 @@ public class EntityZombie extends EntityMonster {
}
protected void dE() {
- this.a((EntityZombie) (new EntityDrowned(this.world)));
+ this.a((EntityZombie) EntityTypes.DROWNED.create(world)); // Paper
this.world.a((EntityHuman) null, 1040, new BlockPosition((int) this.locX, (int) this.locY, (int) this.locZ), 0);
}
@@ -261,7 +261,7 @@ public class EntityZombie extends EntityMonster {
int i = MathHelper.floor(this.locX);
int j = MathHelper.floor(this.locY);
int k = MathHelper.floor(this.locZ);
- EntityZombie entityzombie = new EntityZombie(this.world);
+ EntityZombie entityzombie = EntityTypes.ZOMBIE.create(world); // Paper
for (int l = 0; l < 50; ++l) {
int i1 = i + MathHelper.nextInt(this.random, 7, 40) * MathHelper.nextInt(this.random, -1, 1);
@@ -385,7 +385,7 @@ public class EntityZombie extends EntityMonster {
}
EntityVillager entityvillager = (EntityVillager) entityliving;
- EntityZombieVillager entityzombievillager = new EntityZombieVillager(this.world);
+ EntityZombieVillager entityzombievillager = EntityTypes.ZOMBIE_VILLAGER.create(world); // Paper
entityzombievillager.u(entityvillager);
// this.world.kill(entityvillager); // CraftBukkit - moved down
@@ -450,7 +450,7 @@ public class EntityZombie extends EntityMonster {
this.startRiding(entitychicken);
}
} else if ((double) this.world.random.nextFloat() < 0.05D) {
- EntityChicken entitychicken1 = new EntityChicken(this.world);
+ EntityChicken entitychicken1 = EntityTypes.CHICKEN.create(world); // Paper
entitychicken1.setPositionRotation(this.locX, this.locY, this.locZ, this.yaw, 0.0F);
entitychicken1.prepare(difficultydamagescaler, (GroupDataEntity) null, (NBTTagCompound) null);
diff --git a/src/main/java/net/minecraft/server/EntityZombieHusk.java b/src/main/java/net/minecraft/server/EntityZombieHusk.java
index 85d402965..0cca7b6d5 100644
--- a/src/main/java/net/minecraft/server/EntityZombieHusk.java
+++ b/src/main/java/net/minecraft/server/EntityZombieHusk.java
@@ -54,7 +54,7 @@ public class EntityZombieHusk extends EntityZombie {
}
protected void dE() {
- this.a(new EntityZombie(this.world));
+ this.a(EntityTypes.ZOMBIE.create(world)); // Paper
this.world.a((EntityHuman) null, 1041, new BlockPosition((int) this.locX, (int) this.locY, (int) this.locZ), 0);
}
diff --git a/src/main/java/net/minecraft/server/EntityZombieVillager.java b/src/main/java/net/minecraft/server/EntityZombieVillager.java
index 86e5fbcda..fb96743af 100644
--- a/src/main/java/net/minecraft/server/EntityZombieVillager.java
+++ b/src/main/java/net/minecraft/server/EntityZombieVillager.java
@@ -118,7 +118,7 @@ public class EntityZombieVillager extends EntityZombie {
}
protected void dJ() {
- EntityVillager entityvillager = new EntityVillager(this.world);
+ EntityVillager entityvillager = EntityTypes.VILLAGER.create(world); // Paper
entityvillager.u(this);
entityvillager.setProfession(this.getProfession());
diff --git a/src/main/java/net/minecraft/server/ItemArmorStand.java b/src/main/java/net/minecraft/server/ItemArmorStand.java
index 576b3c565..4dd0e39ec 100644
--- a/src/main/java/net/minecraft/server/ItemArmorStand.java
+++ b/src/main/java/net/minecraft/server/ItemArmorStand.java
@@ -34,7 +34,7 @@ public class ItemArmorStand extends Item {
if (!world.isClientSide) {
world.setAir(blockposition);
world.setAir(blockposition1);
- EntityArmorStand entityarmorstand = new EntityArmorStand(world, d0 + 0.5D, d1, d2 + 0.5D);
+ EntityArmorStand entityarmorstand = EntityTypes.ARMOR_STAND.create(world); // Paper
float f = (float) MathHelper.d((MathHelper.g(itemactioncontext.h() - 180.0F) + 22.5F) / 45.0F) * 45.0F;
entityarmorstand.setPositionRotation(d0 + 0.5D, d1, d2 + 0.5D, f, 0.0F);
diff --git a/src/main/java/net/minecraft/server/MobSpawnerPhantom.java b/src/main/java/net/minecraft/server/MobSpawnerPhantom.java
index 5ddf66eef..bb7e072ee 100644
--- a/src/main/java/net/minecraft/server/MobSpawnerPhantom.java
+++ b/src/main/java/net/minecraft/server/MobSpawnerPhantom.java
@@ -59,7 +59,7 @@ public class MobSpawnerPhantom {
continue;
}
// Paper end
- EntityPhantom entityphantom = new EntityPhantom(world);
+ EntityPhantom entityphantom = EntityTypes.PHANTOM.create(world); // Paper
entityphantom.spawningEntity = entityhuman.uniqueID; // Paper
entityphantom.setPositionRotation(blockposition1, 0.0F, 0.0F);
groupdataentity = entityphantom.prepare(difficultydamagescaler, groupdataentity, (NBTTagCompound) null);
diff --git a/src/main/java/net/minecraft/server/PathfinderGoalHorseTrap.java b/src/main/java/net/minecraft/server/PathfinderGoalHorseTrap.java
index d4fdcbdfd..887e4461f 100644
--- a/src/main/java/net/minecraft/server/PathfinderGoalHorseTrap.java
+++ b/src/main/java/net/minecraft/server/PathfinderGoalHorseTrap.java
@@ -36,7 +36,7 @@ public class PathfinderGoalHorseTrap extends PathfinderGoal {
}
private EntityHorseAbstract a(DifficultyDamageScaler difficultydamagescaler) {
- EntityHorseSkeleton entityhorseskeleton = new EntityHorseSkeleton(this.a.world);
+ EntityHorseSkeleton entityhorseskeleton = EntityTypes.SKELETON_HORSE.create(a.world); // Paper
entityhorseskeleton.prepare(difficultydamagescaler, (GroupDataEntity) null, (NBTTagCompound) null);
entityhorseskeleton.setPosition(this.a.locX, this.a.locY, this.a.locZ);
@@ -49,7 +49,7 @@ public class PathfinderGoalHorseTrap extends PathfinderGoal {
}
private EntitySkeleton a(DifficultyDamageScaler difficultydamagescaler, EntityHorseAbstract entityhorseabstract) {
- EntitySkeleton entityskeleton = new EntitySkeleton(entityhorseabstract.world);
+ EntitySkeleton entityskeleton = EntityTypes.SKELETON.create(entityhorseabstract.world); // Paper
entityskeleton.prepare(difficultydamagescaler, (GroupDataEntity) null, (NBTTagCompound) null);
entityskeleton.setPosition(entityhorseabstract.locX, entityhorseabstract.locY, entityhorseabstract.locZ);
diff --git a/src/main/java/net/minecraft/server/VillageSiege.java b/src/main/java/net/minecraft/server/VillageSiege.java
index 0ac1fb53a..509d62f6b 100644
--- a/src/main/java/net/minecraft/server/VillageSiege.java
+++ b/src/main/java/net/minecraft/server/VillageSiege.java
@@ -134,7 +134,7 @@ public class VillageSiege {
EntityZombie entityzombie;
try {
- entityzombie = new EntityZombie(this.a);
+ entityzombie = EntityTypes.ZOMBIE.create(this.a); // Paper
entityzombie.prepare(this.a.getDamageScaler(new BlockPosition(entityzombie)), (GroupDataEntity) null, (NBTTagCompound) null);
} catch (Exception exception) {
exception.printStackTrace();
diff --git a/src/main/java/net/minecraft/server/WorldGenEndCityPieces.java b/src/main/java/net/minecraft/server/WorldGenEndCityPieces.java
index 94b21693e..0a223cfe5 100644
--- a/src/main/java/net/minecraft/server/WorldGenEndCityPieces.java
+++ b/src/main/java/net/minecraft/server/WorldGenEndCityPieces.java
@@ -270,7 +270,7 @@ public class WorldGenEndCityPieces {
TileEntityLootable.a(generatoraccess, random, blockposition1, LootTables.c);
}
} else if (s.startsWith("Sentry")) {
- EntityShulker entityshulker = new EntityShulker(generatoraccess.getMinecraftWorld());
+ EntityShulker entityshulker = EntityTypes.SHULKER.create(generatoraccess.getMinecraftWorld()); // Paper
entityshulker.setPosition((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D);
entityshulker.g(blockposition);
diff --git a/src/main/java/net/minecraft/server/WorldGenFeatureOceanRuinPieces.java b/src/main/java/net/minecraft/server/WorldGenFeatureOceanRuinPieces.java
index 2def56b06..abeb4aa02 100644
--- a/src/main/java/net/minecraft/server/WorldGenFeatureOceanRuinPieces.java
+++ b/src/main/java/net/minecraft/server/WorldGenFeatureOceanRuinPieces.java
@@ -154,8 +154,7 @@ public class WorldGenFeatureOceanRuinPieces {
((TileEntityChest) tileentity).setLootTable(this.h ? LootTables.q : LootTables.p, random.nextLong());
}
} else if ("drowned".equals(s)) {
- EntityDrowned entitydrowned = new EntityDrowned(generatoraccess.getMinecraftWorld());
-
+ EntityDrowned entitydrowned = EntityTypes.DROWNED.create(generatoraccess.getMinecraftWorld()); // Paper
entitydrowned.di();
entitydrowned.setPositionRotation(blockposition, 0.0F, 0.0F);
entitydrowned.prepare(generatoraccess.getDamageScaler(blockposition), (GroupDataEntity) null, (NBTTagCompound) null);
diff --git a/src/main/java/net/minecraft/server/WorldGenMonumentPieces.java b/src/main/java/net/minecraft/server/WorldGenMonumentPieces.java
index 0e7aed09d..493a86e1b 100644
--- a/src/main/java/net/minecraft/server/WorldGenMonumentPieces.java
+++ b/src/main/java/net/minecraft/server/WorldGenMonumentPieces.java
@@ -1800,7 +1800,7 @@ public class WorldGenMonumentPieces {
protected static final IBlockData d = WorldGenMonumentPieces.WorldGenMonumentPiece.b;
protected static final IBlockData e = Blocks.SEA_LANTERN.getBlockData();
protected static final IBlockData f = Blocks.WATER.getBlockData();
- protected static final Set<Block> g = ImmutableSet.builder().add(Blocks.ICE).add(Blocks.PACKED_ICE).add(Blocks.BLUE_ICE).add(WorldGenMonumentPieces.WorldGenMonumentPiece.f.getBlock()).build();
+ protected static final Set<Block> g = ImmutableSet.<Block>builder().add(Blocks.ICE).add(Blocks.PACKED_ICE).add(Blocks.BLUE_ICE).add(WorldGenMonumentPieces.WorldGenMonumentPiece.f.getBlock()).build(); // Paper - decompile fix
protected static final int h = b(2, 0, 0);
protected static final int i = b(2, 2, 0);
protected static final int j = b(0, 1, 0);
@@ -1923,7 +1923,7 @@ public class WorldGenMonumentPieces {
int j1 = this.b(i, k);
if (structureboundingbox.b((BaseBlockPosition) (new BlockPosition(l, i1, j1)))) {
- EntityGuardianElder entityguardianelder = new EntityGuardianElder(generatoraccess.getMinecraftWorld());
+ EntityGuardianElder entityguardianelder = EntityTypes.ELDER_GUARDIAN.create(generatoraccess.getMinecraftWorld()); // Paper
entityguardianelder.heal(entityguardianelder.getMaxHealth());
entityguardianelder.setPositionRotation((double) l + 0.5D, (double) i1, (double) j1 + 0.5D, 0.0F, 0.0F);
diff --git a/src/main/java/net/minecraft/server/WorldGenVillagePieces.java b/src/main/java/net/minecraft/server/WorldGenVillagePieces.java
index 5fa2987d2..967e33b3d 100644
--- a/src/main/java/net/minecraft/server/WorldGenVillagePieces.java
+++ b/src/main/java/net/minecraft/server/WorldGenVillagePieces.java
@@ -1640,7 +1640,7 @@ public class WorldGenVillagePieces {
++this.a;
if (this.h) {
- EntityZombieVillager entityzombievillager = new EntityZombieVillager(generatoraccess.getMinecraftWorld());
+ EntityZombieVillager entityzombievillager = EntityTypes.ZOMBIE_VILLAGER.create(generatoraccess.getMinecraftWorld()); // Paper
entityzombievillager.setPositionRotation((double) j1 + 0.5D, (double) k1, (double) l1 + 0.5D, 0.0F, 0.0F);
entityzombievillager.prepare(generatoraccess.getDamageScaler(new BlockPosition(entityzombievillager)), (GroupDataEntity) null, (NBTTagCompound) null);
@@ -1648,7 +1648,7 @@ public class WorldGenVillagePieces {
entityzombievillager.di();
generatoraccess.addEntity(entityzombievillager, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.CHUNK_GEN); // CraftBukkit - add SpawnReason
} else {
- EntityVillager entityvillager = new EntityVillager(generatoraccess.getMinecraftWorld());
+ EntityVillager entityvillager = EntityTypes.VILLAGER.create(generatoraccess.getMinecraftWorld()); // Paper
entityvillager.setPositionRotation((double) j1 + 0.5D, (double) k1, (double) l1 + 0.5D, 0.0F, 0.0F);
entityvillager.setProfession(this.c(i1, generatoraccess.m().nextInt(6)));
diff --git a/src/main/java/net/minecraft/server/WorldGenWitchHut.java b/src/main/java/net/minecraft/server/WorldGenWitchHut.java
index efb0379ce..3d8193c47 100644
--- a/src/main/java/net/minecraft/server/WorldGenWitchHut.java
+++ b/src/main/java/net/minecraft/server/WorldGenWitchHut.java
@@ -81,7 +81,7 @@ public class WorldGenWitchHut extends WorldGenScatteredPiece {
if (structureboundingbox.b((BaseBlockPosition) (new BlockPosition(j, i, k)))) {
this.e = true;
- EntityWitch entitywitch = new EntityWitch(generatoraccess.getMinecraftWorld());
+ EntityWitch entitywitch = EntityTypes.WITCH.create(generatoraccess.getMinecraftWorld()); // Paper
entitywitch.di();
entitywitch.setPositionRotation((double) j + 0.5D, (double) i, (double) k + 0.5D, 0.0F, 0.0F);
diff --git a/src/main/java/net/minecraft/server/WorldGenWoodlandMansionPieces.java b/src/main/java/net/minecraft/server/WorldGenWoodlandMansionPieces.java
index 11010d8e1..4eb746ebb 100644
--- a/src/main/java/net/minecraft/server/WorldGenWoodlandMansionPieces.java
+++ b/src/main/java/net/minecraft/server/WorldGenWoodlandMansionPieces.java
@@ -23,14 +23,14 @@ public class WorldGenWoodlandMansionPieces {
static class h extends WorldGenWoodlandMansionPieces.f {
private h() {
- super(null);
+ super(); // Paper - decompile fix
}
}
static class f extends WorldGenWoodlandMansionPieces.b {
private f() {
- super(null);
+ super(); // Paper - decompile fix
}
public String a(Random random) {
@@ -65,7 +65,7 @@ public class WorldGenWoodlandMansionPieces {
static class a extends WorldGenWoodlandMansionPieces.b {
private a() {
- super(null);
+ super(); // Paper - decompile fix
}
public String a(Random random) {
@@ -1065,15 +1065,13 @@ public class WorldGenWoodlandMansionPieces {
this.a(generatoraccess, structureboundingbox, random, blockposition, LootTables.o, iblockdata);
} else if ("Mage".equals(s)) {
- EntityEvoker entityevoker = new EntityEvoker(generatoraccess.getMinecraftWorld());
-
+ EntityEvoker entityevoker = EntityTypes.EVOKER.create(generatoraccess.getMinecraftWorld()); // Paper
entityevoker.di();
entityevoker.setPositionRotation(blockposition, 0.0F, 0.0F);
generatoraccess.addEntity(entityevoker);
generatoraccess.setTypeAndData(blockposition, Blocks.AIR.getBlockData(), 2);
} else if ("Warrior".equals(s)) {
- EntityVindicator entityvindicator = new EntityVindicator(generatoraccess.getMinecraftWorld());
-
+ EntityVindicator entityvindicator = EntityTypes.VINDICATOR.create(generatoraccess.getMinecraftWorld()); // Paper
entityvindicator.di();
entityvindicator.setPositionRotation(blockposition, 0.0F, 0.0F);
entityvindicator.prepare(generatoraccess.getDamageScaler(new BlockPosition(entityvindicator)), (GroupDataEntity) null, (NBTTagCompound) null);
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index 53e7834cc..5c2421ac3 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -495,7 +495,7 @@ public class WorldServer extends World implements IAsyncTaskHandler {
boolean flag2 = this.getGameRules().getBoolean("doMobSpawning") && this.random.nextDouble() < (double) difficultydamagescaler.b() * paperConfig.skeleHorseSpawnChance; // Paper
if (flag2) {
- EntityHorseSkeleton entityhorseskeleton = new EntityHorseSkeleton(this);
+ EntityHorseSkeleton entityhorseskeleton = EntityTypes.SKELETON_HORSE.create(this); // Paper
entityhorseskeleton.s(true);
entityhorseskeleton.setAgeRaw(0);
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 7c0a53053..40ee34675 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -1181,153 +1181,153 @@ public class CraftWorld implements World {
entity.setPositionRotation(x, y, z, 0, 0);
} else if (LivingEntity.class.isAssignableFrom(clazz)) {
if (Chicken.class.isAssignableFrom(clazz)) {
- entity = new EntityChicken(world);
+ entity = EntityTypes.CHICKEN.create(world); // Paper
} else if (Cow.class.isAssignableFrom(clazz)) {
if (MushroomCow.class.isAssignableFrom(clazz)) {
- entity = new EntityMushroomCow(world);
+ entity = EntityTypes.MOOSHROOM.create(world); // Paper
} else {
- entity = new EntityCow(world);
+ entity = EntityTypes.COW.create(world); // Paper
}
} else if (Golem.class.isAssignableFrom(clazz)) {
if (Snowman.class.isAssignableFrom(clazz)) {
- entity = new EntitySnowman(world);
+ entity = EntityTypes.SNOW_GOLEM.create(world); // Paper
} else if (IronGolem.class.isAssignableFrom(clazz)) {
- entity = new EntityIronGolem(world);
+ entity = EntityTypes.IRON_GOLEM.create(world); // Paper
} else if (Shulker.class.isAssignableFrom(clazz)) {
- entity = new EntityShulker(world);
+ entity = EntityTypes.SHULKER.create(world); // Paper
}
} else if (Creeper.class.isAssignableFrom(clazz)) {
- entity = new EntityCreeper(world);
+ entity = EntityTypes.CREEPER.create(world); // Paper
} else if (Ghast.class.isAssignableFrom(clazz)) {
- entity = new EntityGhast(world);
+ entity = EntityTypes.GHAST.create(world); // Paper
} else if (Pig.class.isAssignableFrom(clazz)) {
- entity = new EntityPig(world);
+ entity = EntityTypes.PIG.create(world); // Paper
} else if (Player.class.isAssignableFrom(clazz)) {
// need a net server handler for this one
} else if (Sheep.class.isAssignableFrom(clazz)) {
- entity = new EntitySheep(world);
+ entity = EntityTypes.SHEEP.create(world); // Paper
} else if (AbstractHorse.class.isAssignableFrom(clazz)) {
if (ChestedHorse.class.isAssignableFrom(clazz)) {
if (Donkey.class.isAssignableFrom(clazz)) {
- entity = new EntityHorseDonkey(world);
+ entity = EntityTypes.DONKEY.create(world); // Paper
} else if (Mule.class.isAssignableFrom(clazz)) {
- entity = new EntityHorseMule(world);
+ entity = EntityTypes.MULE.create(world); // Paper
} else if (Llama.class.isAssignableFrom(clazz)) {
- entity = new EntityLlama(world);
+ entity = EntityTypes.LLAMA.create(world); // Paper
}
} else if (SkeletonHorse.class.isAssignableFrom(clazz)) {
- entity = new EntityHorseSkeleton(world);
+ entity = EntityTypes.SKELETON_HORSE.create(world); // Paper
} else if (ZombieHorse.class.isAssignableFrom(clazz)) {
- entity = new EntityHorseZombie(world);
+ entity = EntityTypes.ZOMBIE_HORSE.create(world); // Paper
} else {
- entity = new EntityHorse(world);
+ entity = EntityTypes.HORSE.create(world); // Paper
}
} else if (Skeleton.class.isAssignableFrom(clazz)) {
if (Stray.class.isAssignableFrom(clazz)){
- entity = new EntitySkeletonStray(world);
+ entity = EntityTypes.STRAY.create(world); // Paper
} else if (WitherSkeleton.class.isAssignableFrom(clazz)) {
- entity = new EntitySkeletonWither(world);
+ entity = EntityTypes.WITHER_SKELETON.create(world); // Paper
} else {
- entity = new EntitySkeleton(world);
+ entity = EntityTypes.SKELETON.create(world); // Paper
}
} else if (Slime.class.isAssignableFrom(clazz)) {
if (MagmaCube.class.isAssignableFrom(clazz)) {
- entity = new EntityMagmaCube(world);
+ entity = EntityTypes.MAGMA_CUBE.create(world); // Paper
} else {
- entity = new EntitySlime(world);
+ entity = EntityTypes.SLIME.create(world); // Paper
}
} else if (Spider.class.isAssignableFrom(clazz)) {
if (CaveSpider.class.isAssignableFrom(clazz)) {
- entity = new EntityCaveSpider(world);
+ entity = EntityTypes.CAVE_SPIDER.create(world); // Paper
} else {
- entity = new EntitySpider(world);
+ entity = EntityTypes.SPIDER.create(world); // Paper
}
} else if (Squid.class.isAssignableFrom(clazz)) {
- entity = new EntitySquid(world);
+ entity = EntityTypes.SQUID.create(world); // Paper
} else if (Tameable.class.isAssignableFrom(clazz)) {
if (Wolf.class.isAssignableFrom(clazz)) {
- entity = new EntityWolf(world);
+ entity = EntityTypes.WOLF.create(world); // Paper
} else if (Ocelot.class.isAssignableFrom(clazz)) {
- entity = new EntityOcelot(world);
+ entity = EntityTypes.OCELOT.create(world); // Paper
} else if (Parrot.class.isAssignableFrom(clazz)) {
- entity = new EntityParrot(world);
+ entity = EntityTypes.PARROT.create(world); // Paper
}
} else if (PigZombie.class.isAssignableFrom(clazz)) {
- entity = new EntityPigZombie(world);
+ entity = EntityTypes.ZOMBIE_PIGMAN.create(world); // Paper
} else if (Zombie.class.isAssignableFrom(clazz)) {
if (Husk.class.isAssignableFrom(clazz)) {
- entity = new EntityZombieHusk(world);
+ entity = EntityTypes.HUSK.create(world); // Paper
} else if (ZombieVillager.class.isAssignableFrom(clazz)) {
- entity = new EntityZombieVillager(world);
+ entity = EntityTypes.ZOMBIE_VILLAGER.create(world); // Paper
} else if (Drowned.class.isAssignableFrom(clazz)) {
- entity = new EntityDrowned(world);
+ entity = EntityTypes.DROWNED.create(world); // Paper
} else {
- entity = new EntityZombie(world);
+ entity = EntityTypes.ZOMBIE.create(world); // Paper
}
} else if (Giant.class.isAssignableFrom(clazz)) {
- entity = new EntityGiantZombie(world);
+ entity = EntityTypes.GIANT.create(world); // Paper
} else if (Silverfish.class.isAssignableFrom(clazz)) {
- entity = new EntitySilverfish(world);
+ entity = EntityTypes.SILVERFISH.create(world); // Paper
} else if (Enderman.class.isAssignableFrom(clazz)) {
- entity = new EntityEnderman(world);
+ entity = EntityTypes.ENDERMAN.create(world); // Paper
} else if (Blaze.class.isAssignableFrom(clazz)) {
- entity = new EntityBlaze(world);
+ entity = EntityTypes.BLAZE.create(world); // Paper
} else if (Villager.class.isAssignableFrom(clazz)) {
- entity = new EntityVillager(world);
+ entity = EntityTypes.VILLAGER.create(world); // Paper
} else if (Witch.class.isAssignableFrom(clazz)) {
- entity = new EntityWitch(world);
+ entity = EntityTypes.WITCH.create(world); // Paper
} else if (Wither.class.isAssignableFrom(clazz)) {
- entity = new EntityWither(world);
+ entity = EntityTypes.WITHER.create(world); // Paper
} else if (ComplexLivingEntity.class.isAssignableFrom(clazz)) {
if (EnderDragon.class.isAssignableFrom(clazz)) {
- entity = new EntityEnderDragon(world);
+ entity = EntityTypes.ENDER_DRAGON.create(world); // Paper
}
} else if (Ambient.class.isAssignableFrom(clazz)) {
if (Bat.class.isAssignableFrom(clazz)) {
- entity = new EntityBat(world);
+ entity = EntityTypes.BAT.create(world); // Paper
}
} else if (Rabbit.class.isAssignableFrom(clazz)) {
- entity = new EntityRabbit(world);
+ entity = EntityTypes.RABBIT.create(world); // Paper
} else if (Endermite.class.isAssignableFrom(clazz)) {
- entity = new EntityEndermite(world);
+ entity = EntityTypes.ENDERMITE.create(world); // Paper
} else if (Guardian.class.isAssignableFrom(clazz)) {
if (ElderGuardian.class.isAssignableFrom(clazz)){
- entity = new EntityGuardianElder(world);
+ entity = EntityTypes.ELDER_GUARDIAN.create(world); // Paper
} else {
- entity = new EntityGuardian(world);
+ entity = EntityTypes.GUARDIAN.create(world); // Paper
}
} else if (ArmorStand.class.isAssignableFrom(clazz)) {
- entity = new EntityArmorStand(world, x, y, z);
+ entity = EntityTypes.ARMOR_STAND.create(world); // Paper
} else if (PolarBear.class.isAssignableFrom(clazz)) {
- entity = new EntityPolarBear(world);
+ entity = EntityTypes.POLAR_BEAR.create(world); // Paper
} else if (Vex.class.isAssignableFrom(clazz)) {
- entity = new EntityVex(world);
+ entity = EntityTypes.VEX.create(world); // Paper
} else if (Illager.class.isAssignableFrom(clazz)) {
if (Spellcaster.class.isAssignableFrom(clazz)) {
if (Evoker.class.isAssignableFrom(clazz)) {
- entity = new EntityEvoker(world);
+ entity = EntityTypes.EVOKER.create(world); // Paper
} else if (Illusioner.class.isAssignableFrom(clazz)) {
- entity = new EntityIllagerIllusioner(world);
+ entity = EntityTypes.ILLUSIONER.create(world); // Paper
}
} else if (Vindicator.class.isAssignableFrom(clazz)) {
- entity = new EntityVindicator(world);
+ entity = EntityTypes.VINDICATOR.create(world); // Paper
}
} else if (Turtle.class.isAssignableFrom(clazz)) {
- entity = new EntityTurtle(world);
+ entity = EntityTypes.TURTLE.create(world); // Paper
} else if (Phantom.class.isAssignableFrom(clazz)) {
- entity = new EntityPhantom(world);
+ entity = EntityTypes.PHANTOM.create(world); // Paper
} else if (Fish.class.isAssignableFrom(clazz)) {
if (Cod.class.isAssignableFrom(clazz)) {
- entity = new EntityCod(world);
+ entity = EntityTypes.COD.create(world); // Paper
} else if (PufferFish.class.isAssignableFrom(clazz)) {
- entity = new EntityPufferFish(world);
+ entity = EntityTypes.PUFFERFISH.create(world); // Paper
} else if (Salmon.class.isAssignableFrom(clazz)) {
- entity = new EntitySalmon(world);
+ entity = EntityTypes.SALMON.create(world); // Paper
} else if (TropicalFish.class.isAssignableFrom(clazz)) {
- entity = new EntityTropicalFish(world);
+ entity = EntityTypes.TROPICAL_FISH.create(world); // Paper
}
} else if (Dolphin.class.isAssignableFrom(clazz)) {
- entity = new EntityDolphin(world);
+ entity = EntityTypes.DOLPHIN.create(world); // Paper
}
if (entity != null) {
--
2.21.0