mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-03 21:44:40 +01:00
Implemented VEHICLE_COLLISION_BLOCK
This commit is contained in:
parent
82febb3887
commit
6f13c9dc55
1 changed files with 25 additions and 0 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue