Skip to content

Commit

Permalink
Compat latest Jade(#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
Hendrix-Shen committed Nov 20, 2022
1 parent 9e9245a commit 5ae910f
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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"
),
Expand Down
34 changes: 22 additions & 12 deletions src/main/java/top/hendrixshen/tweakmyclient/util/JadeUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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();
Expand Down Expand Up @@ -97,29 +102,34 @@ 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;
return;
}
}

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;
}
Expand Down
4 changes: 2 additions & 2 deletions versions/1.19.2/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5ae910f

Please sign in to comment.