Update TNT directional bias patch

Includes work by SportBukkit - Thanks guys
This commit is contained in:
Zach Brown 2014-07-08 16:31:38 -05:00
parent e75a3020e5
commit 8d8bbf09ec
3 changed files with 58 additions and 32 deletions

View File

@ -1,14 +1,14 @@
From d95bbdf079e933361de7873e910f52520b57e66d Mon Sep 17 00:00:00 2001
From 50896e297f346e1e55553205e6bcdd0640013067 Mon Sep 17 00:00:00 2001
From: Zach Brown <Zbob750@live.com>
Date: Wed, 2 Jul 2014 22:26:16 -0500
Subject: [PATCH] PaperSpigot config files
diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java
index 62d5847..a11d45a 100644
index 62f4aa9..51968d1 100644
--- a/src/main/java/net/minecraft/server/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/DedicatedServer.java
@@ -114,6 +114,10 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
@@ -115,6 +115,10 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
org.spigotmc.SpigotConfig.init();
org.spigotmc.SpigotConfig.registerCommands();
// Spigot end
@ -20,7 +20,7 @@ index 62d5847..a11d45a 100644
i.info("Generating keypair");
this.a(MinecraftEncryption.b());
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index cb6efc0..a0a1dd1 100644
index 2df7bfb..07eeb2b 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -197,6 +197,7 @@ public abstract class World implements IBlockAccess {

View File

@ -1,28 +0,0 @@
From cd40518ae7eabae3633be74ed13f491158884586 Mon Sep 17 00:00:00 2001
From: Iceee <andrew@opticgaming.tv>
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 a442cb1..742e731 100644
--- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java
+++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
@@ -19,11 +19,11 @@ 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;
--
1.9.1

View File

@ -0,0 +1,54 @@
From 94d24a568e63591ca653be2a2e248b8520eb740a Mon Sep 17 00:00:00 2001
From: Zach Brown <Zbob750@live.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 a442cb1..252ed04 100644
--- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java
+++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
@@ -19,11 +19,11 @@ 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 3bb1302..9b10da7 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -1895,6 +1895,12 @@ 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;
@@ -1907,7 +1913,7 @@ 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;
}
--
1.9.1