mirror of
https://github.com/ViaVersion/ViaFabricPlus.git
synced 2024-11-25 12:25:22 +01:00
Allow sneaking inside blocks/vehicles in <= 1.13.2
Closes https://github.com/ViaVersion/ViaFabricPlus/issues/506
This commit is contained in:
parent
84b3a9537a
commit
2ce5975d19
@ -35,7 +35,6 @@ import net.minecraft.client.network.ClientPlayNetworkHandler;
|
||||
import net.minecraft.client.network.ClientPlayerEntity;
|
||||
import net.minecraft.client.world.ClientWorld;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.PlayerAbilities;
|
||||
import net.minecraft.entity.vehicle.BoatEntity;
|
||||
import net.minecraft.network.packet.Packet;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
@ -76,6 +75,8 @@ public abstract class MixinClientPlayerEntity extends AbstractClientPlayerEntity
|
||||
@Shadow
|
||||
public abstract void setClientPermissionLevel(int clientPermissionLevel);
|
||||
|
||||
@Shadow private boolean inSneakingPose;
|
||||
|
||||
@WrapWithCondition(method = "tickMovement", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;jump()V"))
|
||||
private boolean dontJumpBeforeFlying(ClientPlayerEntity instance) {
|
||||
return ProtocolTranslator.getTargetVersion().newerThanOrEqualTo(ProtocolVersion.v1_20_5);
|
||||
@ -184,9 +185,11 @@ public abstract class MixinClientPlayerEntity extends AbstractClientPlayerEntity
|
||||
return ProtocolTranslator.getTargetVersion().newerThan(ProtocolVersion.v1_14_1) && instance.isSwimming();
|
||||
}
|
||||
|
||||
@Redirect(method = "tickMovement", at = @At(value = "FIELD", target = "Lnet/minecraft/entity/player/PlayerAbilities;flying:Z", ordinal = 0))
|
||||
private boolean allowSneakingWhileFlying(PlayerAbilities instance) {
|
||||
return ProtocolTranslator.getTargetVersion().newerThan(ProtocolVersion.v1_13_2) && instance.flying;
|
||||
@Inject(method = "tickMovement", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;getAttributeValue(Lnet/minecraft/registry/entry/RegistryEntry;)D"))
|
||||
private void removeSneakingConditions(CallbackInfo ci) { // Allows sneaking while flying, inside blocks and vehicles
|
||||
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_13_2)) {
|
||||
this.inSneakingPose = this.isSneaking() && !this.isSleeping();
|
||||
}
|
||||
}
|
||||
|
||||
@Redirect(method = "tickMovement", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;isTouchingWater()Z"))
|
||||
|
Loading…
Reference in New Issue
Block a user