diff options
author | EvilSeph <evilseph@unaligned.org> | 2011-02-16 22:42:41 -0500 |
---|---|---|
committer | EvilSeph <evilseph@unaligned.org> | 2011-02-16 22:45:00 -0500 |
commit | 03c118f343f8e559c0573589f4f89e4e2b3d10ad (patch) | |
tree | 323d5dcb8791cb9b6e8167b004aa9e48cac21f22 /src/main/java | |
parent | dc45946163d5c472147b52a36e8d325913f904e0 (diff) | |
download | craftbukkit-03c118f343f8e559c0573589f4f89e4e2b3d10ad.tar craftbukkit-03c118f343f8e559c0573589f4f89e4e2b3d10ad.tar.gz craftbukkit-03c118f343f8e559c0573589f4f89e4e2b3d10ad.tar.lz craftbukkit-03c118f343f8e559c0573589f4f89e4e2b3d10ad.tar.xz craftbukkit-03c118f343f8e559c0573589f4f89e4e2b3d10ad.zip |
Added CREATURE_SPAWN event per ss2man44
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/net/minecraft/server/World.java | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java index 02c5be83..3275e369 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -17,12 +17,15 @@ import java.util.Set; import java.util.TreeSet; // CraftBukkit start +import org.bukkit.Location; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.CraftWorld; import org.bukkit.event.Event; import org.bukkit.event.Event.Type; import org.bukkit.event.block.BlockCanBuildEvent; import org.bukkit.event.block.BlockPhysicsEvent; +import org.bukkit.event.entity.CreatureSpawnEvent; +import org.bukkit.entity.MobType; // CraftBukkit end public class World implements IBlockAccess { @@ -806,6 +809,48 @@ public class World implements IBlockAccess { flag = true; } + //CraftBukkit start + if (entity instanceof EntityLiving) { + + MobType type = null; + + if (entity instanceof EntityChicken) { + type = MobType.CHICKEN; + } else if (entity instanceof EntityCow) { + type = MobType.COW; + } else if (entity instanceof EntityCreeper) { + type = MobType.CREEPER; + } else if (entity instanceof EntityGhast) { + type = MobType.GHAST; + } else if (entity instanceof EntityPig) { + type = MobType.PIG; + } else if (entity instanceof EntityPigZombie) { + type = MobType.PIG_ZOMBIE; + } else if (entity instanceof EntitySheep) { + type = MobType.SHEEP; + } else if (entity instanceof EntitySkeleton) { + type = MobType.SKELETON; + } else if (entity instanceof EntitySpider) { + type = MobType.SPIDER; + } else if (entity instanceof EntityZombie) { + type = MobType.ZOMBIE; + } + + if (type != null) { + CraftServer server = ((WorldServer)this).getServer(); + Location loc = new Location(((WorldServer)this).getWorld(), entity.O, entity.P, entity.Q); + + CreatureSpawnEvent cse; + cse = new CreatureSpawnEvent(entity.getBukkitEntity(), type, loc); + server.getPluginManager().callEvent(cse); + + if (cse.isCancelled()) { + return false; + } + } + } + //CraftBukkit end + if (!flag && !this.f(i, j)) { return false; } else { |