From d7590155d922d1e8536a7505c8a7e8598afa4a8b Mon Sep 17 00:00:00 2001 From: David <85349822+Coderx-Gamer@users.noreply.github.com> Date: Sun, 31 Dec 2023 11:59:09 -0500 Subject: [PATCH] Update to 1.4.3 (1.20.4). --- gradle.properties | 10 ++++----- src/main/java/org/uiutils/MainClient.java | 2 +- .../ClientCommonNetworkHandlerMixin.java | 10 ++++----- .../uiutils/mixin/MultiplayerScreenMixin.java | 22 ++++++++++--------- src/main/resources/fabric.mod.json | 2 +- 5 files changed, 24 insertions(+), 22 deletions(-) diff --git a/gradle.properties b/gradle.properties index a8b97d7..edc8487 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,14 +3,14 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check these on https://fabricmc.net/develop -minecraft_version=1.20.2 -yarn_mappings=1.20.2+build.4 -loader_version=0.14.24 +minecraft_version=1.20.4 +yarn_mappings=1.20.4+build.1 +loader_version=0.15.0 # Mod Properties -mod_version = 1.4.2 +mod_version = 1.4.3 maven_group = org.uiutils archives_base_name = uiutils # Dependencies -fabric_version=0.90.7+1.20.2 +fabric_version=0.91.1+1.20.4 diff --git a/src/main/java/org/uiutils/MainClient.java b/src/main/java/org/uiutils/MainClient.java index ee53fd1..f9e5f36 100644 --- a/src/main/java/org/uiutils/MainClient.java +++ b/src/main/java/org/uiutils/MainClient.java @@ -445,7 +445,7 @@ public static void createWidgets(MinecraftClient mc, Screen screen) { if (mc.currentScreen == null) { throw new IllegalStateException("The current minecraft screen (mc.currentScreen) is null"); } - Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection(Text.Serializer.toJson(mc.currentScreen.getTitle())), null); + Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection(Text.Serialization.toJsonString(mc.currentScreen.getTitle())), null); } catch (IllegalStateException e) { LOGGER.error("Error while copying title JSON to clipboard", e); } diff --git a/src/main/java/org/uiutils/mixin/ClientCommonNetworkHandlerMixin.java b/src/main/java/org/uiutils/mixin/ClientCommonNetworkHandlerMixin.java index a748003..66a344e 100644 --- a/src/main/java/org/uiutils/mixin/ClientCommonNetworkHandlerMixin.java +++ b/src/main/java/org/uiutils/mixin/ClientCommonNetworkHandlerMixin.java @@ -25,13 +25,13 @@ public abstract class ClientCommonNetworkHandlerMixin { @Inject(at = @At("HEAD"), method = "onResourcePackSend", cancellable = true) public void onResourcePackSend(ResourcePackSendS2CPacket packet, CallbackInfo ci) { - if (SharedVariables.bypassResourcePack && (packet.isRequired() || SharedVariables.resourcePackForceDeny)) { - this.sendPacket(new ResourcePackStatusC2SPacket(ResourcePackStatusC2SPacket.Status.ACCEPTED)); - this.sendPacket(new ResourcePackStatusC2SPacket(ResourcePackStatusC2SPacket.Status.SUCCESSFULLY_LOADED)); + if (SharedVariables.bypassResourcePack && (packet.required() || SharedVariables.resourcePackForceDeny)) { + this.sendPacket(new ResourcePackStatusC2SPacket(MinecraftClient.getInstance().getSession().getUuidOrNull(), ResourcePackStatusC2SPacket.Status.ACCEPTED)); + this.sendPacket(new ResourcePackStatusC2SPacket(MinecraftClient.getInstance().getSession().getUuidOrNull(), ResourcePackStatusC2SPacket.Status.SUCCESSFULLY_LOADED)); MainClient.LOGGER.info( "[UI Utils]: Required Resource Pack Bypassed, Message: " + - (packet.getPrompt() == null ? "" : packet.getPrompt().getString()) + - ", URL: " + (packet.getUrl() == null ? "" : packet.getUrl()) + (packet.prompt() == null ? "" : packet.prompt().getString()) + + ", URL: " + (packet.url() == null ? "" : packet.url()) ); ci.cancel(); } diff --git a/src/main/java/org/uiutils/mixin/MultiplayerScreenMixin.java b/src/main/java/org/uiutils/mixin/MultiplayerScreenMixin.java index b4b3720..cca2597 100644 --- a/src/main/java/org/uiutils/mixin/MultiplayerScreenMixin.java +++ b/src/main/java/org/uiutils/mixin/MultiplayerScreenMixin.java @@ -18,16 +18,18 @@ private MultiplayerScreenMixin() { @Inject(at = @At("TAIL"), method = "init") public void init(CallbackInfo ci) { - // Create "Bypass Resource Pack" option - this.addDrawableChild(ButtonWidget.builder(Text.of("Bypass Resource Pack: " + (SharedVariables.bypassResourcePack ? "ON" : "OFF")), (button) -> { - SharedVariables.bypassResourcePack = !SharedVariables.bypassResourcePack; - button.setMessage(Text.of("Bypass Resource Pack: " + (SharedVariables.bypassResourcePack ? "ON" : "OFF"))); - }).width(160).position(this.width - 170, this.height - 50).build()); + if (SharedVariables.enabled) { + // Create "Bypass Resource Pack" option + this.addDrawableChild(ButtonWidget.builder(Text.of("Bypass Resource Pack: " + (SharedVariables.bypassResourcePack ? "ON" : "OFF")), (button) -> { + SharedVariables.bypassResourcePack = !SharedVariables.bypassResourcePack; + button.setMessage(Text.of("Bypass Resource Pack: " + (SharedVariables.bypassResourcePack ? "ON" : "OFF"))); + }).width(160).position(this.width - 170, this.height - 50).build()); - // Create "Force Deny" option - this.addDrawableChild(ButtonWidget.builder(Text.of("Force Deny: " + (SharedVariables.resourcePackForceDeny ? "ON" : "OFF")), (button) -> { - SharedVariables.resourcePackForceDeny = !SharedVariables.resourcePackForceDeny; - button.setMessage(Text.of("Force Deny: " + (SharedVariables.resourcePackForceDeny ? "ON" : "OFF"))); - }).width(160).position(this.width - 170, this.height - 25).build()); + // Create "Force Deny" option + this.addDrawableChild(ButtonWidget.builder(Text.of("Force Deny: " + (SharedVariables.resourcePackForceDeny ? "ON" : "OFF")), (button) -> { + SharedVariables.resourcePackForceDeny = !SharedVariables.resourcePackForceDeny; + button.setMessage(Text.of("Force Deny: " + (SharedVariables.resourcePackForceDeny ? "ON" : "OFF"))); + }).width(160).position(this.width - 170, this.height - 25).build()); + } } } diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 34077da..a6dd163 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -28,7 +28,7 @@ ], "depends": { - "fabricloader": ">=0.14.24", + "fabricloader": ">=0.15.0", "fabric": "*", "minecraft": "~1.20", "java": ">=17"