From 6ea3cec7622946ba8190f57d0e64a8addeb89ebd Mon Sep 17 00:00:00 2001 From: Nathan Adams Date: Thu, 1 Dec 2011 21:50:23 +0000 Subject: [PATCH] Made world.spawnCreature just delegate to world.spawn. This fixes BUKKIT-57 --- .../java/org/bukkit/craftbukkit/CraftWorld.java | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java index a3b29bf2a7..0740b3022f 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -320,17 +320,13 @@ public class CraftWorld implements World { } public LivingEntity spawnCreature(Location loc, CreatureType creatureType) { - LivingEntity creature; - try { - EntityLiving entityCreature = (EntityLiving) EntityTypes.a(creatureType.getName(), world); - entityCreature.setPosition(loc.getX(), loc.getY(), loc.getZ()); - creature = (LivingEntity) CraftEntity.getEntity(server, entityCreature); - world.addEntity(entityCreature, SpawnReason.CUSTOM); - } catch (Exception e) { - // if we fail, for any reason, return null. - creature = null; + Entity result = spawn(loc, creatureType.getEntityClass()); + + if (result == null) { + return null; } - return creature; + + return (LivingEntity)result; } public LightningStrike strikeLightning(Location loc) {