SteamWar/BauSystem2.0
Archiviert
12
0

Changed Record id from uuid to incremental int
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed

Dieser Commit ist enthalten in:
D4rkr34lm 2024-03-19 16:09:32 +01:00
Ursprung 10a63f1876
Commit 5a59578a66
2 geänderte Dateien mit 11 neuen und 4 gelöschten Zeilen

Datei anzeigen

@ -68,6 +68,11 @@ public class Recorder implements Listener {
*/ */
private final Map<TNTPrimed, List<TNTRecord>> historyMap = new HashMap<>(); private final Map<TNTPrimed, List<TNTRecord>> historyMap = new HashMap<>();
/**
* Maps Traces to their next open unique TNTRecord id
*/
private final Map<Trace, Integer> nextOpenTNTRecordIdMap = new HashMap<>();
/** /**
* Regions where auto-trace is enabled * Regions where auto-trace is enabled
*/ */
@ -111,6 +116,7 @@ public class Recorder implements Listener {
Trace trace = new Trace(region); Trace trace = new Trace(region);
noExplosionRecorded.add(trace); noExplosionRecorded.add(trace);
activeTraces.put(region, trace); activeTraces.put(region, trace);
nextOpenTNTRecordIdMap.put(trace, 0);
return manager.add(trace); return manager.add(trace);
} }
@ -152,11 +158,12 @@ public class Recorder implements Listener {
*/ */
private void record(TNTPrimed tntPrimed, Trace trace, List<Block> destroyedBlocks){ private void record(TNTPrimed tntPrimed, Trace trace, List<Block> destroyedBlocks){
List<TNTRecord> history = historyMap.getOrDefault(tntPrimed, new ArrayList<>()); List<TNTRecord> history = historyMap.getOrDefault(tntPrimed, new ArrayList<>());
UUID tntID; int tntID;
if(history.size() == 0){ if(history.size() == 0){
historyMap.put(tntPrimed, history); historyMap.put(tntPrimed, history);
tntID = UUID.randomUUID(); tntID = nextOpenTNTRecordIdMap.get(trace);
nextOpenTNTRecordIdMap.put(trace, tntID + 1);
} }
else else
tntID = history.get(0).getTntId(); tntID = history.get(0).getTntId();

Datei anzeigen

@ -38,7 +38,7 @@ public class TNTRecord {
/** /**
* Unique number to identify records being of the same tnt * Unique number to identify records being of the same tnt
*/ */
private final UUID tntId; private final int tntId;
/** /**
* Whether this is a record of a tnt explosion or an entity * Whether this is a record of a tnt explosion or an entity
@ -90,7 +90,7 @@ public class TNTRecord {
*/ */
private final List<TNTRecord> history; private final List<TNTRecord> history;
public TNTRecord(UUID tntId, TNTPrimed tnt, boolean explosion, boolean afterFirstExplosion, long ticksSinceStart, List<TNTRecord> history, List<Block> destroyedBlocks){ public TNTRecord(int tntId, TNTPrimed tnt, boolean explosion, boolean afterFirstExplosion, long ticksSinceStart, List<TNTRecord> history, List<Block> destroyedBlocks){
this.tntId = tntId; this.tntId = tntId;
this.explosion = explosion; this.explosion = explosion;
this.inWater = tnt.isInWater(); this.inWater = tnt.isInWater();