From 6b468690bbb987fc9d36b6323862089241b1a0f0 Mon Sep 17 00:00:00 2001 From: Zach Brown <1254957+zachbr@users.noreply.github.com> Date: Tue, 8 Jul 2014 16:31:38 -0500 Subject: [PATCH] Update TNT directional bias patch Includes work by SportBukkit - Thanks guys --- .../0017-Actually-fix-TNT-movement.patch | 26 ---------- .../0017-Fix-directional-TNT-bias.patch | 52 +++++++++++++++++++ 2 files changed, 52 insertions(+), 26 deletions(-) delete mode 100644 CraftBukkit-Patches/0017-Actually-fix-TNT-movement.patch create mode 100644 CraftBukkit-Patches/0017-Fix-directional-TNT-bias.patch diff --git a/CraftBukkit-Patches/0017-Actually-fix-TNT-movement.patch b/CraftBukkit-Patches/0017-Actually-fix-TNT-movement.patch deleted file mode 100644 index dd3e8c49b..000000000 --- a/CraftBukkit-Patches/0017-Actually-fix-TNT-movement.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Iceee -Date: Tue, 24 Jun 2014 00:03:34 -0500 -Subject: [PATCH] Actually fix TNT movement - - -diff --git a/src/main/java/net/minecraft/server/EntityTNTPrimed.java b/src/main/java/net/minecraft/server/EntityTNTPrimed.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java -+++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java -@@ -0,0 +0,0 @@ public class EntityTNTPrimed extends Entity { - public EntityTNTPrimed(World world, double d0, double d1, double d2, EntityLiving entityliving) { - this(world); - this.setPosition(d0, d1, d2); -- float f = (float) (Math.random() * 3.1415927410125732D * 2.0D); -+ // float f = (float) (Math.random() * 3.1415927410125732D * 2.0D); // PaperSpigot - -- this.motX = (double) (-((float) Math.sin((double) f)) * 0.02F); -+ this.motX = 0; // PaperSpigot - Fix TNT movement // (double) (-((float) Math.sin((double) f)) * 0.02F); - this.motY = 0.20000000298023224D; -- this.motZ = (double) (-((float) Math.cos((double) f)) * 0.02F); -+ this.motZ = 0; // PaperSpigot - Fix TNT movement // (double) (-((float) Math.cos((double) f)) * 0.02F); - this.fuseTicks = 80; - this.lastX = d0; - this.lastY = d1; --- \ No newline at end of file diff --git a/CraftBukkit-Patches/0017-Fix-directional-TNT-bias.patch b/CraftBukkit-Patches/0017-Fix-directional-TNT-bias.patch new file mode 100644 index 000000000..b1b83a879 --- /dev/null +++ b/CraftBukkit-Patches/0017-Fix-directional-TNT-bias.patch @@ -0,0 +1,52 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Zach Brown <1254957+zachbr@users.noreply.github.com> +Date: Tue, 8 Jul 2014 16:29:49 -0500 +Subject: [PATCH] Fix directional TNT bias + + +diff --git a/src/main/java/net/minecraft/server/EntityTNTPrimed.java b/src/main/java/net/minecraft/server/EntityTNTPrimed.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java ++++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java +@@ -0,0 +0,0 @@ public class EntityTNTPrimed extends Entity { + public EntityTNTPrimed(World world, double d0, double d1, double d2, EntityLiving entityliving) { + this(world); + this.setPosition(d0, d1, d2); +- float f = (float) (Math.random() * 3.1415927410125732D * 2.0D); ++ //float f = (float) (Math.random() * 3.1415927410125732D * 2.0D); // PaperSpigot - Fix directional TNT bias + +- this.motX = (double) (-((float) Math.sin((double) f)) * 0.02F); ++ this.motX = // PaperSpigot - Fix directional TNT bias //(double) (-((float) Math.sin((double) f)) * 0.02F); + this.motY = 0.20000000298023224D; +- this.motZ = (double) (-((float) Math.cos((double) f)) * 0.02F); ++ this.motZ = // PaperSpigot - Fix directional TNT bias //(double) (-((float) Math.cos((double) f)) * 0.02F); + this.fuseTicks = 80; + this.lastX = d0; + this.lastY = d1; +diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/World.java ++++ b/src/main/java/net/minecraft/server/World.java +@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { + double d1 = 1.0D / ((axisalignedbb.e - axisalignedbb.b) * 2.0D + 1.0D); + double d2 = 1.0D / ((axisalignedbb.f - axisalignedbb.c) * 2.0D + 1.0D); + ++ // PaperSpigot start - Fix directional TNT bias ++ // Shift the sample points so they are centered on the BB, to avoid directional bias ++ double xOffset = (1.0 - Math.floor(1.0 / d0) * d0) / 2.0; ++ double zOffset = (1.0 - Math.floor(1.0 / d2) * d2) / 2.0; ++ // PaperSpigot end ++ + if (d0 >= 0.0D && d1 >= 0.0D && d2 >= 0.0D) { + int i = 0; + int j = 0; +@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { + double d4 = axisalignedbb.b + (axisalignedbb.e - axisalignedbb.b) * (double) f1; + double d5 = axisalignedbb.c + (axisalignedbb.f - axisalignedbb.c) * (double) f2; + +- if (this.a(vec3d2.b(d3, d4, d5), vec3d) == null) { // CraftBukkit ++ if (this.a(vec3d2.b(xOffset + d3, d4, zOffset + d5), vec3d) == null) { // PaperSpigot - Fix directional TNT bias // CraftBukkit + ++i; + } + +-- \ No newline at end of file