diff options
author | Andrew Ardill <andrew.ardill@gmail.com> | 2011-02-17 16:25:03 +1100 |
---|---|---|
committer | Andrew Ardill <andrew.ardill@gmail.com> | 2011-02-17 17:59:27 +1100 |
commit | da6ce2d80ecceeb37fbe9eb2082bbe227a5c8d39 (patch) | |
tree | 380526e431c2e56fbacd3d7b1cba1a7e2672c1d3 /src/main/java/org | |
parent | 0703f4f4581f810d8aaee2674ea6ced189a662aa (diff) | |
download | craftbukkit-da6ce2d80ecceeb37fbe9eb2082bbe227a5c8d39.tar craftbukkit-da6ce2d80ecceeb37fbe9eb2082bbe227a5c8d39.tar.gz craftbukkit-da6ce2d80ecceeb37fbe9eb2082bbe227a5c8d39.tar.lz craftbukkit-da6ce2d80ecceeb37fbe9eb2082bbe227a5c8d39.tar.xz craftbukkit-da6ce2d80ecceeb37fbe9eb2082bbe227a5c8d39.zip |
Implementation of spawnCreature(Location, CreatureType)
Diffstat (limited to 'src/main/java/org')
-rw-r--r-- | src/main/java/org/bukkit/craftbukkit/CraftWorld.java | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java index 168d85e5..c6c646d3 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -10,6 +10,7 @@ import java.util.List; import java.util.Map; import java.util.Random; import net.minecraft.server.*; + import org.bukkit.entity.Arrow; import org.bukkit.block.Block; import org.bukkit.entity.Boat; @@ -277,6 +278,20 @@ public class CraftWorld implements World { return (Boat) boat.getBukkitEntity(); } + public Creature spawnCreature(Location loc, CreatureType creatureType) { + Creature creature; + try { + EntityCreature entityCreature = (EntityCreature) EntityTypes.a(creatureType.getName(), world); + entityCreature.a(loc.getX(), loc.getY(), loc.getZ()); + creature = (Creature) CraftEntity.getEntity(server, entityCreature); + world.a(entityCreature); + } catch (Exception e) { + // if we fail, for any reason, return null. + creature = null; + } + return creature; + } + public boolean generateTree(Location loc, TreeType type) { return generateTree(loc, type, world); } |