mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-06-18 06:41:08 +00:00
add debug info to the updater
This commit is contained in:
@@ -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,77 +269,80 @@ 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)) {
|
|
||||||
|
|
||||||
getMantle().getMantle().raiseFlag(c.getX(), c.getZ(), MantleFlag.TILE, () -> J.s(() -> {
|
|
||||||
getMantle().getMantle().iterateChunk(c.getX(), c.getZ(), TileWrapper.class, (x, y, z, tile) -> {
|
|
||||||
int betterY = y + getWorld().minHeight();
|
|
||||||
if (!TileData.setTileState(c.getBlock(x, betterY, z), tile.getData()))
|
|
||||||
Iris.warn("Failed to set tile entity data at [%d %d %d | %s] for tile %s!", x, betterY, z, c.getBlock(x, betterY, z).getBlockData().getMaterial().getKey(), tile.getData().getTileId());
|
|
||||||
});
|
|
||||||
}));
|
|
||||||
getMantle().getMantle().raiseFlag(c.getX(), c.getZ(), MantleFlag.CUSTOM, () -> J.s(() -> {
|
|
||||||
getMantle().getMantle().iterateChunk(c.getX(), c.getZ(), Identifier.class, (x, y, z, v) -> {
|
|
||||||
Iris.service(ExternalDataSVC.class).processUpdate(this, c.getBlock(x & 15, y + getWorld().minHeight(), z & 15), v);
|
|
||||||
});
|
|
||||||
}));
|
|
||||||
|
|
||||||
getMantle().getMantle().raiseFlag(c.getX(), c.getZ(), MantleFlag.UPDATE, () -> J.s(() -> {
|
|
||||||
PrecisionStopwatch p = PrecisionStopwatch.start();
|
|
||||||
KMap<Long, Integer> updates = new KMap<>();
|
|
||||||
RNG r = new RNG(Cache.key(c.getX(), c.getZ()));
|
|
||||||
getMantle().getMantle().iterateChunk(c.getX(), c.getZ(), MatterCavern.class, (x, yf, z, v) -> {
|
|
||||||
int y = yf + getWorld().minHeight();
|
|
||||||
if (!B.isFluid(c.getBlock(x & 15, y, z & 15).getBlockData())) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
boolean u = false;
|
|
||||||
if (B.isAir(c.getBlock(x & 15, y, z & 15).getRelative(BlockFace.DOWN).getBlockData())) {
|
|
||||||
u = true;
|
|
||||||
} else if (B.isAir(c.getBlock(x & 15, y, z & 15).getRelative(BlockFace.WEST).getBlockData())) {
|
|
||||||
u = true;
|
|
||||||
} else if (B.isAir(c.getBlock(x & 15, y, z & 15).getRelative(BlockFace.EAST).getBlockData())) {
|
|
||||||
u = true;
|
|
||||||
} else if (B.isAir(c.getBlock(x & 15, y, z & 15).getRelative(BlockFace.SOUTH).getBlockData())) {
|
|
||||||
u = true;
|
|
||||||
} else if (B.isAir(c.getBlock(x & 15, y, z & 15).getRelative(BlockFace.NORTH).getBlockData())) {
|
|
||||||
u = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (u) {
|
|
||||||
updates.compute(Cache.key(x & 15, z & 15), (k, vv) -> {
|
|
||||||
if (vv != null) {
|
|
||||||
return Math.max(vv, y);
|
|
||||||
}
|
|
||||||
|
|
||||||
return y;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
updates.forEach((k, v) -> update(Cache.keyX(k), v, Cache.keyZ(k), c, r));
|
|
||||||
getMantle().getMantle().iterateChunk(c.getX(), c.getZ(), MatterUpdate.class, (x, yf, z, v) -> {
|
|
||||||
int y = yf + getWorld().minHeight();
|
|
||||||
if (v != null && v.isUpdate()) {
|
|
||||||
int vx = x & 15;
|
|
||||||
int vz = z & 15;
|
|
||||||
update(x, y, z, c, new RNG(Cache.key(c.getX(), c.getZ())));
|
|
||||||
if (vx > 0 && vx < 15 && vz > 0 && vz < 15) {
|
|
||||||
updateLighting(x, y, z, c);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
getMantle().getMantle().deleteChunkSlice(c.getX(), c.getZ(), MatterUpdate.class);
|
|
||||||
getMetrics().getUpdates().put(p.getMilliseconds());
|
|
||||||
}, RNG.r.i(0, 20)));
|
|
||||||
}
|
}
|
||||||
|
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().iterateChunk(c.getX(), c.getZ(), TileWrapper.class, (x, y, z, tile) -> {
|
||||||
|
int betterY = y + getWorld().minHeight();
|
||||||
|
if (!TileData.setTileState(c.getBlock(x, betterY, z), tile.getData()))
|
||||||
|
Iris.warn("Failed to set tile entity data at [%d %d %d | %s] for tile %s!", x, betterY, z, c.getBlock(x, betterY, z).getBlockData().getMaterial().getKey(), tile.getData().getTileId());
|
||||||
|
});
|
||||||
|
}));
|
||||||
|
getMantle().getMantle().raiseFlag(c.getX(), c.getZ(), MantleFlag.CUSTOM, () -> J.s(() -> {
|
||||||
|
getMantle().getMantle().iterateChunk(c.getX(), c.getZ(), Identifier.class, (x, y, z, v) -> {
|
||||||
|
Iris.service(ExternalDataSVC.class).processUpdate(this, c.getBlock(x & 15, y + getWorld().minHeight(), z & 15), v);
|
||||||
|
});
|
||||||
|
}));
|
||||||
|
|
||||||
|
getMantle().getMantle().raiseFlag(c.getX(), c.getZ(), MantleFlag.UPDATE, () -> J.s(() -> {
|
||||||
|
PrecisionStopwatch p = PrecisionStopwatch.start();
|
||||||
|
KMap<Long, Integer> updates = new KMap<>();
|
||||||
|
RNG r = new RNG(Cache.key(c.getX(), c.getZ()));
|
||||||
|
getMantle().getMantle().iterateChunk(c.getX(), c.getZ(), MatterCavern.class, (x, yf, z, v) -> {
|
||||||
|
int y = yf + getWorld().minHeight();
|
||||||
|
if (!B.isFluid(c.getBlock(x & 15, y, z & 15).getBlockData())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
boolean u = false;
|
||||||
|
if (B.isAir(c.getBlock(x & 15, y, z & 15).getRelative(BlockFace.DOWN).getBlockData())) {
|
||||||
|
u = true;
|
||||||
|
} else if (B.isAir(c.getBlock(x & 15, y, z & 15).getRelative(BlockFace.WEST).getBlockData())) {
|
||||||
|
u = true;
|
||||||
|
} else if (B.isAir(c.getBlock(x & 15, y, z & 15).getRelative(BlockFace.EAST).getBlockData())) {
|
||||||
|
u = true;
|
||||||
|
} else if (B.isAir(c.getBlock(x & 15, y, z & 15).getRelative(BlockFace.SOUTH).getBlockData())) {
|
||||||
|
u = true;
|
||||||
|
} else if (B.isAir(c.getBlock(x & 15, y, z & 15).getRelative(BlockFace.NORTH).getBlockData())) {
|
||||||
|
u = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (u) {
|
||||||
|
updates.compute(Cache.key(x & 15, z & 15), (k, vv) -> {
|
||||||
|
if (vv != null) {
|
||||||
|
return Math.max(vv, y);
|
||||||
|
}
|
||||||
|
|
||||||
|
return y;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
updates.forEach((k, v) -> update(Cache.keyX(k), v, Cache.keyZ(k), c, r));
|
||||||
|
getMantle().getMantle().iterateChunk(c.getX(), c.getZ(), MatterUpdate.class, (x, yf, z, v) -> {
|
||||||
|
int y = yf + getWorld().minHeight();
|
||||||
|
if (v != null && v.isUpdate()) {
|
||||||
|
int vx = x & 15;
|
||||||
|
int vz = z & 15;
|
||||||
|
update(x, y, z, c, new RNG(Cache.key(c.getX(), c.getZ())));
|
||||||
|
if (vx > 0 && vx < 15 && vz > 0 && vz < 15) {
|
||||||
|
updateLighting(x, y, z, c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
getMantle().getMantle().deleteChunkSlice(c.getX(), c.getZ(), MatterUpdate.class);
|
||||||
|
getMetrics().getUpdates().put(p.getMilliseconds());
|
||||||
|
}, RNG.r.i(0, 20)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@BlockCoordinates
|
@BlockCoordinates
|
||||||
|
|||||||
Reference in New Issue
Block a user