add debug info to the updater

This commit is contained in:
Julian Krings
2024-07-21 15:25:31 +02:00
parent af80f882da
commit f8f0a65f0a
3 changed files with 76 additions and 84 deletions
@@ -74,6 +74,7 @@ import java.util.zip.GZIPOutputStream;
@Decree(name = "Developer", origin = DecreeOrigin.BOTH, description = "Iris World Manager", aliases = {"dev"}) @Decree(name = "Developer", origin = DecreeOrigin.BOTH, description = "Iris World Manager", aliases = {"dev"})
public class CommandDeveloper implements DecreeExecutor { public class CommandDeveloper implements DecreeExecutor {
private CommandTurboPregen turboPregen; private CommandTurboPregen turboPregen;
private CommandUpdater updater;
@Decree(description = "Get Loaded TectonicPlates Count", origin = DecreeOrigin.BOTH, sync = true) @Decree(description = "Get Loaded TectonicPlates Count", origin = DecreeOrigin.BOTH, sync = true)
public void EngineStatus() { public void EngineStatus() {
@@ -165,18 +166,6 @@ public class CommandDeveloper implements DecreeExecutor {
sender().sendMessage(C.GREEN + "Done upgrading! You can now update your server version to " + version.getVersion()); sender().sendMessage(C.GREEN + "Done upgrading! You can now update your server version to " + version.getVersion());
} }
@Decree(description = "Test")
public void updater(
@Param(description = "Updater for chunks")
World world
) {
Iris.info("test");
ChunkUpdater updater = new ChunkUpdater(world);
updater.start();
}
@Decree(description = "test") @Decree(description = "test")
public void mca ( public void mca (
@Param(description = "String") String world) { @Param(description = "String") String world) {
@@ -30,13 +30,13 @@ import com.volmit.iris.util.decree.annotations.Param;
import com.volmit.iris.util.format.C; import com.volmit.iris.util.format.C;
import com.volmit.iris.util.format.Form; import com.volmit.iris.util.format.Form;
@Decree(name = "Updater", origin = DecreeOrigin.BOTH, description = "Iris World Updater") @Decree(name = "updater", origin = DecreeOrigin.BOTH, description = "Iris World Updater")
public class CommandUpdater implements DecreeExecutor { public class CommandUpdater implements DecreeExecutor {
private ChunkUpdater chunkUpdater; private ChunkUpdater chunkUpdater;
@Decree(description = "Updates all chunk in the specified world") @Decree(description = "Updates all chunk in the specified world")
public void start( public void start(
@Param(description = "World to update chunks at") @Param(description = "World to update chunks at", contextual = true)
World world World world
) { ) {
if (!IrisToolbelt.isIrisWorld(world)) { if (!IrisToolbelt.isIrisWorld(world)) {
@@ -269,14 +269,18 @@ public interface Engine extends DataProvider, Fallible, LootProvider, BlockUpdat
@ChunkCoordinates @ChunkCoordinates
@Override @Override
default void updateChunk(Chunk c) { default void updateChunk(Chunk c) {
if (c.getWorld().isChunkLoaded(c.getX() + 1, c.getZ() + 1) for (int x = -1; x <= 1; x++) {
&& c.getWorld().isChunkLoaded(c.getX(), c.getZ() + 1) for (int z = -1; z <= 1; z++) {
&& c.getWorld().isChunkLoaded(c.getX() + 1, c.getZ()) if (c.getWorld().isChunkLoaded(c.getX() + x, c.getZ() + z))
&& c.getWorld().isChunkLoaded(c.getX() - 1, c.getZ() - 1) continue;
&& c.getWorld().isChunkLoaded(c.getX(), c.getZ() - 1) Iris.debug("Chunk %s, %s [%s, %s] is not loaded".formatted(c.getX() + x, c.getZ() + z, x, z));
&& c.getWorld().isChunkLoaded(c.getX() - 1, c.getZ()) return;
&& c.getWorld().isChunkLoaded(c.getX() + 1, c.getZ() - 1) }
&& c.getWorld().isChunkLoaded(c.getX() - 1, c.getZ() + 1) && getMantle().getMantle().isLoaded(c)) { }
if (!getMantle().getMantle().isLoaded(c)) {
Iris.debug("Mantle Chunk " + c.getX() + c.getX() + " is not loaded");
return;
}
getMantle().getMantle().raiseFlag(c.getX(), c.getZ(), MantleFlag.TILE, () -> J.s(() -> { getMantle().getMantle().raiseFlag(c.getX(), c.getZ(), MantleFlag.TILE, () -> J.s(() -> {
getMantle().getMantle().iterateChunk(c.getX(), c.getZ(), TileWrapper.class, (x, y, z, tile) -> { getMantle().getMantle().iterateChunk(c.getX(), c.getZ(), TileWrapper.class, (x, y, z, tile) -> {
@@ -340,7 +344,6 @@ public interface Engine extends DataProvider, Fallible, LootProvider, BlockUpdat
getMetrics().getUpdates().put(p.getMilliseconds()); getMetrics().getUpdates().put(p.getMilliseconds());
}, RNG.r.i(0, 20))); }, RNG.r.i(0, 20)));
} }
}
@BlockCoordinates @BlockCoordinates
default void updateLighting(int x, int y, int z, Chunk c) { default void updateLighting(int x, int y, int z, Chunk c) {