Skip to content

Commit

Permalink
fix: remove client processor
Browse files Browse the repository at this point in the history
  • Loading branch information
rootEnginear committed Dec 12, 2023
1 parent ac145d2 commit c6d5466
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/main/java/rootenginear/playground/ChunkProcessor.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -28,7 +29,7 @@ void joopChunk(int chunkX, int chunkZ, CallbackInfoReturnable<Chunk> 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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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) {
}
}

Expand Down
5 changes: 1 addition & 4 deletions src/main/resources/playground.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,5 @@
],
"injectors": {
"defaultRequire": 1
},
"client": [
"ChunkProviderClientMixin"
]
}
}

0 comments on commit c6d5466

Please sign in to comment.