diff --git a/BauSystem_19/src/de/steamwar/bausystem/features/simulator/Simulator19.java b/BauSystem_19/src/de/steamwar/bausystem/features/simulator/Simulator19.java index 96a8d382..2c0bb8eb 100644 --- a/BauSystem_19/src/de/steamwar/bausystem/features/simulator/Simulator19.java +++ b/BauSystem_19/src/de/steamwar/bausystem/features/simulator/Simulator19.java @@ -27,10 +27,7 @@ import org.bukkit.util.BoundingBox; import org.bukkit.util.Vector; import org.bukkit.util.VoxelShape; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; +import java.util.*; public class Simulator19 implements Simulator { @@ -42,11 +39,23 @@ public class Simulator19 implements Simulator { @Override public synchronized void run() { - TNT tnt = new TNT(0, 120, 0); - do { - System.out.println(tnt); - } while (!tnt.tick()); - System.out.println(tnt); + List tntList = new ArrayList<>(); + for (int i = 0; i < 400; i++) { + tntList.add(new TNT(0, 120, 0)); + } + long time = System.currentTimeMillis(); + while (!tntList.isEmpty()) { + List remove = new ArrayList<>(); + for (TNT tnt : tntList) { + if (tnt.getFuse() == 0) { + remove.add(tnt); + continue; + } + tnt.tick(); + } + tntList.removeAll(remove); + } + System.out.println("Time: " + (System.currentTimeMillis() - time) + "ms"); BLOCK_TYPES_MAP.clear(); BLOCK_DATA_MAP.clear();