diff options
author | Erik Broes <erikbroes@grum.nl> | 2011-02-06 10:41:53 +0100 |
---|---|---|
committer | Erik Broes <erikbroes@grum.nl> | 2011-02-06 11:51:35 +0100 |
commit | 228b5e7ccdeef71e16958e014fb99c640f84a7a9 (patch) | |
tree | 25139c3a504b3ed860be92e57f99fca8da6aceef /src/main | |
parent | 4026cd656fe3ab64ca31a24aca64b4d54d528cb7 (diff) | |
download | craftbukkit-228b5e7ccdeef71e16958e014fb99c640f84a7a9.tar craftbukkit-228b5e7ccdeef71e16958e014fb99c640f84a7a9.tar.gz craftbukkit-228b5e7ccdeef71e16958e014fb99c640f84a7a9.tar.lz craftbukkit-228b5e7ccdeef71e16958e014fb99c640f84a7a9.tar.xz craftbukkit-228b5e7ccdeef71e16958e014fb99c640f84a7a9.zip |
Added VEHICLE_COLLISION_ENTITY which vanished after porting the code
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/net/minecraft/server/EntityMinecart.java | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/src/main/java/net/minecraft/server/EntityMinecart.java b/src/main/java/net/minecraft/server/EntityMinecart.java index 5cbc07b6..c7b980d2 100644 --- a/src/main/java/net/minecraft/server/EntityMinecart.java +++ b/src/main/java/net/minecraft/server/EntityMinecart.java @@ -604,15 +604,40 @@ public class EntityMinecart extends Entity implements IInventory { public void c(Entity entity) { if (!this.world.isStatic) { if (entity != this.passenger) { + + // CraftBukkit start + CraftServer server = ((WorldServer) world).getServer(); + Type eventType = Type.VEHICLE_COLLISION_ENTITY; + Vehicle vehicle = (Vehicle) this.getBukkitEntity(); + org.bukkit.entity.Entity hitEntity = (entity == null) ? null : entity.getBukkitEntity(); + + VehicleEntityCollisionEvent collsionEvent = new VehicleEntityCollisionEvent(eventType, vehicle, hitEntity); + server.getPluginManager().callEvent(collsionEvent); + + if (collsionEvent.isCancelled()) { + return; + } + if (entity instanceof EntityLiving && !(entity instanceof EntityHuman) && this.d == 0 && this.motX * this.motX + this.motZ * this.motZ > 0.01D && this.passenger == null && entity.vehicle == null) { - entity.e((Entity) this); + if (!collsionEvent.isPickupCancelled()) { + eventType = Type.VEHICLE_ENTER; + + VehicleEnterEvent enterEvent = new VehicleEnterEvent(eventType, vehicle, hitEntity); + server.getPluginManager().callEvent(enterEvent); + + if (!enterEvent.isCancelled()) { + entity.e((Entity) this); + } + } } + // CraftBukkit end double d0 = entity.locX - this.locX; double d1 = entity.locZ - this.locZ; double d2 = d0 * d0 + d1 * d1; - if (d2 >= 9.999999747378752E-5D) { + // CraftBukkit - Collision + if (d2 >= 9.9999997473787516E-005D && !collsionEvent.isCollisionCancelled()) { d2 = (double) MathHelper.a(d2); d0 /= d2; d1 /= d2; |