Fixup sneaking dimension fix in <= 1.8

MC 1.20.5 changed pose dimensions to include the eye height which caused our old code to break / returning an eye height causing the client to not sneaking internally, this hasn't been noticed since our camera mixin overrides sneaking logic.

Closes https://github.com/ViaVersion/ViaFabricPlus/issues/472
This commit is contained in:
FlorianMichael 2024-07-11 03:55:13 +02:00
parent 6c01ce0b47
commit 947b135a8b
No known key found for this signature in database
GPG Key ID: C2FB87E71C425126

View File

@ -66,7 +66,12 @@ public abstract class MixinPlayerEntity extends LivingEntity {
PlayerInventory inventory;
@Unique
private static final EntityDimensions viaFabricPlus$sneaking_dimensions_v1_13_2 = EntityDimensions.changing(0.6F, 1.65F).withEyeHeight(1.54F).withAttachments(EntityAttachments.builder().add(EntityAttachmentType.VEHICLE, PlayerEntity.VEHICLE_ATTACHMENT_POS));
private static final EntityDimensions viaFabricPlus$sneaking_dimensions_v1_13_2 = EntityDimensions.changing(0.6F, 1.65F).withEyeHeight(1.54F).
withAttachments(EntityAttachments.builder().add(EntityAttachmentType.VEHICLE, PlayerEntity.VEHICLE_ATTACHMENT_POS));
@Unique
private static final EntityDimensions viaFabricPlus$sneaking_dimensions_v1_8 = EntityDimensions.changing(0.6F, 1.8F).withEyeHeight(1.54F).
withAttachments(EntityAttachments.builder().add(EntityAttachmentType.VEHICLE, PlayerEntity.VEHICLE_ATTACHMENT_POS));
@Unique
private static final SoundEvent viaFabricPlus$oof_hurt = SoundEvent.of(Identifier.of("viafabricplus", "oof.hurt"));
@ -156,7 +161,7 @@ public abstract class MixinPlayerEntity extends LivingEntity {
private void modifyDimensions(EntityPose pose, CallbackInfoReturnable<EntityDimensions> cir) {
if (pose == EntityPose.CROUCHING) {
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) {
cir.setReturnValue(PlayerEntity.STANDING_DIMENSIONS);
cir.setReturnValue(viaFabricPlus$sneaking_dimensions_v1_8);
} else if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_13_2)) {
cir.setReturnValue(viaFabricPlus$sneaking_dimensions_v1_13_2);
}