SteamWar/BauSystem2.0
Archiviert
12
0

Setup Record for Simulator use and Trace use
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
yoyosource 2023-09-06 21:27:21 +02:00
Ursprung 853aae1b8e
Commit 12d0ecbf0e
5 geänderte Dateien mit 18 neuen und 15 gelöschten Zeilen

Datei anzeigen

@ -81,14 +81,14 @@ public abstract class AutoTraceRecorder implements TraceRecorder {
startRecording();
}
if (recording) {
getRecord(tntPrimed).source(tntPrimed);
getRecord(tntPrimed).source(tntPrimed.getLocation().toVector(), tntPrimed.getVelocity(), tntPrimed.getFuseTicks());
}
}
@Override
public final void tick(TNTPrimed tntPrimed) {
if (recording) {
getRecord(tntPrimed).location(tntPrimed);
getRecord(tntPrimed).location(tntPrimed.getLocation().toVector(), tntPrimed.getVelocity(), tntPrimed.getFuseTicks());
}
}
@ -100,7 +100,7 @@ public abstract class AutoTraceRecorder implements TraceRecorder {
if (recording) {
Record.TNTRecord tntRecord = getRecord(tntPrimed);
if (inBuildRegion) tntRecord.setInBuildArea(true);
tntRecord.explode(tntPrimed);
tntRecord.explode(tntPrimed.getLocation().toVector(), tntPrimed.getVelocity(), tntPrimed.getFuseTicks());
}
lastExplosion = 0;
}

Datei anzeigen

@ -22,6 +22,7 @@ package de.steamwar.bausystem.features.tracer.record;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.features.tracer.show.Record;
import de.steamwar.bausystem.features.tracer.show.StoredRecords;
import de.steamwar.bausystem.features.tracer.show.TraceShowManager;
import de.steamwar.bausystem.region.Region;
import de.steamwar.bausystem.region.utils.RegionExtensionType;
import de.steamwar.bausystem.region.utils.RegionType;
@ -100,7 +101,7 @@ public class Recorder implements Listener {
public void set(Region region, TraceRecorder traceRecorder) {
regionTraceRecorderMap.put(region, traceRecorder);
traceRecorder.recordSupplier(() -> {
Record record = new Record(region);
Record record = new Record(region, TraceShowManager::show);
StoredRecords.add(region, record);
return record;
});

Datei anzeigen

@ -56,19 +56,19 @@ public class SimpleTraceRecorder implements TraceRecorder, ActiveTracer {
@Override
public void spawn(TNTPrimed tntPrimed) {
getRecord(tntPrimed).source(tntPrimed);
getRecord(tntPrimed).source(tntPrimed.getLocation().toVector(), tntPrimed.getVelocity(), tntPrimed.getFuseTicks());
}
@Override
public void tick(TNTPrimed tntPrimed) {
getRecord(tntPrimed).location(tntPrimed);
getRecord(tntPrimed).location(tntPrimed.getLocation().toVector(), tntPrimed.getVelocity(), tntPrimed.getFuseTicks());
}
@Override
public void explode(TNTPrimed tntPrimed, boolean inBuildRegion) {
Record.TNTRecord tntRecord = getRecord(tntPrimed);
if (inBuildRegion) tntRecord.setInBuildArea(true);
tntRecord.explode(tntPrimed);
tntRecord.explode(tntPrimed.getLocation().toVector(), tntPrimed.getVelocity(), tntPrimed.getFuseTicks());
recordMap.remove(tntPrimed);
}

Datei anzeigen

@ -31,6 +31,7 @@ import org.bukkit.util.Vector;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import java.util.function.BiConsumer;
@RequiredArgsConstructor
public class Record {
@ -38,6 +39,7 @@ public class Record {
@Getter
private final List<TNTRecord> tnt = new ArrayList<>();
private final Region region;
private final BiConsumer<Region, TNTPosition> showFunction;
public int size() {
return tnt.size();
@ -102,16 +104,16 @@ public class Record {
this.region = region;
}
public void source(TNTPrimed tntPrimed) {
add(tntPrimed.getLocation().toVector(), tntPrimed.getVelocity(), tntPrimed.getFuseTicks(), true, false);
public void source(Vector location, Vector velocity, int fuseTicks) {
add(location, velocity, fuseTicks, true, false);
}
public void location(TNTPrimed tntPrimed) {
add(tntPrimed.getLocation().toVector(), tntPrimed.getVelocity(), tntPrimed.getFuseTicks(), false, false);
public void location(Vector location, Vector velocity, int fuseTicks) {
add(location, velocity, fuseTicks, false, false);
}
public void explode(TNTPrimed tntPrimed) {
add(tntPrimed.getLocation().toVector(), tntPrimed.getVelocity(), tntPrimed.getFuseTicks(), false, true);
public void explode(Vector location, Vector velocity, int fuseTicks) {
add(location, velocity, fuseTicks, false, true);
record.checkMicroMotion();
}
@ -125,7 +127,7 @@ public class Record {
position = new TNTPosition(this, location, fuseTicks, positions.get(positions.size() - 1).getLocation(), velocity, lastVelocity, source, exploded);
}
positions.add(position);
TraceShowManager.show(region, position);
record.showFunction.accept(region, position);
}
}
}

Datei anzeigen

@ -90,7 +90,7 @@ public class TraceShowManager implements Listener {
}
/* Only to be called by record */
static void show(Region region, TNTPosition tnt) {
public static void show(Region region, TNTPosition tnt) {
Map<Player, ShowMode<TNTPosition>> regionalShowModes = showModes.get(region);
if (regionalShowModes == null) {
return;