diff --git a/gradle.properties b/gradle.properties index dabf5cb..2a7ecb1 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,15 +3,15 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check these on https://modmuss50.me/fabric.html -minecraft_version=1.19.3 -yarn_mappings=1.19.3+build.2 -loader_version=0.14.11 -fabric_version=0.68.1+1.19.3 +minecraft_version=1.19.2 +yarn_mappings=1.19.2+build.28 +loader_version=0.14.12 +fabric_version=0.72.0+1.19.2 # Mod Properties -mod_version=1.5.2 +mod_version=1.5.3+1.19.2 maven_group=jerozgen archives_base_name=language-reload # Dependencies -modmenu_version=5.0.0-alpha.4 +modmenu_version=4.1.2 diff --git a/src/main/java/jerozgen/languagereload/gui/LanguageEntry.java b/src/main/java/jerozgen/languagereload/gui/LanguageEntry.java index e2b99e3..e2db769 100644 --- a/src/main/java/jerozgen/languagereload/gui/LanguageEntry.java +++ b/src/main/java/jerozgen/languagereload/gui/LanguageEntry.java @@ -63,8 +63,8 @@ public void render(MatrixStack matrices, int index, int top, int left, int entry } buttons.forEach(button -> button.visible = false); ButtonRenderer buttonRenderer = (button, x, y) -> { - button.setX(x); - button.setY(y); + button.x = x; + button.y = y; button.visible = true; button.render(matrices, mouseX, mouseY, tickDelta); }; diff --git a/src/main/java/jerozgen/languagereload/gui/LockedLanguageEntry.java b/src/main/java/jerozgen/languagereload/gui/LockedLanguageEntry.java index 6881bfd..e047b3a 100644 --- a/src/main/java/jerozgen/languagereload/gui/LockedLanguageEntry.java +++ b/src/main/java/jerozgen/languagereload/gui/LockedLanguageEntry.java @@ -1,23 +1,36 @@ package jerozgen.languagereload.gui; -import net.minecraft.client.gui.tooltip.Tooltip; import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.gui.widget.TexturedButtonWidget; import net.minecraft.client.resource.language.LanguageDefinition; +import net.minecraft.client.util.math.MatrixStack; +import net.minecraft.screen.ScreenTexts; import net.minecraft.text.Text; import java.util.LinkedList; +import java.util.function.Consumer; public class LockedLanguageEntry extends LanguageEntry { private final Text LOCK_BUTTON_TOOLTIP = Text.translatable("language.default.tooltip"); private final ButtonWidget lockButton = addChild(new TexturedButtonWidget(0, 0, 16, 24, 43, 0, 0, - TEXTURE, TEXTURE_WIDTH, TEXTURE_HEIGHT, __ -> {})); + TEXTURE, TEXTURE_WIDTH, TEXTURE_HEIGHT, __ -> {}, new ButtonWidget.TooltipSupplier() { + @Override + public void onTooltip(ButtonWidget button, MatrixStack matrices, int mouseX, int mouseY) { + if (client.currentScreen != null) { + client.currentScreen.renderTooltip(matrices, LOCK_BUTTON_TOOLTIP, mouseX, mouseY); + } + } + + @Override + public void supply(Consumer consumer) { + consumer.accept(LOCK_BUTTON_TOOLTIP); + } + }, ScreenTexts.EMPTY)); public LockedLanguageEntry(Runnable refreshListsAction, LanguageDefinition language, LinkedList selectedLanguages) { super(refreshListsAction, language, selectedLanguages); lockButton.active = false; - lockButton.setTooltip(Tooltip.of(LOCK_BUTTON_TOOLTIP)); } @Override diff --git a/src/main/java/jerozgen/languagereload/mixin/LanguageOptionsScreenMixin.java b/src/main/java/jerozgen/languagereload/mixin/LanguageOptionsScreenMixin.java index b4fb8eb..b2d0580 100644 --- a/src/main/java/jerozgen/languagereload/mixin/LanguageOptionsScreenMixin.java +++ b/src/main/java/jerozgen/languagereload/mixin/LanguageOptionsScreenMixin.java @@ -79,9 +79,7 @@ void onInit(CallbackInfo ci) { refresh(); addDrawableChild(gameOptions.getForceUnicodeFont().createButton(gameOptions, width / 2 - 155, height - 28, 150)); - addDrawableChild(ButtonWidget.builder(ScreenTexts.DONE, this::onDone) - .dimensions(width / 2 - 155 + 160, height - 28, 150, 20) - .build()); + addDrawableChild(new ButtonWidget(width / 2 - 155 + 160, height - 28, 150, 20, ScreenTexts.DONE, this::onDone)); super.init(); ci.cancel(); diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index afaa548..083c1b6 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -40,7 +40,7 @@ "depends": { "fabric-resource-loader-v0": "*", "fabricloader": ">=0.14.6", - "minecraft": ">=1.19.3", + "minecraft": ">=1.19 <1.19.3", "java": ">=17" } }