mirror of
https://github.com/ViaVersion/ViaFabricPlus.git
synced 2024-11-16 10:55:39 +01:00
Set sneaking pose while flying in <= 1.13.2
1.14+ introduced a check to prevent sneaking while flying, therefore the check in MixinPlayerEntity#onUpdatePose was wrong all the time and the movement code needed fixing.
This commit is contained in:
parent
3435928fb7
commit
57cd295c7f
@ -14,5 +14,5 @@ yarn_version=1.21.1+build.1
|
|||||||
loader_version=0.15.11
|
loader_version=0.15.11
|
||||||
fabric_api_version=0.102.0+1.21.1
|
fabric_api_version=0.102.0+1.21.1
|
||||||
|
|
||||||
# empty for minecraft version above
|
# Set to empty to use the Minecraft version above
|
||||||
supported_versions=>=1.21 <=1.21.1
|
supported_versions=>=1.21 <=1.21.1
|
@ -35,6 +35,7 @@ import net.minecraft.client.network.ClientPlayNetworkHandler;
|
|||||||
import net.minecraft.client.network.ClientPlayerEntity;
|
import net.minecraft.client.network.ClientPlayerEntity;
|
||||||
import net.minecraft.client.world.ClientWorld;
|
import net.minecraft.client.world.ClientWorld;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.entity.player.PlayerAbilities;
|
||||||
import net.minecraft.entity.vehicle.BoatEntity;
|
import net.minecraft.entity.vehicle.BoatEntity;
|
||||||
import net.minecraft.network.packet.Packet;
|
import net.minecraft.network.packet.Packet;
|
||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
@ -183,6 +184,11 @@ public abstract class MixinClientPlayerEntity extends AbstractClientPlayerEntity
|
|||||||
return ProtocolTranslator.getTargetVersion().newerThan(ProtocolVersion.v1_14_1) && instance.isSwimming();
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
@Redirect(method = "tickMovement", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;isTouchingWater()Z"))
|
@Redirect(method = "tickMovement", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;isTouchingWater()Z"))
|
||||||
private boolean disableWaterRelatedMovement(ClientPlayerEntity self) {
|
private boolean disableWaterRelatedMovement(ClientPlayerEntity self) {
|
||||||
return ProtocolTranslator.getTargetVersion().newerThan(ProtocolVersion.v1_12_2) && self.isTouchingWater();
|
return ProtocolTranslator.getTargetVersion().newerThan(ProtocolVersion.v1_12_2) && self.isTouchingWater();
|
||||||
|
@ -147,7 +147,7 @@ public abstract class MixinPlayerEntity extends LivingEntity {
|
|||||||
pose = EntityPose.SWIMMING;
|
pose = EntityPose.SWIMMING;
|
||||||
} else if (this.isUsingRiptide()) {
|
} else if (this.isUsingRiptide()) {
|
||||||
pose = EntityPose.SPIN_ATTACK;
|
pose = EntityPose.SPIN_ATTACK;
|
||||||
} else if (this.isSneaking() && !this.abilities.flying) {
|
} else if (this.isSneaking()) {
|
||||||
pose = EntityPose.CROUCHING;
|
pose = EntityPose.CROUCHING;
|
||||||
} else {
|
} else {
|
||||||
pose = EntityPose.STANDING;
|
pose = EntityPose.STANDING;
|
||||||
|
Loading…
Reference in New Issue
Block a user