Fix TNT directional bias
Shift the sample points so they are centered on the entity, eliminating the directional bias of the explosion force
This commit is contained in:
parent
dca3a3b021
commit
2449df7cdf
@ -1,28 +1,35 @@
|
|||||||
From 5976ecf2a73580d4526173250e84235e7688f509 Mon Sep 17 00:00:00 2001
|
From 5aa603e9bc6cc1079676e6954ec220f9485755f5 Mon Sep 17 00:00:00 2001
|
||||||
From: Zach Brown <Zbob750@live.com>
|
From: Jedediah Smith <jedediah@silencegreys.com>
|
||||||
Date: Fri, 11 Jul 2014 03:54:06 -0500
|
Date: Wed, 6 Aug 2014 18:17:41 -0400
|
||||||
Subject: [PATCH] Fix directional TNT bias
|
Subject: [PATCH] Fix directional TNT bias
|
||||||
|
|
||||||
|
More information at https://bugs.mojang.com/browse/MC-65697
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/EntityTNTPrimed.java b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
|
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||||
index 13cbc79..8ca4300 100644
|
index a204966..10ce450 100644
|
||||||
--- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java
|
--- a/src/main/java/net/minecraft/server/World.java
|
||||||
+++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
|
+++ b/src/main/java/net/minecraft/server/World.java
|
||||||
@@ -19,11 +19,11 @@ public class EntityTNTPrimed extends Entity {
|
@@ -1893,6 +1893,12 @@ public abstract class World implements IBlockAccess {
|
||||||
public EntityTNTPrimed(World world, double d0, double d1, double d2, EntityLiving entityliving) {
|
double d1 = 1.0D / ((axisalignedbb.e - axisalignedbb.b) * 2.0D + 1.0D);
|
||||||
this(world);
|
double d2 = 1.0D / ((axisalignedbb.f - axisalignedbb.c) * 2.0D + 1.0D);
|
||||||
this.setPosition(d0, d1, d2);
|
|
||||||
- float f = (float) (Math.random() * 3.1415927410125732D * 2.0D);
|
+ // PaperSpigot start - Fix TNT directional bias
|
||||||
+ //float f = (float) (Math.random() * 3.1415927410125732D * 2.0D); // PaperSpigot - 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;
|
||||||
|
@@ -1905,7 +1911,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) { // CraftBukkit // PaperSpigot
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
|
||||||
- this.motX = (double) (-((float) Math.sin((double) f)) * 0.02F);
|
|
||||||
+ this.motX = 0; // 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 = 0; // PaperSpigot - Fix directional TNT bias //(double) (-((float) Math.cos((double) f)) * 0.02F);
|
|
||||||
this.fuseTicks = 80;
|
|
||||||
this.lastX = d0;
|
|
||||||
this.lastY = d1;
|
|
||||||
--
|
--
|
||||||
1.9.1
|
1.9.1
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user