Skip to content

Commit

Permalink
fix: MeteorClient compatibility (#5424)
Browse files Browse the repository at this point in the history
  • Loading branch information
ccetl authored Jan 23, 2025
1 parent 6729685 commit d6f8496
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
* You should have received a copy of the GNU General Public License
* along with LiquidBounce. If not, see <https://www.gnu.org/licenses/>.
*/

package net.ccbluex.liquidbounce.injection.mixins.minecraft.entity;

import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
Expand All @@ -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;
Expand All @@ -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;

Expand Down Expand Up @@ -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;
}
}
Original file line number Diff line number Diff line change
@@ -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 <https://www.gnu.org/licenses/>.
*/
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;
}

}
3 changes: 2 additions & 1 deletion src/main/resources/liquidbounce.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@
"truffle.MixinHostClassDesc",
"truffle.MixinHostClassLoader",
"truffle.MixinHostContext",
"truffle.MixinTruffleLanguage"
"truffle.MixinTruffleLanguage",
"minecraft.entity.MixinLivingEntityCompatibility"
],
"server": [],
"injectors": {
Expand Down

0 comments on commit d6f8496

Please sign in to comment.