mirror of https://github.com/cabaletta/baritone
pre.3
This commit is contained in:
parent
90ac6f331e
commit
088009fe4a
|
@ -4,7 +4,7 @@ mod_version=1.8.0
|
||||||
maven_group=baritone
|
maven_group=baritone
|
||||||
archives_base_name=baritone
|
archives_base_name=baritone
|
||||||
|
|
||||||
minecraft_version=1.18-pre2
|
minecraft_version=1.18-pre3
|
||||||
forge_version=1.17.1-37.0.69
|
forge_version=1.17.1-37.0.69
|
||||||
fabric_version=0.12.5
|
fabric_version=0.12.5
|
||||||
|
|
||||||
|
|
|
@ -57,34 +57,34 @@ public class WorldProvider implements IWorldProvider, Helper {
|
||||||
* @param world The world's Registry Data
|
* @param world The world's Registry Data
|
||||||
*/
|
*/
|
||||||
public final void initWorld(ResourceKey<Level> worldKey, DimensionType world) {
|
public final void initWorld(ResourceKey<Level> worldKey, DimensionType world) {
|
||||||
File directory;
|
Path directory;
|
||||||
File readme;
|
Path readme;
|
||||||
|
|
||||||
IntegratedServer integratedServer = mc.getSingleplayerServer();
|
IntegratedServer integratedServer = mc.getSingleplayerServer();
|
||||||
|
|
||||||
// If there is an integrated server running (Aka Singleplayer) then do magic to find the world save file
|
// If there is an integrated server running (Aka Singleplayer) then do magic to find the world save file
|
||||||
if (mc.hasSingleplayerServer()) {
|
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
|
// 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
|
// 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;
|
readme = directory;
|
||||||
} else { // Otherwise, the server must be remote...
|
} else { // Otherwise, the server must be remote...
|
||||||
String folderName = mc.isConnectedToRealms() ? "realms" : mc.getCurrentServer().ip;
|
String folderName = mc.isConnectedToRealms() ? "realms" : mc.getCurrentServer().ip;
|
||||||
if (SystemUtils.IS_OS_WINDOWS) {
|
if (SystemUtils.IS_OS_WINDOWS) {
|
||||||
folderName = folderName.replace(":", "_");
|
folderName = folderName.replace(":", "_");
|
||||||
}
|
}
|
||||||
directory = new File(Baritone.getDir(), folderName);
|
directory = Baritone.getDir().toPath().resolve(folderName);
|
||||||
readme = Baritone.getDir();
|
readme = Baritone.getDir().toPath();
|
||||||
}
|
}
|
||||||
|
|
||||||
// lol wtf is this baritone folder in my minecraft save?
|
// 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
|
// good thing we have a readme
|
||||||
out.write("https://github.com/cabaletta/baritone\n".getBytes());
|
out.write("https://github.com/cabaletta/baritone\n".getBytes());
|
||||||
} catch (IOException ignored) {}
|
} catch (IOException ignored) {}
|
||||||
|
@ -103,8 +103,8 @@ public class WorldProvider implements IWorldProvider, Helper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public final Path getDimDir(ResourceKey<Level> level, int height, File directory) {
|
public final Path getDimDir(ResourceKey<Level> level, int height, Path directory) {
|
||||||
return directory.toPath().resolve(level.location().getNamespace()).resolve(level.location().getPath() + "_" + height);
|
return directory.resolve(level.location().getNamespace()).resolve(level.location().getPath() + "_" + height);
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void closeWorld() {
|
public final void closeWorld() {
|
||||||
|
|
Loading…
Reference in New Issue