From 625283ac7350a29f75fa5bd667bef778e1c14681 Mon Sep 17 00:00:00 2001 From: 17146 <1714673995@qq.com> Date: Tue, 22 Apr 2025 23:26:55 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A6=81=E7=94=A8=E7=9E=84=E5=87=86=E6=97=B6?= =?UTF-8?q?=E8=B7=91=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../superbwarfare/mixins/LivingEntityMixin.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/main/java/com/atsuishio/superbwarfare/mixins/LivingEntityMixin.java b/src/main/java/com/atsuishio/superbwarfare/mixins/LivingEntityMixin.java index 4a2f0c727..74f1d4a7d 100644 --- a/src/main/java/com/atsuishio/superbwarfare/mixins/LivingEntityMixin.java +++ b/src/main/java/com/atsuishio/superbwarfare/mixins/LivingEntityMixin.java @@ -1,9 +1,14 @@ package com.atsuishio.superbwarfare.mixins; import com.atsuishio.superbwarfare.entity.ICustomKnockback; +import com.atsuishio.superbwarfare.event.ClientEventHandler; +import net.minecraft.client.player.LocalPlayer; import net.minecraft.world.entity.LivingEntity; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Unique; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @Mixin(LivingEntity.class) public class LivingEntityMixin implements ICustomKnockback { @@ -25,4 +30,13 @@ public class LivingEntityMixin implements ICustomKnockback { public double superbWarfare$getKnockbackStrength() { return this.superbwarfare$knockbackStrength; } + + @Inject(method = "setSprinting(Z)V", at = @At("HEAD"), cancellable = true) + public void setSprinting(boolean pSprinting, CallbackInfo ci) { + if (((LivingEntity) (Object) this) instanceof LocalPlayer) { + if (pSprinting && ClientEventHandler.zoom) { + ci.cancel(); + } + } + } } \ No newline at end of file