diff --git a/src/main/java/sh/ndy/ToggleNametagsClient.java b/src/main/java/sh/ndy/ToggleNametagsClient.java index 24db879..a247ea9 100644 --- a/src/main/java/sh/ndy/ToggleNametagsClient.java +++ b/src/main/java/sh/ndy/ToggleNametagsClient.java @@ -58,7 +58,7 @@ public void onInitializeClient() { //? if < 26.2 { // context.getSource().getClient().schedule(() -> c.setScreen(new ConfigScreen(null, null))); //?} else - context.getSource().getClient().schedule(() -> c.setScreenAndShow(new ConfigScreen(null, null))); + context.getSource().getClient().schedule(() -> c.gui.setScreen(new ConfigScreen(null, null))); return 1; })); diff --git a/src/main/java/sh/ndy/mixin/client/MixinNametagsBackgroundOpacity.java b/src/main/java/sh/ndy/mixin/client/MixinNametagsBackgroundOpacity.java index a2a7995..1b71898 100644 --- a/src/main/java/sh/ndy/mixin/client/MixinNametagsBackgroundOpacity.java +++ b/src/main/java/sh/ndy/mixin/client/MixinNametagsBackgroundOpacity.java @@ -12,14 +12,17 @@ //? if < 26.2 { /* @Mixin(NameTagFeatureRenderer.Storage.class) */ -//?} else { +//?} + +//? if >= 26.2 { @Mixin(NameTagFeatureRenderer.class) //?} public class MixinNametagsBackgroundOpacity { //? if < 26.2 { /* @Unique private static final String TARGET = "Lnet/minecraft/client/renderer/state/OptionsRenderState;getBackgroundOpacity(F)F"; */ - //?} else + //?} else { @Unique private static final String TARGET = "Lnet/minecraft/client/gui/Font;prepareText(Lnet/minecraft/util/FormattedCharSequence;FFIZZI)Lnet/minecraft/client/gui/Font$PreparedText;"; + //?} //? if < 26.2 { /* @ModifyExpressionValue( @@ -32,7 +35,9 @@ public class MixinNametagsBackgroundOpacity { private float changeOpacity(float original) { return (float) Config.getOptions().getNametagOpacity(); } - *///?} else { + *///?} + + //? if >= 26.2 { @ModifyArg( method = "prepareText", at = @At( diff --git a/src/main/java/sh/ndy/mixin/client/MixinNametagsTextShadow.java b/src/main/java/sh/ndy/mixin/client/MixinNametagsTextShadow.java index a2f0e4a..ff9b72b 100644 --- a/src/main/java/sh/ndy/mixin/client/MixinNametagsTextShadow.java +++ b/src/main/java/sh/ndy/mixin/client/MixinNametagsTextShadow.java @@ -9,24 +9,25 @@ @Mixin(NameTagFeatureRenderer.class) public class MixinNametagsTextShadow { + private static final NametagsTextShadowListener listener = new NametagsTextShadowListener(); + //? if < 26.2 { /* @Unique private static final String TARGET = - "Lnet/minecraft/client/gui/Font;drawInBatch(Lnet/minecraft/network/chat/Component;FFIZLorg/joml/Matrix4fc;Lnet/minecraft/client/renderer/MultiBufferSource;Lnet/minecraft/client/gui/Font$DisplayMode;II)V"; - *///?} else { + "Lnet/minecraft/client/gui/Font;drawInBatch(Lnet/minecraft/network/chat/Component;FFIZLorg/joml/Matrix4fc;Lnet/minecraft/client/renderer/MultiBufferSource;Lnet/minecraft/client/gui/Font$DisplayMode;II)V"; */ + //?} else { @Unique private static final String TARGET = "Lnet/minecraft/client/gui/Font;prepareText(Lnet/minecraft/util/FormattedCharSequence;FFIZZI)Lnet/minecraft/client/gui/Font$PreparedText;"; //?} - private static final NametagsTextShadowListener listener = new NametagsTextShadowListener(); - //? if < 26.2 { /* - @ModifyArg(method = "renderTranslucent", at = @At(value = "INVOKE", target = TARGET)) - private boolean render(boolean original) { - return listener.handleMixin(); - } - */ - //?} else { + @ModifyArg(method = "renderTranslucent", at = @At(value = "INVOKE", target = TARGET)) + private boolean render(boolean original) { + return listener.handleMixin(); + } + *///?} + + //? if >= 26.2 { @ModifyArg(method = "prepareText", at = @At(value = "INVOKE", target = TARGET), index = 4 @@ -35,5 +36,4 @@ private static boolean render(boolean drawShadow) { return listener.handleMixin(); } //?} - } diff --git a/src/main/java/sh/ndy/screens/ConfigScreen.java b/src/main/java/sh/ndy/screens/ConfigScreen.java index 61f9e60..0fc10b2 100644 --- a/src/main/java/sh/ndy/screens/ConfigScreen.java +++ b/src/main/java/sh/ndy/screens/ConfigScreen.java @@ -154,6 +154,6 @@ public void onClose() { //? if < 26.2 { // this.minecraft.setScreen(parent); //?} else - this.minecraft.setScreenAndShow(parent); + this.minecraft.gui.setScreen(parent); } }