From 088009fe4a8dac61dfc008acd1bf7b2b20bf41bc Mon Sep 17 00:00:00 2001 From: Wagyourtail Date: Wed, 17 Nov 2021 10:16:07 -0700 Subject: [PATCH] pre.3 --- gradle.properties | 2 +- .../java/baritone/cache/WorldProvider.java | 22 +++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/gradle.properties b/gradle.properties index ae8b8fdff..f9024316a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,7 +4,7 @@ mod_version=1.8.0 maven_group=baritone archives_base_name=baritone -minecraft_version=1.18-pre2 +minecraft_version=1.18-pre3 forge_version=1.17.1-37.0.69 fabric_version=0.12.5 diff --git a/src/main/java/baritone/cache/WorldProvider.java b/src/main/java/baritone/cache/WorldProvider.java index 3d30603b4..74401a401 100644 --- a/src/main/java/baritone/cache/WorldProvider.java +++ b/src/main/java/baritone/cache/WorldProvider.java @@ -57,34 +57,34 @@ public class WorldProvider implements IWorldProvider, Helper { * @param world The world's Registry Data */ public final void initWorld(ResourceKey worldKey, DimensionType world) { - File directory; - File readme; + Path directory; + Path readme; IntegratedServer integratedServer = mc.getSingleplayerServer(); // If there is an integrated server running (Aka Singleplayer) then do magic to find the world save file if (mc.hasSingleplayerServer()) { - directory = DimensionType.getStorageFolder(worldKey, integratedServer.getWorldPath(LevelResource.ROOT).toFile()); + directory = DimensionType.getStorageFolder(worldKey, integratedServer.getWorldPath(LevelResource.ROOT)); // Gets the "depth" of this directory relative the the game's run directory, 2 is the location of the world - if (directory.toPath().relativize(mc.gameDirectory.toPath()).getNameCount() != 2) { + if (directory.relativize(mc.gameDirectory.toPath()).getNameCount() != 2) { // subdirectory of the main save directory for this world - directory = directory.getParentFile(); + directory = directory.getParent(); } - directory = new File(directory, "baritone"); + directory = directory.resolve("baritone"); readme = directory; } else { // Otherwise, the server must be remote... String folderName = mc.isConnectedToRealms() ? "realms" : mc.getCurrentServer().ip; if (SystemUtils.IS_OS_WINDOWS) { folderName = folderName.replace(":", "_"); } - directory = new File(Baritone.getDir(), folderName); - readme = Baritone.getDir(); + directory = Baritone.getDir().toPath().resolve(folderName); + readme = Baritone.getDir().toPath(); } // lol wtf is this baritone folder in my minecraft save? - try (FileOutputStream out = new FileOutputStream(new File(readme, "readme.txt"))) { + try (FileOutputStream out = new FileOutputStream(readme.resolve("readme.txt").toFile())) { // good thing we have a readme out.write("https://github.com/cabaletta/baritone\n".getBytes()); } catch (IOException ignored) {} @@ -103,8 +103,8 @@ public class WorldProvider implements IWorldProvider, Helper { } } - public final Path getDimDir(ResourceKey level, int height, File directory) { - return directory.toPath().resolve(level.location().getNamespace()).resolve(level.location().getPath() + "_" + height); + public final Path getDimDir(ResourceKey level, int height, Path directory) { + return directory.resolve(level.location().getNamespace()).resolve(level.location().getPath() + "_" + height); } public final void closeWorld() {