禁用瞄准时跑步
This commit is contained in:
parent
77fa71a9ee
commit
625283ac73
1 changed files with 14 additions and 0 deletions
|
@ -1,9 +1,14 @@
|
||||||
package com.atsuishio.superbwarfare.mixins;
|
package com.atsuishio.superbwarfare.mixins;
|
||||||
|
|
||||||
import com.atsuishio.superbwarfare.entity.ICustomKnockback;
|
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 net.minecraft.world.entity.LivingEntity;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Unique;
|
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)
|
@Mixin(LivingEntity.class)
|
||||||
public class LivingEntityMixin implements ICustomKnockback {
|
public class LivingEntityMixin implements ICustomKnockback {
|
||||||
|
@ -25,4 +30,13 @@ public class LivingEntityMixin implements ICustomKnockback {
|
||||||
public double superbWarfare$getKnockbackStrength() {
|
public double superbWarfare$getKnockbackStrength() {
|
||||||
return this.superbwarfare$knockbackStrength;
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue