Implemented VEHICLE_COLLISION_BLOCK

Dieser Commit ist enthalten in:
Dinnerbone 2011-01-31 22:25:27 +00:00
Ursprung 82febb3887
Commit 6f13c9dc55

Datei anzeigen

@ -11,6 +11,10 @@ import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import java.util.List; import java.util.List;
import java.util.Random; 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 { public abstract class Entity {
@ -470,6 +474,27 @@ public abstract class Entity {
int i1; int i1;
int j1; 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) { if (this.M && !flag) {
this.L = (float) ((double) this.L + (double) MathHelper.a(d9 * d9 + d10 * d10) * 0.6D); this.L = (float) ((double) this.L + (double) MathHelper.a(d9 * d9 + d10 * d10) * 0.6D);
l = MathHelper.b(this.locX); l = MathHelper.b(this.locX);