From 10c775fe40dce31bd0662c9bd4b8ade85658f156 Mon Sep 17 00:00:00 2001 From: Wyvest <45589059+Wyvest@users.noreply.github.com> Date: Thu, 10 Feb 2022 11:06:14 +0700 Subject: [PATCH] fix: fix asm not applying in prod env --- gradle.properties | 2 +- .../net/wyvest/redaction/mixin/RenderManagerMixin.java | 4 ++-- src/main/kotlin/net/wyvest/redaction/Redaction.kt | 2 +- .../net/wyvest/redaction/plugin/RedactionMixinPlugin.kt | 2 +- src/main/kotlin/net/wyvest/redaction/utils/MathUtil.kt | 7 ------- 5 files changed, 5 insertions(+), 12 deletions(-) diff --git a/gradle.properties b/gradle.properties index cc090b2..3892398 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,4 +3,4 @@ org.gradle.jvmargs=-Xmx2G # Define project properties. mod_name=REDACTION -mod_ver=1.1.0-pre1 \ No newline at end of file +mod_ver=1.1.0 \ No newline at end of file diff --git a/src/main/java/net/wyvest/redaction/mixin/RenderManagerMixin.java b/src/main/java/net/wyvest/redaction/mixin/RenderManagerMixin.java index 5f62867..073cf33 100644 --- a/src/main/java/net/wyvest/redaction/mixin/RenderManagerMixin.java +++ b/src/main/java/net/wyvest/redaction/mixin/RenderManagerMixin.java @@ -20,7 +20,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import org.spongepowered.asm.mixin.injection.invoke.arg.Args; -@Mixin(value = RenderManager.class, priority = Integer.MIN_VALUE) +@Mixin(value = RenderManager.class) public class RenderManagerMixin { private boolean box = true; private boolean eye = true; @@ -114,7 +114,7 @@ private void modifyEyeLineColor(Args args) { } @Inject(method = "renderDebugBoundingBox", at = @At("RETURN")) - private void resetEmulatedPlayerHitboxBypass(net.minecraft.entity.Entity entityIn, double x, double y, double z, float entityYaw, float partialTicks, CallbackInfo ci) { + private void resetLineWidth(net.minecraft.entity.Entity entityIn, double x, double y, double z, float entityYaw, float partialTicks, CallbackInfo ci) { GL11.glLineWidth(1); } } diff --git a/src/main/kotlin/net/wyvest/redaction/Redaction.kt b/src/main/kotlin/net/wyvest/redaction/Redaction.kt index ed42e95..a4e34ca 100644 --- a/src/main/kotlin/net/wyvest/redaction/Redaction.kt +++ b/src/main/kotlin/net/wyvest/redaction/Redaction.kt @@ -28,7 +28,7 @@ object Redaction { const val NAME = "REDACTION" - const val VERSION = "1.1.0-beta2" + const val VERSION = "1.1.0" const val ID = "redaction" val mc: Minecraft get() = Minecraft.getMinecraft() diff --git a/src/main/kotlin/net/wyvest/redaction/plugin/RedactionMixinPlugin.kt b/src/main/kotlin/net/wyvest/redaction/plugin/RedactionMixinPlugin.kt index 47af6b4..5e2ee32 100644 --- a/src/main/kotlin/net/wyvest/redaction/plugin/RedactionMixinPlugin.kt +++ b/src/main/kotlin/net/wyvest/redaction/plugin/RedactionMixinPlugin.kt @@ -46,7 +46,7 @@ class RedactionMixinPlugin : IMixinConfigPlugin { if (!returned) { if (targetClass != null && targetClassName == "net.minecraft.client.renderer.entity.RenderManager") { for (method in targetClass.methods) { - if (method.name == "renderDebugBoundingBox") { + if (method.name == "renderDebugBoundingBox" || method.name == "func_85094_b") { for (insn in method.instructions) { if (insn.opcode == Opcodes.INVOKESPECIAL && (insn as MethodInsnNode).name.contains("cancelIfEmulatedPlayer")) { val fieldinsn = FieldInsnNode(Opcodes.GETSTATIC, "net/wyvest/redaction/gui/HitboxPreviewGUI", "Companion", "Lnet/wyvest/redaction/gui/HitboxPreviewGUI\$Companion;") diff --git a/src/main/kotlin/net/wyvest/redaction/utils/MathUtil.kt b/src/main/kotlin/net/wyvest/redaction/utils/MathUtil.kt index e9fec6d..227c3db 100644 --- a/src/main/kotlin/net/wyvest/redaction/utils/MathUtil.kt +++ b/src/main/kotlin/net/wyvest/redaction/utils/MathUtil.kt @@ -10,11 +10,4 @@ object MathUtil { if (value.toDouble() < 0.0) return 0.0f return if (value.toDouble() > 1.0) 1f else value } - /** - * Taken from Wynntils under GNU Affero General Public License v3.0 - * https://github.com/Wynntils/Wynntils/blob/development/LICENSE - * @author Wynntils - * @return par0 cast as an int, and no greater than Integer.MAX_VALUE-1024 - */ - fun fastFloor(value: Double) = (value + 1024.0).toInt() - 1024 } \ No newline at end of file