diff --git a/BauSystem_19/src/de/steamwar/bausystem/features/simulator/preview/Explosion19.java b/BauSystem_19/src/de/steamwar/bausystem/features/simulator/preview/Explosion19.java index be9d9432..241d255b 100644 --- a/BauSystem_19/src/de/steamwar/bausystem/features/simulator/preview/Explosion19.java +++ b/BauSystem_19/src/de/steamwar/bausystem/features/simulator/preview/Explosion19.java @@ -22,7 +22,9 @@ package de.steamwar.bausystem.features.simulator.preview; import org.bukkit.Material; import org.bukkit.block.data.Waterlogged; -import java.util.*; +import java.util.HashSet; +import java.util.Random; +import java.util.Set; public class Explosion19 { @@ -141,7 +143,7 @@ public class Explosion19 { y /= aa; z /= aa; - double ab = getExposure(simulatorData, this.x, this.y, this.z); + double ab = getExposure(simulatorData, currentTNT.getX(), currentTNT.getY(), currentTNT.getZ()); double ac = (1.0 - w) * ab; currentTNT.setVx(currentTNT.getVx() + x * ac); currentTNT.setVy(currentTNT.getVy() + y * ac); @@ -160,18 +162,18 @@ public class Explosion19 { private static final double EXPOSURE_CONSTANT_1 = 1.0 / (SIZE * 2 + 1.0); private static final double EXPOSURE_CONSTANT_2 = (1.0 - Math.floor(1.0 / EXPOSURE_CONSTANT_1) * EXPOSURE_CONSTANT_1) / 2.0; - private static float getExposure(SimulatorData19 simulatorData, double x, double y, double z) { + private float getExposure(SimulatorData19 simulatorData, double x, double y, double z) { float blockMisses = 0; float blockTotal = 0; for (double k = 0.0; k <= 1.0; k += EXPOSURE_CONSTANT_1) { for (double l = 0.0; l <= 1.0; l += EXPOSURE_CONSTANT_1) { for (double m = 0.0; m <= 1.0; m += EXPOSURE_CONSTANT_1) { - double dx = lerp(k, MIN_POINT, MAX_POINT) + EXPOSURE_CONSTANT_2; - double dy = lerp(l, 0.0, SIZE); - double dz = lerp(m, MIN_POINT, MAX_POINT) + EXPOSURE_CONSTANT_2; + double dx = lerp(k, MIN_POINT, MAX_POINT) + EXPOSURE_CONSTANT_2 + x; + double dy = lerp(l, 0.0, SIZE) + y; + double dz = lerp(m, MIN_POINT, MAX_POINT) + EXPOSURE_CONSTANT_2 + z; - if (rayTrace(simulatorData, x, y, z, dx, dy, dz)) { + if (rayTrace(simulatorData, dx, dy, dz, this.x, this.y, this.z)) { blockMisses++; } blockTotal++; diff --git a/BauSystem_19/src/de/steamwar/bausystem/features/simulator/preview/TNT19.java b/BauSystem_19/src/de/steamwar/bausystem/features/simulator/preview/TNT19.java index 2f67219a..5d7c7287 100644 --- a/BauSystem_19/src/de/steamwar/bausystem/features/simulator/preview/TNT19.java +++ b/BauSystem_19/src/de/steamwar/bausystem/features/simulator/preview/TNT19.java @@ -79,8 +79,13 @@ public class TNT19 { this.vy *= 0.98; this.vz *= 0.98; - this.fuse--; - if (this.fuse <= 0) { + if (onGround) { + this.vx *= 0.7; + this.vy *= -0.5; + this.vz *= 0.7; + } + + if (this.fuse-- <= 0) { Explosion19 explosion = new Explosion19(this, x, y + 0.98 * 0.0625, z); explosion.calculate(simulatorData); return true; @@ -103,7 +108,7 @@ public class TNT19 { // System.out.println(movement + " " + vec3d); double lengthSquared = vec3d.lengthSquared(); if (lengthSquared > 1.0E-7) { - if (fallDistance != 0.0F) { + if (fallDistance != 0.0F && lengthSquared >= 1.0) { // TODO: This could be wrong MovingObjectPosition movingObjectPosition = ((CraftWorld) Simulator19.WORLD).getHandle().a(new RayTrace(new Vec3D(x, y, z), new Vec3D(x + vec3d.getX(), y + vec3d.getY(), z + vec3d.getZ()), RayTrace.BlockCollisionOption.d, RayTrace.FluidCollisionOption.d, null)); if (movingObjectPosition.c() != MovingObjectPosition.EnumMovingObjectType.a) { @@ -205,6 +210,9 @@ public class TNT19 { private void fall(double heightDifference, boolean onGround) { if (onGround) { + if (fallDistance > 0.0F) { + // TODO: onLandedUpon + } this.onLanding(); } else if (heightDifference < 0.0) { this.fallDistance -= (float)heightDifference;