From 68e6621e7ee67c42bc67a2ea5b56dd7bf7409094 Mon Sep 17 00:00:00 2001 From: mcrcortex <18544518+MCRcortex@users.noreply.github.com> Date: Mon, 19 May 2025 21:38:28 +1000 Subject: [PATCH] Accept world --- .../cortex/voxy/client/saver/ContextSelectionSystem.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/java/me/cortex/voxy/client/saver/ContextSelectionSystem.java b/src/main/java/me/cortex/voxy/client/saver/ContextSelectionSystem.java index aea518b4..dafb866c 100644 --- a/src/main/java/me/cortex/voxy/client/saver/ContextSelectionSystem.java +++ b/src/main/java/me/cortex/voxy/client/saver/ContextSelectionSystem.java @@ -15,6 +15,7 @@ import me.cortex.voxy.common.thread.ServiceThreadPool; import net.minecraft.client.MinecraftClient; import net.minecraft.client.world.ClientWorld; import net.minecraft.util.WorldSavePath; +import net.minecraft.world.World; import java.io.IOException; import java.nio.file.Files; @@ -119,7 +120,7 @@ public class ContextSelectionSystem { } //Gets dimension independent base world, if singleplayer, its the world name, if multiplayer, its the server ip - private static Path getBasePath(ClientWorld world) { + private static Path getBasePath() { //TODO: improve this Path basePath = MinecraftClient.getInstance().runDirectory.toPath().resolve(".voxy").resolve("saves"); var iserver = MinecraftClient.getInstance().getServer(); @@ -159,7 +160,7 @@ public class ContextSelectionSystem { return hexString.toString(); } - private static String getWorldId(ClientWorld world) { + private static String getWorldId(World world) { String data = world.getBiomeAccess().seed + world.getRegistryKey().toString(); try { return bytesToHex(MessageDigest.getInstance("SHA-256").digest(data.getBytes())).substring(0, 32); @@ -175,8 +176,8 @@ public class ContextSelectionSystem { } - public Selection getBestSelectionOrCreate(ClientWorld world) { - var path = getBasePath(world); + public Selection getBestSelectionOrCreate(World world) { + var path = getBasePath(); try { Files.createDirectories(path); } catch (IOException e) {