Fixed Via Button in 1.20.2

This commit is contained in:
FlorianMichael 2023-09-22 23:02:08 +02:00
parent bec1c76415
commit 0e538ee6e8
No known key found for this signature in database
GPG Key ID: C2FB87E71C425126
3 changed files with 1 additions and 3 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

@ -22,11 +22,9 @@ public class ViaFabricClient implements ClientModInitializer {
try { try {
ScreenEvents.AFTER_INIT.register((client, screen, scaledWidth, scaledHeight) -> { ScreenEvents.AFTER_INIT.register((client, screen, scaledWidth, scaledHeight) -> {
if (!(screen instanceof MultiplayerScreen)) return; if (!(screen instanceof MultiplayerScreen)) return;
// TODO This is broken
Identifier widgetIdentifier = new Identifier("viafabric:textures/gui/widgets.png");
ButtonWidget enableClientSideViaVersion = new TexturedButtonWidget(scaledWidth / 2 + 113, 10, ButtonWidget enableClientSideViaVersion = new TexturedButtonWidget(scaledWidth / 2 + 113, 10,
40, 20, // Size 40, 20, // Size
new ButtonTextures(widgetIdentifier, widgetIdentifier), new ButtonTextures(new Identifier("viafabric", "widget_unfocused"), new Identifier("viafabric", "widget_focused")),
it -> MinecraftClient.getInstance().setScreen(new ViaConfigScreen(screen)), it -> MinecraftClient.getInstance().setScreen(new ViaConfigScreen(screen)),
Text.translatable("gui.via_button")); Text.translatable("gui.via_button"));
if (ViaFabric.config.isHideButton()) enableClientSideViaVersion.visible = false; if (ViaFabric.config.isHideButton()) enableClientSideViaVersion.visible = false;