From 7e1fe5a6020b897acdba0d3660d061fad66f354f Mon Sep 17 00:00:00 2001 From: Szum123321 Date: Fri, 8 May 2020 23:13:34 +0200 Subject: [PATCH] All is good. --- gradle.properties | 2 +- .../net/szum123321/textile_backup/TextileBackup.java | 12 ++++++++++++ .../textile_backup/core/MakeBackupThread.java | 2 +- src/main/resources/fabric.mod.json | 2 +- 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/gradle.properties b/gradle.properties index a5a440a..ca8e893 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,6 +9,6 @@ loader_version=0.8.2+build.194 fabric_version=0.10.7+build.344-1.16 # Mod Properties -mod_version = 1.2.0-1.15 +mod_version = 1.2.0-20w19a maven_group = net.szum123321 archives_base_name = textile_backup \ No newline at end of file diff --git a/src/main/java/net/szum123321/textile_backup/TextileBackup.java b/src/main/java/net/szum123321/textile_backup/TextileBackup.java index 054f932..619f9c4 100644 --- a/src/main/java/net/szum123321/textile_backup/TextileBackup.java +++ b/src/main/java/net/szum123321/textile_backup/TextileBackup.java @@ -23,12 +23,17 @@ import io.github.cottonmc.cotton.config.ConfigManager; import io.github.cottonmc.cotton.logging.ModLogger; import net.fabricmc.api.ModInitializer; +import net.fabricmc.fabric.api.event.server.ServerStartCallback; import net.fabricmc.fabric.api.registry.CommandRegistry; +import net.minecraft.class_5218; import net.minecraft.server.command.ServerCommandSource; +import net.minecraft.world.dimension.DimensionType; +import net.minecraft.world.level.storage.LevelStorage; import net.szum123321.textile_backup.commands.BlacklistCommand; import net.szum123321.textile_backup.commands.CleanupCommand; import net.szum123321.textile_backup.commands.StartBackupCommand; import net.szum123321.textile_backup.commands.WhitelistCommand; +import net.szum123321.textile_backup.mixin.MinecraftServerSessionAccessor; public class TextileBackup implements ModInitializer { public static final String MOD_ID = "textile_backup"; @@ -45,6 +50,13 @@ public class TextileBackup implements ModInitializer { config = ConfigManager.loadConfig(ConfigHandler.class); registerCommands(); + + ServerStartCallback.EVENT.register(server -> { + LevelStorage.Session session = ((MinecraftServerSessionAccessor)server).getSession(); + + System.out.println(session.getDirectory(class_5218.field_24188).toAbsolutePath()); + System.out.println(session.method_27424(DimensionType.OVERWORLD).toPath().toAbsolutePath()); + }); } private void registerCommands(){ diff --git a/src/main/java/net/szum123321/textile_backup/core/MakeBackupThread.java b/src/main/java/net/szum123321/textile_backup/core/MakeBackupThread.java index fb50809..7c4a8cb 100644 --- a/src/main/java/net/szum123321/textile_backup/core/MakeBackupThread.java +++ b/src/main/java/net/szum123321/textile_backup/core/MakeBackupThread.java @@ -50,7 +50,7 @@ public class MakeBackupThread implements Runnable { public void run() { File world = ((MinecraftServerSessionAccessor)server) .getSession() - .getDirectory(class_5218.field_24188).toFile(); + .method_27424(DimensionType.OVERWORLD); File outFile = BackupHelper .getBackupRootPath(Utilities.getLevelName(server)) diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 2c8d3d6..73e90a0 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -29,6 +29,6 @@ "depends": { "fabricloader": ">=0.7.2", "fabric": "*", - "minecraft": "1.15.*" + "minecraft": "1.16.*" } }