Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
Expand All @@ -70,7 +85,8 @@ private void worldSelected(CallbackInfo ci) {
}
}

@Inject(
//? if < 1.21.6 {
/*@Inject(
method = "render",
at = @At("RETURN")
)
Expand All @@ -83,5 +99,6 @@ private void render(DrawContext context, int mouseX, int mouseY, float delta, Ca
}
}
}
*///?}
//?}
}
2 changes: 1 addition & 1 deletion versions/1.21.6/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion versions/1.21.9/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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