SteamWar/BauSystem2.0
Archiviert
12
0

Updated simulator fo new trace api
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed

Dieser Commit ist enthalten in:
D4rkr34lm 2024-03-02 21:35:09 +01:00
Ursprung fccdcb2519
Commit 8aa0ee4d9d

Datei anzeigen

@ -26,15 +26,14 @@ import de.steamwar.bausystem.features.simulator.gui.TNTSimulatorGui;
import de.steamwar.bausystem.features.simulator.tnt.SimulatorElement;
import de.steamwar.bausystem.features.simulator.tnt.TNTElement;
import de.steamwar.bausystem.features.simulator.tnt.TNTGroup;
import de.steamwar.bausystem.features.tracer.record.Recorder;
import de.steamwar.bausystem.features.tracer.record.SingleTraceRecorder;
import de.steamwar.bausystem.features.tracer.Recorder;
import de.steamwar.bausystem.region.Region;
import de.steamwar.bausystem.shared.Pair;
import de.steamwar.bausystem.utils.RayTraceUtils;
import de.steamwar.entity.REntity;
import de.steamwar.entity.REntityServer;
import de.steamwar.linkage.LinkedInstance;
import lombok.Getter;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import yapion.hierarchy.types.YAPIONArray;
@ -56,6 +55,11 @@ public class TNTSimulator {
private List<SimulatorElement> tntElementList = new ArrayList<>();
@LinkedInstance
public Recorder traceRecorder;
private Region autoTraceRegion;
public TNTSimulator() {
}
@ -225,7 +229,8 @@ public class TNTSimulator {
}
});
if (needsAutoTrace.get()) {
Recorder.INSTANCE.set(region, new SingleTraceRecorder());
traceRecorder.startRecording(region);
autoTraceRegion = region;
}
AtomicInteger maxTick = new AtomicInteger(0);
@ -247,7 +252,11 @@ public class TNTSimulator {
AtomicInteger currentTick = new AtomicInteger(0);
BauSystem.runTaskTimer(BauSystem.getInstance(), bukkitTask -> {
int tick = currentTick.get();
if (tick > maxTick.get()) bukkitTask.cancel();
if (tick > maxTick.get()) {
traceRecorder.stopRecording(autoTraceRegion);
autoTraceRegion = null;
bukkitTask.cancel();
}
currentTick.incrementAndGet();
List<List<Pair<Runnable, Integer>>> toSpawnInTick = toSpawn.get(tick);