mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-02 04:56:50 +01:00
Add new entities to World.spawn method. Fixes BUKKIT-2658
This commit is contained in:
parent
788e9e84cf
commit
d97d193b91
1 changed files with 19 additions and 3 deletions
|
@ -837,6 +837,8 @@ public class CraftWorld implements World {
|
||||||
} else if (Fireball.class.isAssignableFrom(clazz)) {
|
} else if (Fireball.class.isAssignableFrom(clazz)) {
|
||||||
if (SmallFireball.class.isAssignableFrom(clazz)) {
|
if (SmallFireball.class.isAssignableFrom(clazz)) {
|
||||||
entity = new EntitySmallFireball(world);
|
entity = new EntitySmallFireball(world);
|
||||||
|
} else if (WitherSkull.class.isAssignableFrom(clazz)) {
|
||||||
|
entity = new EntityWitherSkull(world);
|
||||||
} else {
|
} else {
|
||||||
entity = new EntityLargeFireball(world);
|
entity = new EntityLargeFireball(world);
|
||||||
}
|
}
|
||||||
|
@ -918,16 +920,24 @@ public class CraftWorld implements World {
|
||||||
entity = new EntityBlaze(world);
|
entity = new EntityBlaze(world);
|
||||||
} else if (Villager.class.isAssignableFrom(clazz)) {
|
} else if (Villager.class.isAssignableFrom(clazz)) {
|
||||||
entity = new EntityVillager(world);
|
entity = new EntityVillager(world);
|
||||||
|
} else if (Witch.class.isAssignableFrom(clazz)) {
|
||||||
|
entity = new EntityWitch(world);
|
||||||
|
} else if (Wither.class.isAssignableFrom(clazz)) {
|
||||||
|
entity = new EntityWither(world);
|
||||||
} else if (ComplexLivingEntity.class.isAssignableFrom(clazz)) {
|
} else if (ComplexLivingEntity.class.isAssignableFrom(clazz)) {
|
||||||
if (EnderDragon.class.isAssignableFrom(clazz)) {
|
if (EnderDragon.class.isAssignableFrom(clazz)) {
|
||||||
entity = new EntityEnderDragon(world);
|
entity = new EntityEnderDragon(world);
|
||||||
}
|
}
|
||||||
|
} else if (Ambient.class.isAssignableFrom(clazz)) {
|
||||||
|
if (Bat.class.isAssignableFrom(clazz)) {
|
||||||
|
entity = new EntityBat(world);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entity != null) {
|
if (entity != null) {
|
||||||
entity.setLocation(x, y, z, pitch, yaw);
|
entity.setLocation(x, y, z, pitch, yaw);
|
||||||
}
|
}
|
||||||
} else if (Painting.class.isAssignableFrom(clazz)) {
|
} else if (Hanging.class.isAssignableFrom(clazz)) {
|
||||||
Block block = getBlockAt(location);
|
Block block = getBlockAt(location);
|
||||||
BlockFace face = BlockFace.SELF;
|
BlockFace face = BlockFace.SELF;
|
||||||
if (block.getRelative(BlockFace.EAST).getTypeId() == 0) {
|
if (block.getRelative(BlockFace.EAST).getTypeId() == 0) {
|
||||||
|
@ -955,8 +965,14 @@ public class CraftWorld implements World {
|
||||||
dir = 3;
|
dir = 3;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
entity = new EntityPainting(world, (int) x, (int) y, (int) z, dir);
|
|
||||||
if (!((EntityPainting) entity).survives()) {
|
if (Painting.class.isAssignableFrom(clazz)) {
|
||||||
|
entity = new EntityPainting(world, (int) x, (int) y, (int) z, dir);
|
||||||
|
} else if (ItemFrame.class.isAssignableFrom(clazz)) {
|
||||||
|
entity = new EntityItemFrame(world, (int) x, (int) y, (int) z, dir);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (entity != null && !((EntityHanging) entity).survives()) {
|
||||||
entity = null;
|
entity = null;
|
||||||
}
|
}
|
||||||
} else if (TNTPrimed.class.isAssignableFrom(clazz)) {
|
} else if (TNTPrimed.class.isAssignableFrom(clazz)) {
|
||||||
|
|
Loading…
Reference in a new issue