Add optimistic recalc on block break and place
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
Ursprung
7e2780f326
Commit
2774b29342
@ -96,7 +96,7 @@ public class Simulator19 implements Simulator {
|
||||
System.out.println("Time: " + (System.currentTimeMillis() - time) + "ms " + simulatorData.blockTypesMap.size() + "/" + simulatorData.blockDataMap.size() + "/" + simulatorData.collisionDataMap.size() + "/" + simulatorData.airBlocks.size() + " " + recordMap.size());
|
||||
if (simulatorData.tntList.isEmpty() && currentTick > toCalculate.getKey()) {
|
||||
previewRecord.setDestroyedBlocks(simulatorData.airBlocks());
|
||||
previewRecord.setAccessedBlocks(vector -> true);
|
||||
previewRecord.setAccessedBlocks(simulatorData.accessedBlocks());
|
||||
consumer.accept(previewRecord);
|
||||
cancel();
|
||||
}
|
||||
|
@ -26,6 +26,7 @@ import org.bukkit.util.Vector;
|
||||
import org.bukkit.util.VoxelShape;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class SimulatorData {
|
||||
@ -95,11 +96,18 @@ public class SimulatorData {
|
||||
collisionDataMap.remove(pos);
|
||||
}
|
||||
|
||||
public void clearBlocks(Set<Pos> poss) { // TODO: Optimize
|
||||
public void clearBlocks(Set<Pos> poss) {
|
||||
poss.forEach(this::clearBlock);
|
||||
}
|
||||
|
||||
public Set<Vector> airBlocks() {
|
||||
return airBlocks.stream().map(pos -> new Vector(pos.x, pos.y, pos.z)).collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
public Predicate<Vector> accessedBlocks() {
|
||||
return vector -> {
|
||||
Pos pos = new Pos(vector.getBlockX(), vector.getBlockY(), vector.getBlockZ());
|
||||
return airBlocks.contains(pos) || blockTypesMap.containsKey(pos) || blockDataMap.containsKey(pos) || collisionDataMap.containsKey(pos);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren