diff --git a/src/main/java/com/github/zly2006/xbackup/gui/OptionDialog.java b/src/main/java/com/github/zly2006/xbackup/gui/OptionDialog.java index 5ed3a2e..d41171e 100644 --- a/src/main/java/com/github/zly2006/xbackup/gui/OptionDialog.java +++ b/src/main/java/com/github/zly2006/xbackup/gui/OptionDialog.java @@ -86,8 +86,10 @@ public OptionDialog onButtonPress(int button, Runnable run) { public void close() { getParent().removeChild(this); } - - @Override + + //? if < 1.21.9 { + /*@Override + *///?} public boolean keyPressed(int key, int scancode, int modifiers) { return true; } diff --git a/src/main/java/com/github/zly2006/xbackup/mixin/MixinSelectWorldScreen.java b/src/main/java/com/github/zly2006/xbackup/mixin/MixinSelectWorldScreen.java index 636aeb6..27b59a6 100644 --- a/src/main/java/com/github/zly2006/xbackup/mixin/MixinSelectWorldScreen.java +++ b/src/main/java/com/github/zly2006/xbackup/mixin/MixinSelectWorldScreen.java @@ -10,6 +10,9 @@ import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.screen.world.SelectWorldScreen; import net.minecraft.client.gui.screen.world.WorldListWidget; +//? if >= 1.21.6 { +import net.minecraft.client.gui.tooltip.Tooltip; +//?} import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.text.Text; import net.minecraft.util.Formatting; @@ -40,22 +43,34 @@ protected MixinSelectWorldScreen(Text title) { at = @At("RETURN") ) private void postInit(CallbackInfo ci) { + //? if >=1.21.6 { + Tooltip backupTooltip; + if (FabricLoader.getInstance().isModLoaded("polylib")) { + backupTooltip = Tooltip.of(Text.translatable("xb.button.backups")); + } else { + backupTooltip = Tooltip.of(Text.translatable("xb.gui.no_polylib").formatted(Formatting.RED)); + } + //?} buttonWidget = ButtonWidget.builder(Text.literal("回"), (button) -> { - if (!FabricLoader.getInstance().isModLoaded("polylib")) { - return; - } - if (levelList.getSelectedAsOptional().isPresent()) { - String name = levelList.getSelectedAsOptional().get().level.getName(); - BackupDatabaseService service = new BackupDatabaseService( - Path.of("saves").toAbsolutePath().normalize(), - XBackup.INSTANCE.getDatabaseFromWorld(Path.of("saves", name)), - Path.of("").toAbsolutePath().resolve(XBackup.config.getBlobPath()).normalize(), - XBackup.config - ); - BackupsGui.Companion.open(service, Path.of("saves", name)); - } - }).dimensions(this.width / 2 + 160, this.height - 28, 20, 20).build(); + if (!FabricLoader.getInstance().isModLoaded("polylib")) { + return; + } + if (levelList.getSelectedAsOptional().isPresent()) { + String name = levelList.getSelectedAsOptional().get().level.getName(); + BackupDatabaseService service = new BackupDatabaseService( + Path.of("saves").toAbsolutePath().normalize(), + XBackup.INSTANCE.getDatabaseFromWorld(Path.of("saves", name)), + Path.of("").toAbsolutePath().resolve(XBackup.config.getBlobPath()).normalize(), + XBackup.config + ); + BackupsGui.Companion.open(service, Path.of("saves", name)); + } + }).dimensions(this.width / 2 + 160, this.height - 28, 20, 20) + //? if >= 1.21.6 { + .tooltip(backupTooltip) + //?} + .build(); buttonWidget.active = levelList.getSelectedAsOptional().isPresent(); this.addDrawableChild(buttonWidget); } @@ -70,7 +85,8 @@ private void worldSelected(CallbackInfo ci) { } } - @Inject( + //? if < 1.21.6 { + /*@Inject( method = "render", at = @At("RETURN") ) @@ -83,5 +99,6 @@ private void render(DrawContext context, int mouseX, int mouseY, float delta, Ca } } } + *///?} //?} } diff --git a/versions/1.21.6/gradle.properties b/versions/1.21.6/gradle.properties index f276846..edfcea6 100644 --- a/versions/1.21.6/gradle.properties +++ b/versions/1.21.6/gradle.properties @@ -5,4 +5,4 @@ deps.fabric_api=0.127.0+1.21.6 mod.mc_dep=>=1.21.6 <=1.21.8 mod.mc_title=1.21.6 mod.mc_targets=1.21.6 1.21.7 1.21.8 -deps.poly_lib= +deps.poly_lib=2106.1.0.182 diff --git a/versions/1.21.9/gradle.properties b/versions/1.21.9/gradle.properties index b6bd710..0af0ae7 100644 --- a/versions/1.21.9/gradle.properties +++ b/versions/1.21.9/gradle.properties @@ -5,4 +5,4 @@ deps.fabric_api=0.134.0+1.21.9 mod.mc_dep=>=1.21.9 <=1.21.10 mod.mc_title=1.21.9 mod.mc_targets=1.21.9 1.21.10 -deps.poly_lib= +deps.poly_lib=2109.1.0.184