geforkt von Mirrors/Paper
Fix double overflow/underflow calculations with explosions. Fixes BUKKIT-1865
Dieser Commit ist enthalten in:
Ursprung
412b7eaa12
Commit
f5b6abfae1
@ -108,17 +108,26 @@ public class Explosion {
|
||||
|
||||
for (int k2 = 0; k2 < list.size(); ++k2) {
|
||||
Entity entity = (Entity) list.get(k2);
|
||||
double d7 = entity.f(this.posX, this.posY, this.posZ) / (double) this.size;
|
||||
// CraftBukkit - start
|
||||
d0 = entity.locX - this.posX;
|
||||
d1 = entity.locY - this.posY;
|
||||
d2 = entity.locZ - this.posZ;
|
||||
double d8 = Math.sqrt(d0 * d0 + d1 * d1 + d2 * d2);
|
||||
|
||||
double d7 = d8 / this.size; // Don't call sub-method and sqrt again
|
||||
|
||||
if (d7 <= 1.0D) {
|
||||
d0 = entity.locX - this.posX;
|
||||
d1 = entity.locY - this.posY;
|
||||
d2 = entity.locZ - this.posZ;
|
||||
double d8 = Math.sqrt(d0 * d0 + d1 * d1 + d2 * d2); // CraftBukkit
|
||||
|
||||
d0 /= d8;
|
||||
d1 /= d8;
|
||||
d2 /= d8;
|
||||
// Moved calculations up
|
||||
if (d8 != 0) {
|
||||
d0 /= d8;
|
||||
d1 /= d8;
|
||||
d2 /= d8;
|
||||
} else { // Compensate for underflow
|
||||
d0 = 0d;
|
||||
d1 = 0d;
|
||||
d2 = 0d;
|
||||
}
|
||||
// CraftBukkit - end
|
||||
double d9 = (double) this.world.a(vec3d, entity.boundingBox);
|
||||
double d10 = (1.0D - d7) * d9;
|
||||
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren