From 5ae910f2aaaa2a244a271da43afa854c1cd78750 Mon Sep 17 00:00:00 2001 From: Hendrix-Shen Date: Sun, 20 Nov 2022 14:28:56 +0800 Subject: [PATCH] Compat latest Jade(#20) --- .../jade/MixinOverlayRenderer.java | 6 +++- .../tweakmyclient/util/JadeUtil.java | 34 ++++++++++++------- versions/1.19.2/gradle.properties | 4 +-- 3 files changed, 29 insertions(+), 15 deletions(-) diff --git a/src/main/java/top/hendrixshen/tweakmyclient/mixin/patch/litematicaSchematicWailaCompat/jade/MixinOverlayRenderer.java b/src/main/java/top/hendrixshen/tweakmyclient/mixin/patch/litematicaSchematicWailaCompat/jade/MixinOverlayRenderer.java index 7243cae8..c4eed7f9 100644 --- a/src/main/java/top/hendrixshen/tweakmyclient/mixin/patch/litematicaSchematicWailaCompat/jade/MixinOverlayRenderer.java +++ b/src/main/java/top/hendrixshen/tweakmyclient/mixin/patch/litematicaSchematicWailaCompat/jade/MixinOverlayRenderer.java @@ -28,7 +28,11 @@ public class MixinOverlayRenderer { //#if MC >= 11802 @Inject( - method = "renderOverlay(Lcom/mojang/blaze3d/vertex/PoseStack;)V", + //#if MC >= 11902 + method = "renderOverlay478757", + //#else + //$$ method = "renderOverlay(Lcom/mojang/blaze3d/vertex/PoseStack;)V", + //#endif at = @At( value = "HEAD" ), diff --git a/src/main/java/top/hendrixshen/tweakmyclient/util/JadeUtil.java b/src/main/java/top/hendrixshen/tweakmyclient/util/JadeUtil.java index ae85a860..48f22b17 100644 --- a/src/main/java/top/hendrixshen/tweakmyclient/util/JadeUtil.java +++ b/src/main/java/top/hendrixshen/tweakmyclient/util/JadeUtil.java @@ -26,6 +26,9 @@ import snownee.jade.overlay.DatapackBlockManager; import snownee.jade.overlay.OverlayRenderer; import snownee.jade.overlay.TooltipRenderer; +//#if MC > 11802 +import snownee.jade.util.ClientPlatformProxy; +//#endif import top.hendrixshen.tweakmyclient.TweakMyClient; import top.hendrixshen.tweakmyclient.mixin.accessor.PlayerTabOverlayAccessor; //#endif @@ -40,7 +43,9 @@ public static boolean shouldDisableJadeRender() { return JadeUtil.disableJadeRender; } - @SuppressWarnings("deprecation") + //#if MC < 11900 + //$$ @SuppressWarnings("deprecation") + //#endif public static void tick() { JadeUtil.disableJadeRender = false; IWailaConfig.IConfigGeneral config = Jade.CONFIG.get().getGeneral(); @@ -97,13 +102,20 @@ public static void tick() { return; } - boolean showDetails = localPlayer.isCrouching(); + //#if MC < 11900 + //$$ boolean showDetails = localPlayer.isCrouching(); + //#endif if (accessor.isServerConnected()) { boolean request = accessor.shouldRequestData(); if (ObjectDataCenter.isTimeElapsed(ObjectDataCenter.rateLimiter)) { ObjectDataCenter.resetTimer(); - if (request) - accessor._requestData(showDetails); + if (request) { + //#if MC > 11802 + accessor._requestData(); + //#else + //$$ accessor._requestData(showDetails); + //#endif + } } if (request && ObjectDataCenter.getServerData() == null) { JadeUtil.tooltipRenderer = null; @@ -111,15 +123,13 @@ public static void tick() { } } - if (config.getDisplayMode() == IWailaConfig.DisplayMode.LITE && !showDetails) { + //#if MC > 11802 + if (config.getDisplayMode() == IWailaConfig.DisplayMode.LITE && !ClientPlatformProxy.isShowDetailsPressed()) { + //#else + //$$ if (config.getDisplayMode() == IWailaConfig.DisplayMode.LITE && !showDetails) { + //#endif Tooltip dummyTooltip = new Tooltip(); - accessor._gatherComponents($ -> { - if (Math.abs(WailaCommonRegistration.INSTANCE.priorities.get($)) > 5000) { - return tooltip; - } else { - return dummyTooltip; - } - }); + accessor._gatherComponents($ -> Math.abs(WailaCommonRegistration.INSTANCE.priorities.get($)) > 5000 ? tooltip : dummyTooltip); if (!dummyTooltip.isEmpty()) { tooltip.sneakyDetails = true; } diff --git a/versions/1.19.2/gradle.properties b/versions/1.19.2/gradle.properties index 04ee07f6..43cafce1 100644 --- a/versions/1.19.2/gradle.properties +++ b/versions/1.19.2/gradle.properties @@ -6,8 +6,8 @@ minecraft_dependency = 1.19.x # Compatible Libraries # bad packets - 0.2.0 badpackets_version = 3903798 -# Jade - 8.0.0 -jade_version = 3903418 +# Jade - 8.6.0 +jade_version = 4096403 # Litematica - 0.12.3 litematica_version = 3909447 # Not Enough Crashes - 4.1.8