diff options
author | TomyLobo <tomylobo@nurfuerspam.de> | 2012-02-21 13:51:56 +0100 |
---|---|---|
committer | EvilSeph <evilseph@gmail.com> | 2012-02-29 00:12:26 -0500 |
commit | 92dfb2500b68de14bc9b873f7d5821090af9bac0 (patch) | |
tree | 299f241b2365cc9cdc954461323a233f98551321 /src/main/java/net/minecraft/server/EntitySheep.java | |
parent | dcf016822dc84146ee62cc2646d51673b0466706 (diff) | |
download | craftbukkit-92dfb2500b68de14bc9b873f7d5821090af9bac0.tar craftbukkit-92dfb2500b68de14bc9b873f7d5821090af9bac0.tar.gz craftbukkit-92dfb2500b68de14bc9b873f7d5821090af9bac0.tar.lz craftbukkit-92dfb2500b68de14bc9b873f7d5821090af9bac0.tar.xz craftbukkit-92dfb2500b68de14bc9b873f7d5821090af9bac0.zip |
Adjusted CraftBukkit to work with the entity event convenience patch in Bukkit. Addresses BUKKIT-809
Diffstat (limited to 'src/main/java/net/minecraft/server/EntitySheep.java')
-rw-r--r-- | src/main/java/net/minecraft/server/EntitySheep.java | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/src/main/java/net/minecraft/server/EntitySheep.java b/src/main/java/net/minecraft/server/EntitySheep.java index 28ac8070..77e9092a 100644 --- a/src/main/java/net/minecraft/server/EntitySheep.java +++ b/src/main/java/net/minecraft/server/EntitySheep.java @@ -5,7 +5,7 @@ import java.util.Random; // CraftBukkit start import org.bukkit.Material; import org.bukkit.craftbukkit.event.CraftEventFactory; -import org.bukkit.event.entity.EntityChangeBlockEvent; +import org.bukkit.entity.Sheep; // CraftBukkit end public class EntitySheep extends EntityAnimal { @@ -79,13 +79,7 @@ public class EntitySheep extends EntityAnimal { if (this.world.getTypeId(i, j, k) == Block.LONG_GRASS.id) { // CraftBukkit start - org.bukkit.World bworld = this.world.getWorld(); - org.bukkit.block.Block bblock = bworld.getBlockAt(i, j, k); - - EntityChangeBlockEvent event = new EntityChangeBlockEvent(this.getBukkitEntity(), bblock, Material.AIR); - this.world.getServer().getPluginManager().callEvent(event); - - if (!event.isCancelled()) { + if (!CraftEventFactory.callEntityChangeBlockEvent(this.getBukkitEntity(), this.world.getWorld().getBlockAt(i, j, k), Material.AIR).isCancelled()) { this.world.f(2001, i, j, k, Block.LONG_GRASS.id + 256); this.world.setTypeId(i, j, k, 0); flag = true; @@ -93,13 +87,7 @@ public class EntitySheep extends EntityAnimal { // CraftBukkit end } else if (this.world.getTypeId(i, j - 1, k) == Block.GRASS.id) { // CraftBukkit start - org.bukkit.World bworld = this.world.getWorld(); - org.bukkit.block.Block bblock = bworld.getBlockAt(i, j - 1, k); - - EntityChangeBlockEvent event = new EntityChangeBlockEvent(this.getBukkitEntity(), bblock, Material.DIRT); - this.world.getServer().getPluginManager().callEvent(event); - - if (!event.isCancelled()) { + if (!CraftEventFactory.callEntityChangeBlockEvent(this.getBukkitEntity(), this.world.getWorld().getBlockAt(i, j - 1, k), Material.DIRT).isCancelled()) { this.world.f(2001, i, j - 1, k, Block.GRASS.id); this.world.setTypeId(i, j - 1, k, Block.DIRT.id); flag = true; @@ -110,7 +98,7 @@ public class EntitySheep extends EntityAnimal { if (flag) { // CraftBukkit start if (!this.isBaby()) { - org.bukkit.event.entity.SheepRegrowWoolEvent event = new org.bukkit.event.entity.SheepRegrowWoolEvent(this.getBukkitEntity()); + org.bukkit.event.entity.SheepRegrowWoolEvent event = new org.bukkit.event.entity.SheepRegrowWoolEvent((Sheep) this.getBukkitEntity()); this.world.getServer().getPluginManager().callEvent(event); if (!event.isCancelled()) { |