From d6f8496580bd71253b272e94a541be37a4ccd083 Mon Sep 17 00:00:00 2001
From: ccetl <109693935+ccetl@users.noreply.github.com>
Date: Thu, 23 Jan 2025 19:40:41 +0100
Subject: [PATCH] fix: MeteorClient compatibility (#5424)
---
.../minecraft/entity/MixinLivingEntity.java | 8 ----
.../MixinLivingEntityCompatibility.java | 39 +++++++++++++++++++
src/main/resources/liquidbounce.mixins.json | 3 +-
3 files changed, 41 insertions(+), 9 deletions(-)
create mode 100644 src/main/java/net/ccbluex/liquidbounce/injection/mixins/minecraft/entity/MixinLivingEntityCompatibility.java
diff --git a/src/main/java/net/ccbluex/liquidbounce/injection/mixins/minecraft/entity/MixinLivingEntity.java b/src/main/java/net/ccbluex/liquidbounce/injection/mixins/minecraft/entity/MixinLivingEntity.java
index 0516e990881..83e0f3ab25e 100644
--- a/src/main/java/net/ccbluex/liquidbounce/injection/mixins/minecraft/entity/MixinLivingEntity.java
+++ b/src/main/java/net/ccbluex/liquidbounce/injection/mixins/minecraft/entity/MixinLivingEntity.java
@@ -16,7 +16,6 @@
* You should have received a copy of the GNU General Public License
* along with LiquidBounce. If not, see .
*/
-
package net.ccbluex.liquidbounce.injection.mixins.minecraft.entity;
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
@@ -25,7 +24,6 @@
import net.ccbluex.liquidbounce.event.events.PlayerAfterJumpEvent;
import net.ccbluex.liquidbounce.event.events.PlayerJumpEvent;
import net.ccbluex.liquidbounce.features.module.modules.movement.*;
-import net.ccbluex.liquidbounce.features.module.modules.render.ModuleAnimations;
import net.ccbluex.liquidbounce.features.module.modules.render.ModuleAntiBlind;
import net.ccbluex.liquidbounce.features.module.modules.world.scaffold.ModuleScaffold;
import net.ccbluex.liquidbounce.utils.aiming.RotationManager;
@@ -44,9 +42,7 @@
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
-import org.spongepowered.asm.mixin.injection.Constant;
import org.spongepowered.asm.mixin.injection.Inject;
-import org.spongepowered.asm.mixin.injection.ModifyConstant;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@@ -279,8 +275,4 @@ private Vec3d hookModifyFallFlyingRotationVector(Vec3d original) {
return rotation.getRotationVec();
}
- @ModifyConstant(method = "getHandSwingDuration", constant = @Constant(intValue = 6))
- private int hookSwingSpeed(int constant) {
- return ModuleAnimations.INSTANCE.getRunning() ? ModuleAnimations.INSTANCE.getSwingDuration() : constant;
- }
}
diff --git a/src/main/java/net/ccbluex/liquidbounce/injection/mixins/minecraft/entity/MixinLivingEntityCompatibility.java b/src/main/java/net/ccbluex/liquidbounce/injection/mixins/minecraft/entity/MixinLivingEntityCompatibility.java
new file mode 100644
index 00000000000..15509f646f0
--- /dev/null
+++ b/src/main/java/net/ccbluex/liquidbounce/injection/mixins/minecraft/entity/MixinLivingEntityCompatibility.java
@@ -0,0 +1,39 @@
+/*
+ * This file is part of LiquidBounce (https://github.com/CCBlueX/LiquidBounce)
+ *
+ * Copyright (c) 2015 - 2025 CCBlueX
+ *
+ * LiquidBounce is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * LiquidBounce is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with LiquidBounce. If not, see .
+ */
+package net.ccbluex.liquidbounce.injection.mixins.minecraft.entity;
+
+import net.ccbluex.liquidbounce.features.module.modules.render.ModuleAnimations;
+import net.minecraft.entity.LivingEntity;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.injection.Constant;
+import org.spongepowered.asm.mixin.injection.ModifyConstant;
+
+@Mixin(value = LivingEntity.class, priority = 999)
+public abstract class MixinLivingEntityCompatibility {
+
+ // this is here and not in the MixinLivingEntity class to apply a priority of 999
+ // while keeping the higher priority for all other methods in MixinLivingEntity
+ // require = 0 and priority = 999 avoid with Mixin conflicts with mods that target the same constant
+ @ModifyConstant(method = "getHandSwingDuration", constant = @Constant(intValue = 6), require = 0)
+ private int hookSwingSpeed(int constant) {
+ var animations = ModuleAnimations.INSTANCE;
+ return animations.getRunning() ? animations.getSwingDuration() : constant;
+ }
+
+}
diff --git a/src/main/resources/liquidbounce.mixins.json b/src/main/resources/liquidbounce.mixins.json
index 2c53a38ace5..525389d9ab2 100644
--- a/src/main/resources/liquidbounce.mixins.json
+++ b/src/main/resources/liquidbounce.mixins.json
@@ -106,7 +106,8 @@
"truffle.MixinHostClassDesc",
"truffle.MixinHostClassLoader",
"truffle.MixinHostContext",
- "truffle.MixinTruffleLanguage"
+ "truffle.MixinTruffleLanguage",
+ "minecraft.entity.MixinLivingEntityCompatibility"
],
"server": [],
"injectors": {