From c6d54660d1d9fbf00013178079039f96628d52c2 Mon Sep 17 00:00:00 2001 From: rootEnginear Date: Tue, 12 Dec 2023 12:34:04 +0700 Subject: [PATCH] fix: remove client processor --- src/main/java/rootenginear/playground/ChunkProcessor.java | 4 ++-- .../playground/mixin/ChunkProviderClientMixin.java | 3 ++- .../rootenginear/playground/mixin/MinecraftServerMixin.java | 6 +++--- src/main/resources/playground.mixins.json | 5 +---- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/main/java/rootenginear/playground/ChunkProcessor.java b/src/main/java/rootenginear/playground/ChunkProcessor.java index dd0e084..3cb7a55 100644 --- a/src/main/java/rootenginear/playground/ChunkProcessor.java +++ b/src/main/java/rootenginear/playground/ChunkProcessor.java @@ -11,8 +11,8 @@ import java.nio.file.Paths; public class ChunkProcessor { - public static void readAndDumpChunkData(int targetChunkX, int targetChunkZ, Chunk chunk) throws IOException { - try (FileOutputStream chunkData = new FileOutputStream(String.format("livemap/chunks/%d.%d", targetChunkX, targetChunkZ))) { + public static void readAndDumpChunkData(int chunkX, int chunkZ, Chunk chunk) throws IOException { + try (FileOutputStream chunkData = new FileOutputStream(String.format("livemap/chunks/%d.%d", chunkX, chunkZ))) { for (int shiftZ = 0; shiftZ < 16; shiftZ++) { for (int shiftX = 0; shiftX < 16; shiftX++) { short blockData = 0; diff --git a/src/main/java/rootenginear/playground/mixin/ChunkProviderClientMixin.java b/src/main/java/rootenginear/playground/mixin/ChunkProviderClientMixin.java index ae41df4..dfde8a0 100644 --- a/src/main/java/rootenginear/playground/mixin/ChunkProviderClientMixin.java +++ b/src/main/java/rootenginear/playground/mixin/ChunkProviderClientMixin.java @@ -10,6 +10,7 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import rootenginear.playground.ChunkProcessor; +import rootenginear.playground.Playground; import java.util.ArrayList; import java.util.List; @@ -28,7 +29,7 @@ void joopChunk(int chunkX, int chunkZ, CallbackInfoReturnable cir) { ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(chunkX, chunkZ); Chunk chunk = (Chunk) this.chunkMapping.get(chunkcoordintpair); if (dumpedChunks.contains(chunkcoordintpair) || chunk == null || !chunk.receivedFromServer) return; - System.out.println("Dumping " + chunkX + " " + chunkZ); + Playground.LOGGER.info("Dumping " + chunkX + "," + chunkZ); try { dumpedChunks.add(chunkcoordintpair); ChunkProcessor.readAndDumpChunkData(chunkX, chunkZ, chunk); diff --git a/src/main/java/rootenginear/playground/mixin/MinecraftServerMixin.java b/src/main/java/rootenginear/playground/mixin/MinecraftServerMixin.java index 026e725..1730256 100644 --- a/src/main/java/rootenginear/playground/mixin/MinecraftServerMixin.java +++ b/src/main/java/rootenginear/playground/mixin/MinecraftServerMixin.java @@ -11,6 +11,7 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import rootenginear.playground.ChunkProcessor; +import rootenginear.playground.Playground; import java.io.FileWriter; @@ -50,13 +51,12 @@ void saveChunk(CallbackInfo ci) { int targetChunkZ = chunkZ + chunkShiftZ; Chunk chunk = overworld.chunkProviderServer.provideChunk(targetChunkX, targetChunkZ); ChunkProcessor.readAndDumpChunkData(targetChunkX, targetChunkZ, chunk); - System.out.println("Chunk " + targetChunkX + ", " + targetChunkZ + " dumped!"); + Playground.LOGGER.info("Chunk " + targetChunkX + "," + targetChunkZ + " dumped!"); } } } ChunkProcessor.updateChunkFile(); - } catch (Exception lol) { - System.out.println(lol.toString()); + } catch (Exception ignored) { } } diff --git a/src/main/resources/playground.mixins.json b/src/main/resources/playground.mixins.json index 23421bb..1654eb2 100644 --- a/src/main/resources/playground.mixins.json +++ b/src/main/resources/playground.mixins.json @@ -8,8 +8,5 @@ ], "injectors": { "defaultRequire": 1 - }, - "client": [ - "ChunkProviderClientMixin" - ] + } }