diff options
author | Andrew Ardill <andrew.ardill@gmail.com> | 2011-01-17 08:53:42 +0800 |
---|---|---|
committer | Dinner Bone <dinnerbone@dinnerbone.com> | 2011-01-18 00:13:32 +0800 |
commit | 5f2c8108b776ab5710adfe597574fb0b7e929e36 (patch) | |
tree | c519cb90c2b68c53f0851ac82771d111602a3f79 /src | |
parent | 3400eafaf1ba56b43dbdbb9e0aac3ebf5930538b (diff) | |
download | craftbukkit-5f2c8108b776ab5710adfe597574fb0b7e929e36.tar craftbukkit-5f2c8108b776ab5710adfe597574fb0b7e929e36.tar.gz craftbukkit-5f2c8108b776ab5710adfe597574fb0b7e929e36.tar.lz craftbukkit-5f2c8108b776ab5710adfe597574fb0b7e929e36.tar.xz craftbukkit-5f2c8108b776ab5710adfe597574fb0b7e929e36.zip |
Updates to all Entities to use getBukkitEntity() any time an event is
raised.
Similar update to CraftVehicle and CraftLivingEntity
Diffstat (limited to 'src')
14 files changed, 34 insertions, 70 deletions
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java index f39c29e7..9de175cb 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java @@ -222,9 +222,8 @@ public abstract class Entity { // CraftBukkit start if(this instanceof EntityLiving) { CraftServer server = ((WorldServer)l).getServer(); - CraftEntity damagee = new CraftLivingEntity(server, (EntityLiving)this); - EntityDamageEvent ede = new EntityDamageEvent(damagee, EntityDamageEvent.DamageCause.DROWNING, 1); + EntityDamageEvent ede = new EntityDamageEvent(this.getBukkitEntity(), EntityDamageEvent.DamageCause.DROWNING, 1); server.getPluginManager().callEvent(ede); if (!ede.isCancelled()){ @@ -256,15 +255,14 @@ public abstract class Entity { // CraftBukkit start if(this instanceof EntityLiving) { CraftServer server = ((WorldServer)l).getServer(); - CraftEntity defender = new CraftLivingEntity(server, (EntityLiving) this); - EntityDamageByBlockEvent ede = new EntityDamageByBlockEvent(null, defender, EntityDamageEvent.DamageCause.LAVA, 4); + EntityDamageByBlockEvent ede = new EntityDamageByBlockEvent(null, this.getBukkitEntity(), EntityDamageEvent.DamageCause.LAVA, 4); server.getPluginManager().callEvent(ede); if (!ede.isCancelled()){ a(((Entity) (null)), ede.getDamage()); } - EntityCombustEvent ece = new EntityCombustEvent(Type.ENTITY_COMBUST, defender); + EntityCombustEvent ece = new EntityCombustEvent(Type.ENTITY_COMBUST, this.getBukkitEntity()); server.getPluginManager().callEvent(ece); if (!ece.isCancelled()){ Z = 600; @@ -507,16 +505,9 @@ public abstract class Entity { if (!ae) { // CraftBukkit start if(this instanceof EntityLiving) { - CraftEntity defender = null; CraftServer server = ((WorldServer)l).getServer(); - if (this instanceof EntityPlayerMP) { - defender = new CraftPlayer(server, (EntityPlayerMP)this); - } else { - defender = new CraftLivingEntity(server, (EntityLiving)this); - } - - EntityDamageEvent ede = new EntityDamageEvent(defender, EntityDamageEvent.DamageCause.FIRE, i1); + EntityDamageEvent ede = new EntityDamageEvent(this.getBukkitEntity(), EntityDamageEvent.DamageCause.FIRE, i1); server.getPluginManager().callEvent(ede); if (!ede.isCancelled()){ diff --git a/src/main/java/net/minecraft/server/EntityArrow.java b/src/main/java/net/minecraft/server/EntityArrow.java index 38260d00..1940349d 100644 --- a/src/main/java/net/minecraft/server/EntityArrow.java +++ b/src/main/java/net/minecraft/server/EntityArrow.java @@ -176,14 +176,10 @@ public class EntityArrow extends Entity { boolean bounce; if (entity instanceof EntityLiving) { CraftServer server = ((WorldServer) this.l).getServer(); - CraftEntity damagee = new CraftLivingEntity(server, (EntityLiving) entity); - CraftEntity damager = new CraftLivingEntity(server, b); - CraftEntity projectile = new CraftArrow(server, (EntityArrow) this); //TODO decide if we should create DamageCause.ARROW, DamageCause.PROJECTILE // or leave as DamageCause.ENTITY_ATTACK - EntityDamageByProjectileEvent edbpe = new EntityDamageByProjectileEvent( - damager, damagee, projectile, EntityDamageEvent.DamageCause.ENTITY_ATTACK, 4); + EntityDamageByProjectileEvent edbpe = new EntityDamageByProjectileEvent(b.getBukkitEntity(), entity.getBukkitEntity(), this.getBukkitEntity(), EntityDamageEvent.DamageCause.ENTITY_ATTACK, 4); server.getPluginManager().callEvent(edbpe); if(!edbpe.isCancelled()) { diff --git a/src/main/java/net/minecraft/server/EntityBoat.java b/src/main/java/net/minecraft/server/EntityBoat.java index 24ae4606..1cc03470 100644 --- a/src/main/java/net/minecraft/server/EntityBoat.java +++ b/src/main/java/net/minecraft/server/EntityBoat.java @@ -10,6 +10,7 @@ import org.bukkit.craftbukkit.entity.CraftBoat; import org.bukkit.craftbukkit.entity.CraftEntity; import org.bukkit.craftbukkit.CraftMappable; import org.bukkit.craftbukkit.CraftServer; +import org.bukkit.entity.Vehicle; import org.bukkit.event.Event.Type; import org.bukkit.event.vehicle.VehicleCreateEvent; import org.bukkit.event.vehicle.VehicleDamageEvent; @@ -31,8 +32,9 @@ public class EntityBoat extends Entity implements CraftMappable { // CraftBukkit private double am; // CraftBukkit start + /**@deprecated*/ private CraftBoat boat; - + /**@deprecated*/ public CraftEntity getCraftEntity() { return boat; } @@ -85,8 +87,7 @@ public class EntityBoat extends Entity implements CraftMappable { // CraftBukkit // CraftBukkit start private void handleCreation(World world) { CraftServer server = ((WorldServer) world).getServer(); - boat = new CraftBoat(server, this); - VehicleCreateEvent event = new VehicleCreateEvent( Type.VEHICLE_CREATE, boat); + VehicleCreateEvent event = new VehicleCreateEvent( Type.VEHICLE_CREATE, (Vehicle) this.getBukkitEntity()); server.getPluginManager().callEvent(event); } // CraftBukkit end @@ -97,7 +98,7 @@ public class EntityBoat extends Entity implements CraftMappable { // CraftBukkit public boolean a(Entity entity, int i) { // CraftBukkit start - VehicleDamageEvent event = new VehicleDamageEvent( Type.VEHICLE_DAMAGE, boat, ((WorldServer)l).getWorld().toCraftEntity(entity), i); + VehicleDamageEvent event = new VehicleDamageEvent( Type.VEHICLE_DAMAGE, (Vehicle) this.getBukkitEntity(), entity.getBukkitEntity(), i); ((WorldServer) l).getServer().getPluginManager().callEvent(event); if (event.isCancelled()) { @@ -290,12 +291,7 @@ public class EntityBoat extends Entity implements CraftMappable { // CraftBukkit // CraftBukkit start CraftServer server = ((WorldServer)l).getServer(); - VehicleMoveEvent event = new VehicleMoveEvent( - Type.VEHICLE_MOVE, - boat, - new Location(((WorldServer)l).getWorld(), prevX, prevY, prevZ, prevYaw, prevPitch), - new Location(((WorldServer)l).getWorld(), p, q, r, v, w) - ); + VehicleMoveEvent event = new VehicleMoveEvent(Type.VEHICLE_MOVE, (Vehicle) this.getBukkitEntity(), new Location(((WorldServer)l).getWorld(), prevX, prevY, prevZ, prevYaw, prevPitch), new Location(((WorldServer)l).getWorld(), p, q, r, v, w)); server.getPluginManager().callEvent(event); // CraftBukkit end @@ -330,7 +326,7 @@ public class EntityBoat extends Entity implements CraftMappable { // CraftBukkit // CraftBukkit start public void c(Entity entity) { CraftServer server = ((WorldServer)l).getServer(); - VehicleEntityCollisionEvent collsionEvent = new VehicleEntityCollisionEvent( Type.VEHICLE_COLLISION_ENTITY, boat, ((WorldServer)l).getWorld().toCraftEntity(entity)); + VehicleEntityCollisionEvent collsionEvent = new VehicleEntityCollisionEvent( Type.VEHICLE_COLLISION_ENTITY, (Vehicle) this.getBukkitEntity(), entity.getBukkitEntity()); server.getPluginManager().callEvent(collsionEvent); if (collsionEvent.isCancelled()) { @@ -352,7 +348,7 @@ public class EntityBoat extends Entity implements CraftMappable { // CraftBukkit if (!l.z) { // CraftBukkit start CraftServer server = ((WorldServer)l).getServer(); - VehicleEnterEvent event = new VehicleEnterEvent( Type.VEHICLE_ENTER, boat, ((WorldServer)l).getWorld().toCraftEntity(entityplayer)); + VehicleEnterEvent event = new VehicleEnterEvent( Type.VEHICLE_ENTER, (Vehicle) this.getBukkitEntity(), entityplayer.getBukkitEntity()); server.getPluginManager().callEvent(event); if (event.isCancelled()) { diff --git a/src/main/java/net/minecraft/server/EntityEgg.java b/src/main/java/net/minecraft/server/EntityEgg.java index 75ebe9bb..690701c7 100644 --- a/src/main/java/net/minecraft/server/EntityEgg.java +++ b/src/main/java/net/minecraft/server/EntityEgg.java @@ -5,6 +5,7 @@ import java.util.Random; // CraftBukkit start import org.bukkit.entity.MobType; +import org.bukkit.entity.Player; import org.bukkit.craftbukkit.entity.CraftArrow; import org.bukkit.craftbukkit.entity.CraftEgg; import org.bukkit.craftbukkit.entity.CraftEntity; @@ -182,12 +183,9 @@ public class EntityEgg extends Entity { boolean bounce; if (movingobjectposition.g instanceof EntityLiving) { CraftServer server = ((WorldServer) this.l).getServer(); - CraftEntity damagee = new CraftLivingEntity(server, (EntityLiving) movingobjectposition.g); - CraftEntity damager = new CraftLivingEntity(server, ak); - CraftEntity projectile = new CraftEgg(server, (EntityEgg) this); //TODO @see EntityArrow#162 - EntityDamageByProjectileEvent edbpe = new EntityDamageByProjectileEvent( damager, damagee, projectile, EntityDamageEvent.DamageCause.ENTITY_ATTACK, 0); + EntityDamageByProjectileEvent edbpe = new EntityDamageByProjectileEvent( ak.getBukkitEntity(), movingobjectposition.g.getBukkitEntity(), this.getBukkitEntity(), EntityDamageEvent.DamageCause.ENTITY_ATTACK, 0); server.getPluginManager().callEvent(edbpe); if(!edbpe.isCancelled()) { @@ -216,8 +214,7 @@ public class EntityEgg extends Entity { if (ak instanceof EntityPlayerMP) { CraftServer server = ((WorldServer) l).getServer(); - CraftPlayer player = new CraftPlayer(server, (EntityPlayerMP) ak); - PlayerEggThrowEvent event = new PlayerEggThrowEvent(Type.PLAYER_EGG_THROW, player, hatching, numHatching, type); + PlayerEggThrowEvent event = new PlayerEggThrowEvent(Type.PLAYER_EGG_THROW, (Player) ak.getBukkitEntity(), hatching, numHatching, type); server.getPluginManager().callEvent(event); hatching = event.isHatching(); numHatching = event.getNumHatches(); diff --git a/src/main/java/net/minecraft/server/EntityFireball.java b/src/main/java/net/minecraft/server/EntityFireball.java index d2b9007c..fbb7061e 100644 --- a/src/main/java/net/minecraft/server/EntityFireball.java +++ b/src/main/java/net/minecraft/server/EntityFireball.java @@ -140,12 +140,9 @@ public class EntityFireball extends Entity { boolean bounce; if (movingobjectposition.g instanceof EntityLiving) { CraftServer server = ((WorldServer) this.l).getServer(); - CraftEntity damagee = new CraftLivingEntity(server, (EntityLiving) movingobjectposition.g); - CraftEntity damager = new CraftLivingEntity(server, an); - CraftEntity projectile = new CraftFireball(server, (EntityFireball) this); //TODO @see EntityArrow#162 - EntityDamageByProjectileEvent edbpe = new EntityDamageByProjectileEvent( damager, damagee, projectile, EntityDamageEvent.DamageCause.ENTITY_ATTACK, 0); + EntityDamageByProjectileEvent edbpe = new EntityDamageByProjectileEvent( an.getBukkitEntity(), movingobjectposition.g.getBukkitEntity(), this.getBukkitEntity(), EntityDamageEvent.DamageCause.ENTITY_ATTACK, 0); server.getPluginManager().callEvent(edbpe); if(!edbpe.isCancelled()) { diff --git a/src/main/java/net/minecraft/server/EntityFish.java b/src/main/java/net/minecraft/server/EntityFish.java index c0aabe6d..cc6893ae 100644 --- a/src/main/java/net/minecraft/server/EntityFish.java +++ b/src/main/java/net/minecraft/server/EntityFish.java @@ -211,12 +211,9 @@ public class EntityFish extends Entity { boolean bounce; if (movingobjectposition.g instanceof EntityLiving) { CraftServer server = ((WorldServer) this.l).getServer(); - CraftEntity damagee = new CraftLivingEntity(server, (EntityLiving) movingobjectposition.g); - CraftEntity damager = new CraftLivingEntity(server, b); - CraftEntity projectile = new CraftFish(server, (EntityFish) this); //TODO @see EntityArrow#162 - EntityDamageByProjectileEvent edbpe = new EntityDamageByProjectileEvent( damager, damagee, projectile, EntityDamageEvent.DamageCause.ENTITY_ATTACK, 0); + EntityDamageByProjectileEvent edbpe = new EntityDamageByProjectileEvent(b.getBukkitEntity(), movingobjectposition.g.getBukkitEntity(), this.getBukkitEntity(), EntityDamageEvent.DamageCause.ENTITY_ATTACK, 0); server.getPluginManager().callEvent(edbpe); if(!edbpe.isCancelled()) { diff --git a/src/main/java/net/minecraft/server/EntityMinecart.java b/src/main/java/net/minecraft/server/EntityMinecart.java index c555fd1f..f78bb2aa 100644 --- a/src/main/java/net/minecraft/server/EntityMinecart.java +++ b/src/main/java/net/minecraft/server/EntityMinecart.java @@ -12,6 +12,7 @@ import org.bukkit.craftbukkit.entity.CraftStorageMinecart; import org.bukkit.craftbukkit.CraftMappable; import org.bukkit.craftbukkit.entity.CraftMinecart; import org.bukkit.craftbukkit.CraftServer; +import org.bukkit.entity.Vehicle; import org.bukkit.event.Event.Type; import org.bukkit.event.vehicle.*; // CraftBukkit end @@ -100,6 +101,7 @@ public class EntityMinecart extends Entity implements IInventory, CraftMappable // CraftBukkit start protected org.bukkit.entity.Entity bukkitPoweredMinecart; //CraftBukkit protected org.bukkit.entity.Entity bukkitStorageMinecart; //CraftBukkit + /**@deprecated*/ private CraftMinecart minecart; private boolean slowWhenEmpty = true; @@ -109,6 +111,7 @@ public class EntityMinecart extends Entity implements IInventory, CraftMappable private double flyingX = 0.94999998807907104; private double flyingY = 0.94999998807907104; private double flyingZ = 0.94999998807907104; + /**@deprecated*/ public CraftEntity getCraftEntity() { return minecart; } @@ -170,8 +173,7 @@ public class EntityMinecart extends Entity implements IInventory, CraftMappable // CraftBukkit start private void handleCreation(World world) { CraftServer server = ((WorldServer) world).getServer(); - minecart = CraftMinecart.getCraftMinecart(server, this); - VehicleCreateEvent event = new VehicleCreateEvent( Type.VEHICLE_CREATE, minecart); + VehicleCreateEvent event = new VehicleCreateEvent(Type.VEHICLE_CREATE, (Vehicle) this.getBukkitEntity()); server.getPluginManager().callEvent(event); } // CraftBukkit end @@ -182,7 +184,7 @@ public class EntityMinecart extends Entity implements IInventory, CraftMappable public boolean a(Entity entity, int i) { // CraftBukkit start - VehicleDamageEvent event = new VehicleDamageEvent( Type.VEHICLE_DAMAGE, minecart, ((WorldServer)l).getWorld().toCraftEntity(entity), i); + VehicleDamageEvent event = new VehicleDamageEvent(Type.VEHICLE_DAMAGE, (Vehicle) this.getBukkitEntity(), entity.getBukkitEntity(), i); ((WorldServer)l).getServer().getPluginManager().callEvent(event); if (event.isCancelled()) { @@ -505,12 +507,7 @@ public class EntityMinecart extends Entity implements IInventory, CraftMappable // CraftBukkit start CraftServer server = ((WorldServer)this.l).getServer(); - VehicleMoveEvent event = new VehicleMoveEvent( - Type.VEHICLE_MOVE, - minecart, - new Location(((WorldServer)this.l).getWorld(), prevX, prevY, prevZ, prevYaw, prevPitch), - new Location(((WorldServer)this.l).getWorld(), p, q, r, v, w) - ); + VehicleMoveEvent event = new VehicleMoveEvent(Type.VEHICLE_MOVE, (Vehicle) this.getBukkitEntity(), new Location(((WorldServer)this.l).getWorld(), prevX, prevY, prevZ, prevYaw, prevPitch), new Location(((WorldServer)this.l).getWorld(), p, q, r, v, w)); server.getPluginManager().callEvent(event); // CraftBukkit end @@ -646,7 +643,7 @@ public class EntityMinecart extends Entity implements IInventory, CraftMappable // CraftBukkit start CraftServer server = ((WorldServer)l).getServer(); - VehicleEntityCollisionEvent collsionEvent = new VehicleEntityCollisionEvent( Type.VEHICLE_COLLISION_ENTITY, minecart, ((WorldServer)l).getWorld().toCraftEntity(entity)); + VehicleEntityCollisionEvent collsionEvent = new VehicleEntityCollisionEvent(Type.VEHICLE_COLLISION_ENTITY, (Vehicle) this.getBukkitEntity(), entity.getBukkitEntity()); server.getPluginManager().callEvent(collsionEvent); if (collsionEvent.isCancelled()) { @@ -655,7 +652,7 @@ public class EntityMinecart extends Entity implements IInventory, CraftMappable if ((entity instanceof EntityLiving) && !(entity instanceof EntityPlayer) && d == 0 && s * s + u * u > 0.01D && j == null && entity.k == null) { if (!collsionEvent.isPickupCancelled()) { - VehicleEnterEvent enterEvent = new VehicleEnterEvent( Type.VEHICLE_ENTER, minecart, ((WorldServer)l).getWorld().toCraftEntity(entity)); + VehicleEnterEvent enterEvent = new VehicleEnterEvent(Type.VEHICLE_ENTER, (Vehicle) this.getBukkitEntity(), entity.getBukkitEntity()); server.getPluginManager().callEvent(enterEvent); if (!enterEvent.isCancelled()) { @@ -772,7 +769,7 @@ public class EntityMinecart extends Entity implements IInventory, CraftMappable if (!l.z) { // CraftBukkit start CraftServer server = ((WorldServer) l).getServer(); - VehicleEnterEvent event = new VehicleEnterEvent( Type.VEHICLE_ENTER, minecart, ((WorldServer)l).getWorld().toCraftEntity(entityplayer)); + VehicleEnterEvent event = new VehicleEnterEvent(Type.VEHICLE_ENTER, (Vehicle) this.getBukkitEntity(), entityplayer.getBukkitEntity()); server.getPluginManager().callEvent(event); if (event.isCancelled()) { diff --git a/src/main/java/net/minecraft/server/EntityMobs.java b/src/main/java/net/minecraft/server/EntityMobs.java index ee3e84f4..6fd9cb64 100644 --- a/src/main/java/net/minecraft/server/EntityMobs.java +++ b/src/main/java/net/minecraft/server/EntityMobs.java @@ -72,10 +72,8 @@ public class EntityMobs extends EntityCreature implements IMobs { // CraftBukkit start if(entity instanceof EntityLiving) { CraftServer server = ((WorldServer) l).getServer(); - CraftEntity damagee = new CraftLivingEntity(server, (EntityLiving) entity); - CraftEntity damager = new CraftLivingEntity(server, this); - EntityDamageByEntityEvent edbee = new EntityDamageByEntityEvent(damager, damagee, EntityDamageEvent.DamageCause.ENTITY_ATTACK, c); + EntityDamageByEntityEvent edbee = new EntityDamageByEntityEvent(entity.getBukkitEntity(), this.getBukkitEntity(), EntityDamageEvent.DamageCause.ENTITY_ATTACK, c); server.getPluginManager().callEvent(edbee); if (!edbee.isCancelled()){ diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java index 3314d431..0505a863 100644 --- a/src/main/java/net/minecraft/server/EntityPlayer.java +++ b/src/main/java/net/minecraft/server/EntityPlayer.java @@ -342,10 +342,8 @@ public abstract class EntityPlayer extends EntityLiving { // CraftBukkit start if(entity instanceof EntityLiving) { CraftServer server = ((WorldServer) l).getServer(); - CraftEntity damagee = new CraftLivingEntity(server, (EntityLiving) entity); - CraftEntity damager = new CraftLivingEntity(server, this); - EntityDamageByEntityEvent edbee = new EntityDamageByEntityEvent(damager, damagee, EntityDamageEvent.DamageCause.ENTITY_ATTACK, i); + EntityDamageByEntityEvent edbee = new EntityDamageByEntityEvent(entity.getBukkitEntity(), this.getBukkitEntity(), EntityDamageEvent.DamageCause.ENTITY_ATTACK, i); server.getPluginManager().callEvent(edbee); if (!edbee.isCancelled()){ diff --git a/src/main/java/net/minecraft/server/EntitySkeleton.java b/src/main/java/net/minecraft/server/EntitySkeleton.java index 9c548db4..9d2a68af 100644 --- a/src/main/java/net/minecraft/server/EntitySkeleton.java +++ b/src/main/java/net/minecraft/server/EntitySkeleton.java @@ -41,7 +41,7 @@ public class EntitySkeleton extends EntityMobs { if (f1 > 0.5F && l.i(MathHelper.b(p), MathHelper.b(q), MathHelper.b(r)) && W.nextFloat() * 30F < (f1 - 0.4F) * 2.0F) { // CraftBukkit start CraftServer server = ((WorldServer) l).getServer(); - EntityCombustEvent event = new EntityCombustEvent(Type.ENTITY_COMBUST, new CraftLivingEntity(server, (EntityLiving) this)); + EntityCombustEvent event = new EntityCombustEvent(Type.ENTITY_COMBUST, this.getBukkitEntity()); server.getPluginManager().callEvent(event); if (!event.isCancelled()) { Z = 300; diff --git a/src/main/java/net/minecraft/server/EntitySnowball.java b/src/main/java/net/minecraft/server/EntitySnowball.java index 700cac8b..7107d6e7 100644 --- a/src/main/java/net/minecraft/server/EntitySnowball.java +++ b/src/main/java/net/minecraft/server/EntitySnowball.java @@ -177,12 +177,9 @@ public class EntitySnowball extends Entity { boolean bounce; if (movingobjectposition.g instanceof EntityLiving) { CraftServer server = ((WorldServer) this.l).getServer(); - CraftEntity damagee = new CraftLivingEntity(server, (EntityLiving) movingobjectposition.g); - CraftEntity damager = new CraftLivingEntity(server, ak); - CraftEntity projectile = new CraftSnowball(server, (EntitySnowball) this); //TODO @see EntityArrow#162 - EntityDamageByProjectileEvent edbpe = new EntityDamageByProjectileEvent( damager, damagee, projectile, EntityDamageEvent.DamageCause.ENTITY_ATTACK, 0); + EntityDamageByProjectileEvent edbpe = new EntityDamageByProjectileEvent( ak.getBukkitEntity(), movingobjectposition.g.getBukkitEntity(), this.getBukkitEntity(), EntityDamageEvent.DamageCause.ENTITY_ATTACK, 0); server.getPluginManager().callEvent(edbpe); if(!edbpe.isCancelled()) { diff --git a/src/main/java/net/minecraft/server/EntityZombie.java b/src/main/java/net/minecraft/server/EntityZombie.java index 870700bf..9e40a9de 100644 --- a/src/main/java/net/minecraft/server/EntityZombie.java +++ b/src/main/java/net/minecraft/server/EntityZombie.java @@ -29,7 +29,7 @@ public class EntityZombie extends EntityMobs { if (f1 > 0.5F && l.i(MathHelper.b(p), MathHelper.b(q), MathHelper.b(r)) && W.nextFloat() * 30F < (f1 - 0.4F) * 2.0F) { // CraftBukkit start CraftServer server = ((WorldServer) l).getServer(); - EntityCombustEvent event = new EntityCombustEvent(Type.ENTITY_COMBUST, new CraftLivingEntity(server, (EntityLiving) this)); + EntityCombustEvent event = new EntityCombustEvent(Type.ENTITY_COMBUST, this.getBukkitEntity()); server.getPluginManager().callEvent(event); if (!event.isCancelled()) { Z = 300; diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java index 8a3f274c..bf908e16 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java @@ -89,7 +89,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { return null; } - org.bukkit.entity.Entity vehicle = ((CraftWorld)getWorld()).toCraftEntity(entity.k); + org.bukkit.entity.Entity vehicle = (entity.k.getBukkitEntity()); if (vehicle instanceof Vehicle) { return (Vehicle)vehicle; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftVehicle.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftVehicle.java index 2a9a1fae..04d8d187 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftVehicle.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftVehicle.java @@ -16,7 +16,7 @@ public abstract class CraftVehicle extends CraftEntity implements Vehicle { } public Entity getPassenger() { - return ((CraftWorld)getWorld()).toCraftEntity(getHandle().j); + return (getHandle().j.getBukkitEntity()); } public boolean setPassenger(Entity passenger) { |