SPIGOT-5510: VehicleBlockCollisionEvent returns the wrong block

This commit is contained in:
md_5 2020-01-15 15:05:30 +11:00
parent ec4b2b5ef1
commit 752cf95e37

View file

@ -214,13 +214,13 @@
+ Vehicle vehicle = (Vehicle) this.getBukkitEntity(); + Vehicle vehicle = (Vehicle) this.getBukkitEntity();
+ org.bukkit.block.Block bl = this.world.getWorld().getBlockAt(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)); + org.bukkit.block.Block bl = this.world.getWorld().getBlockAt(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ));
+ +
+ if (vec3d1.x > vec3d.x) { + if (vec3d.x > vec3d1.x) {
+ bl = bl.getRelative(BlockFace.EAST); + bl = bl.getRelative(BlockFace.EAST);
+ } else if (vec3d.x < vec3d.x) { + } else if (vec3d.x < vec3d1.x) {
+ bl = bl.getRelative(BlockFace.WEST); + bl = bl.getRelative(BlockFace.WEST);
+ } else if (vec3d1.z > vec3d.z) { + } else if (vec3d.z > vec3d1.z) {
+ bl = bl.getRelative(BlockFace.SOUTH); + bl = bl.getRelative(BlockFace.SOUTH);
+ } else if (vec3d1.z < vec3d.z) { + } else if (vec3d.z < vec3d1.z) {
+ bl = bl.getRelative(BlockFace.NORTH); + bl = bl.getRelative(BlockFace.NORTH);
+ } + }
+ +