diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/Record.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/Record.java index 08bc6561..82844113 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/Record.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/Record.java @@ -48,7 +48,7 @@ public class Record { } public TNTRecord spawn(long offset) { - TNTRecord record = new TNTRecord(offset, region); + TNTRecord record = new TNTRecord(this, offset, region); tnt.add(record); return record; } @@ -57,11 +57,26 @@ public class Record { tnt.clear(); } + private void checkMicroMotion() { + for (TNTRecord tntRecord : tnt) { + List positions = tntRecord.positions; + if (positions.isEmpty()) continue; + TNTPosition position = positions.get(positions.size() - 1); + + Vector velocity = position.getVelocity(); + if (velocity.getY() == 0 && (velocity.getX() != 0 || velocity.getZ() != 0) && (Math.abs(velocity.getX()) < 0.001 || Math.abs(velocity.getZ()) < 0.001)) { + tntRecord.hasMicroMotion = true; + } + } + } + public static class TNTRecord { @Getter private final UUID id = UUID.randomUUID(); + private Record record; + @Getter private final long offset; @@ -78,7 +93,8 @@ public class Record { @Getter private boolean hasMicroMotion = false; - public TNTRecord(long offset, Region region) { + public TNTRecord(Record record, long offset, Region region) { + this.record = record; this.offset = offset; this.region = region; } @@ -93,11 +109,7 @@ public class Record { public void explode(TNTPrimed tntPrimed) { add(tntPrimed, false, true); - Vector velocity = tntPrimed.getVelocity(); - if (velocity.getY() != 0) return; - if (velocity.getX() > 0.001 || velocity.getZ() > 0.001) return; - if (velocity.getX() == 0 && velocity.getZ() == 0) return; - hasMicroMotion = true; + record.checkMicroMotion(); } private void add(TNTPrimed tntPrimed, boolean source, boolean exploded) { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/ShowModeParameterType.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/ShowModeParameterType.java index 897fcff6..a4f83958 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/ShowModeParameterType.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/ShowModeParameterType.java @@ -42,7 +42,7 @@ public enum ShowModeParameterType { COUNT(ShowModeParameter::enableCount, Arrays.asList("-count", "-c"), "TICKS", "TICKS_SINCE_START"), BUILD_DESTROY_ONLY(ShowModeParameter::enableBuildDestroyOnly, Arrays.asList("-builddestroy", "-builddestoryonly"), "WATER"), TICKS_SINCE_START(ShowModeParameter::enableTicksSinceStart, Arrays.asList("-tickssincestart", "-tss"), "TICKS", "COUNT"), - MICROMOTION(ShowModeParameter::enableMicroMotion, Arrays.asList("-micromotion", "-micro", "-m"), "COUNT"), + MICROMOTION(ShowModeParameter::enableMicroMotion, Arrays.asList("-micromotion", "-micro", "-m")), ; @Getter