Fix sprinting and sneaking packet order in <= 1.21.1

This commit is contained in:
RaphiMC 2024-10-28 00:11:59 +01:00
parent 5a64809ad6
commit 3195eeb5a0
No known key found for this signature in database
GPG Key ID: 0F6BB0657A03AC94
2 changed files with 9 additions and 8 deletions

View File

@ -78,18 +78,21 @@ public abstract class MixinClientPlayerEntity extends AbstractClientPlayerEntity
@Shadow
public abstract void setClientPermissionLevel(int clientPermissionLevel);
@Shadow private boolean inSneakingPose;
@Shadow
private boolean inSneakingPose;
@Shadow protected abstract void sendSneakingPacket();
@Shadow
protected abstract void sendSneakingPacket();
@Shadow private boolean lastHorizontalCollision;
@Shadow
private boolean lastHorizontalCollision;
@WrapWithCondition(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;sendSneakingPacket()V"))
private boolean sendSneakingAfterSprinting(ClientPlayerEntity instance) {
return ProtocolTranslator.getTargetVersion().newerThanOrEqualTo(ProtocolVersion.v1_21_2);
}
@Inject(method = "sendMovementPackets", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;sendSprintingPacket()V"))
@Inject(method = "sendMovementPackets", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;sendSprintingPacket()V", shift = At.Shift.AFTER))
private void sendSneakingAfterSprinting(CallbackInfo ci) {
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_21)) {
this.sendSneakingPacket();

View File

@ -122,6 +122,7 @@
"fixes.minecraft.entity.MixinSkeletonHorseEntity",
"fixes.minecraft.entity.MixinSquidEntity",
"fixes.minecraft.entity.MixinWolfEntity",
"fixes.minecraft.entity.MixinZombieVillagerEntity",
"fixes.minecraft.item.MixinAxeItem",
"fixes.minecraft.item.MixinBlockItem",
"fixes.minecraft.item.MixinBowItem",
@ -218,8 +219,5 @@
},
"overwrites": {
"requireAnnotations": true
},
"mixins": [
"fixes.minecraft.entity.MixinZombieVillagerEntity"
]
}
}