From b5fb9a1cd769a0ee1283c47b5b8b54bbf559c9a9 Mon Sep 17 00:00:00 2001 From: md_5 Date: Wed, 12 Oct 2016 19:47:14 +1100 Subject: [PATCH] SPIGOT-2686: Vehicles cannot collide with air --- nms-patches/Entity.patch | 50 +++++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 24 deletions(-) diff --git a/nms-patches/Entity.patch b/nms-patches/Entity.patch index 317706ad61..fdbdb8b0b9 100644 --- a/nms-patches/Entity.patch +++ b/nms-patches/Entity.patch @@ -153,7 +153,7 @@ this.world.methodProfiler.a("move"); double d3 = this.locX; double d4 = this.locY; -@@ -587,6 +694,26 @@ +@@ -587,6 +694,28 @@ block1.a(this.world, this); } @@ -172,15 +172,17 @@ + bl = bl.getRelative(BlockFace.NORTH); + } + -+ VehicleBlockCollisionEvent event = new VehicleBlockCollisionEvent(vehicle, bl); -+ world.getServer().getPluginManager().callEvent(event); ++ if (bl.getType() != org.bukkit.Material.AIR) { ++ VehicleBlockCollisionEvent event = new VehicleBlockCollisionEvent(vehicle, bl); ++ world.getServer().getPluginManager().callEvent(event); ++ } + } + // CraftBukkit end + if (this.playStepSound() && !flag && !this.isPassenger()) { double d21 = this.locX - d3; double d22 = this.locY - d4; -@@ -618,6 +745,8 @@ +@@ -618,6 +747,8 @@ } } @@ -189,7 +191,7 @@ try { this.checkBlockCollisions(); } catch (Throwable throwable) { -@@ -627,6 +756,8 @@ +@@ -627,6 +758,8 @@ this.appendEntityCrashDetails(crashreportsystemdetails); throw new ReportedException(crashreport); } @@ -198,7 +200,7 @@ boolean flag2 = this.ai(); -@@ -635,7 +766,14 @@ +@@ -635,7 +768,14 @@ if (!flag2) { ++this.fireTicks; if (this.fireTicks == 0) { @@ -214,7 +216,7 @@ } } } else if (this.fireTicks <= 0) { -@@ -756,7 +894,7 @@ +@@ -756,7 +896,7 @@ return null; } @@ -223,7 +225,7 @@ if (!this.fireProof) { this.damageEntity(DamageSource.FIRE, (float) i); } -@@ -922,6 +1060,13 @@ +@@ -922,6 +1062,13 @@ } public void spawnIn(World world) { @@ -237,7 +239,7 @@ this.world = world; } -@@ -1126,6 +1271,18 @@ +@@ -1126,6 +1273,18 @@ try { nbttagcompound.set("Pos", this.a(new double[] { this.locX, this.locY, this.locZ})); nbttagcompound.set("Motion", this.a(new double[] { this.motX, this.motY, this.motZ})); @@ -256,7 +258,7 @@ nbttagcompound.set("Rotation", this.a(new float[] { this.yaw, this.pitch})); nbttagcompound.setFloat("FallDistance", this.fallDistance); nbttagcompound.setShort("Fire", (short) this.fireTicks); -@@ -1135,6 +1292,12 @@ +@@ -1135,6 +1294,12 @@ nbttagcompound.setBoolean("Invulnerable", this.invulnerable); nbttagcompound.setInt("PortalCooldown", this.portalCooldown); nbttagcompound.a("UUID", this.getUniqueID()); @@ -269,7 +271,7 @@ if (this.getCustomName() != null && !this.getCustomName().isEmpty()) { nbttagcompound.setString("CustomName", this.getCustomName()); } -@@ -1210,6 +1373,8 @@ +@@ -1210,6 +1375,8 @@ this.motX = nbttaglist1.e(0); this.motY = nbttaglist1.e(1); this.motZ = nbttaglist1.e(2); @@ -278,7 +280,7 @@ if (Math.abs(this.motX) > 10.0D) { this.motX = 0.0D; } -@@ -1221,6 +1386,7 @@ +@@ -1221,6 +1388,7 @@ if (Math.abs(this.motZ) > 10.0D) { this.motZ = 0.0D; } @@ -286,7 +288,7 @@ this.locX = nbttaglist.e(0); this.locY = nbttaglist.e(1); -@@ -1278,6 +1444,58 @@ +@@ -1278,6 +1446,58 @@ this.setPosition(this.locX, this.locY, this.locZ); } @@ -345,7 +347,7 @@ } catch (Throwable throwable) { CrashReport crashreport = CrashReport.a(throwable, "Loading entity NBT"); CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Entity being loaded"); -@@ -1337,6 +1555,12 @@ +@@ -1337,6 +1557,12 @@ public EntityItem a(ItemStack itemstack, float f) { if (itemstack.count != 0 && itemstack.getItem() != null) { @@ -358,7 +360,7 @@ EntityItem entityitem = new EntityItem(this.world, this.locX, this.locY + (double) f, this.locZ, itemstack); entityitem.q(); -@@ -1458,6 +1682,24 @@ +@@ -1458,6 +1684,24 @@ if (entity.bB() != this) { throw new IllegalStateException("Use x.startRiding(y), not y.addPassenger(x)"); } else { @@ -383,7 +385,7 @@ if (!this.world.isClientSide && entity instanceof EntityHuman && !(this.bw() instanceof EntityHuman)) { this.passengers.add(0, entity); } else { -@@ -1471,6 +1713,22 @@ +@@ -1471,6 +1715,22 @@ if (entity.bB() == this) { throw new IllegalStateException("Use x.stopRiding(y), not y.removePassenger(x)"); } else { @@ -406,7 +408,7 @@ this.passengers.remove(entity); entity.j = 60; } -@@ -1610,14 +1868,48 @@ +@@ -1610,14 +1870,48 @@ } public void setAirTicks(int i) { @@ -458,7 +460,7 @@ } } -@@ -1752,19 +2044,67 @@ +@@ -1752,19 +2046,67 @@ if (!this.world.isClientSide && !this.dead) { this.world.methodProfiler.a("changeDimension"); MinecraftServer minecraftserver = this.h(); @@ -529,7 +531,7 @@ BlockPosition blockposition; if (i == 1) { -@@ -1793,12 +2133,18 @@ +@@ -1793,12 +2135,18 @@ blockposition = new BlockPosition(this); } @@ -549,7 +551,7 @@ if (j == 1 && i == 1) { BlockPosition blockposition1 = worldserver1.q(worldserver1.getSpawn()); -@@ -1806,6 +2152,7 @@ +@@ -1806,6 +2154,7 @@ } else { entity.setPositionRotation(blockposition, entity.yaw, entity.pitch); } @@ -557,7 +559,7 @@ boolean flag = entity.attachedToPlayer; -@@ -1813,6 +2160,14 @@ +@@ -1813,6 +2162,14 @@ worldserver1.addEntity(entity); entity.attachedToPlayer = flag; worldserver1.entityJoinedWorld(entity, false); @@ -572,7 +574,7 @@ } this.dead = true; -@@ -1923,6 +2278,11 @@ +@@ -1923,6 +2280,11 @@ } public void setCustomName(String s) { @@ -584,7 +586,7 @@ this.datawatcher.set(Entity.aA, s); } -@@ -1980,7 +2340,26 @@ +@@ -1980,7 +2342,26 @@ } public void a(AxisAlignedBB axisalignedbb) { @@ -612,7 +614,7 @@ } public float getHeadHeight() { -@@ -2154,7 +2533,7 @@ +@@ -2154,7 +2535,7 @@ for (Iterator iterator = this.bx().iterator(); iterator.hasNext(); entity.a(oclass, set)) { entity = (Entity) iterator.next(); if (oclass.isAssignableFrom(entity.getClass())) {