diff options
author | Dinnerbone <dinnerbone@dinnerbone.com> | 2011-01-31 22:25:27 +0000 |
---|---|---|
committer | Dinnerbone <dinnerbone@dinnerbone.com> | 2011-01-31 22:25:27 +0000 |
commit | 6f13c9dc55ea15dfea0d9eb95f8dc6ee459f7867 (patch) | |
tree | f5ebb8a743ca02709ed0ab47668ad545f50a8037 /src/main/java/net | |
parent | 82febb3887fa1ca3de2fb364ea01b1847964e4d2 (diff) | |
download | craftbukkit-6f13c9dc55ea15dfea0d9eb95f8dc6ee459f7867.tar craftbukkit-6f13c9dc55ea15dfea0d9eb95f8dc6ee459f7867.tar.gz craftbukkit-6f13c9dc55ea15dfea0d9eb95f8dc6ee459f7867.tar.lz craftbukkit-6f13c9dc55ea15dfea0d9eb95f8dc6ee459f7867.tar.xz craftbukkit-6f13c9dc55ea15dfea0d9eb95f8dc6ee459f7867.zip |
Implemented VEHICLE_COLLISION_BLOCK
Diffstat (limited to 'src/main/java/net')
-rw-r--r-- | src/main/java/net/minecraft/server/Entity.java | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java index cbb65852..fb05c527 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java @@ -11,6 +11,10 @@ import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import java.util.List; import java.util.Random; +import org.bukkit.block.BlockFace; +import org.bukkit.entity.Vehicle; +import org.bukkit.event.vehicle.VehicleBlockCollisionEvent; +import org.bukkit.event.vehicle.VehicleCollisionEvent; public abstract class Entity { @@ -470,6 +474,27 @@ public abstract class Entity { int i1; int j1; + // Craftbukkit start + if ((B) && (getBukkitEntity() instanceof Vehicle)) { + Vehicle vehicle = (Vehicle)getBukkitEntity(); + org.bukkit.World wrld = ((WorldServer)world).getWorld(); + org.bukkit.block.Block block = wrld.getBlockAt(MathHelper.b(locX), MathHelper.b(locY - 0.20000000298023224D - (double) this.height), MathHelper.b(locZ)); + + if (d5 > d0) { + block = block.getFace(BlockFace.SOUTH); + } else if (d5 < d0) { + block = block.getFace(BlockFace.NORTH); + } else if (d7 > d2) { + block = block.getFace(BlockFace.WEST); + } else if (d7 < d2) { + block = block.getFace(BlockFace.EAST); + } + + VehicleBlockCollisionEvent event = new VehicleBlockCollisionEvent(Type.VEHICLE_COLLISION_BLOCK, vehicle, block); + ((WorldServer)world).getServer().getPluginManager().callEvent(event); + } + // Craftbukkit end + if (this.M && !flag) { this.L = (float) ((double) this.L + (double) MathHelper.a(d9 * d9 + d10 * d10) * 0.6D); l = MathHelper.b(this.locX); |