Handle more 1.20.3->.5 changes

This commit is contained in:
FlorianMichael 2024-05-26 15:52:34 +02:00
parent 277f483b6a
commit 8f9ab00b94
No known key found for this signature in database
GPG Key ID: C2FB87E71C425126
2 changed files with 19 additions and 0 deletions

View File

@ -76,6 +76,11 @@ public abstract class MixinClientPlayerEntity extends AbstractClientPlayerEntity
@Shadow
public abstract void setClientPermissionLevel(int clientPermissionLevel);
@WrapWithCondition(method = "tickMovement", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;jump()V"))
private boolean dontJump(ClientPlayerEntity instance) {
return ProtocolTranslator.getTargetVersion().newerThan(ProtocolVersion.v1_20_5);
}
@Redirect(method = "tickMovement", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;hasVehicle()Z", ordinal = 0))
private boolean removeVehicleRequirement(ClientPlayerEntity instance) {
return ProtocolTranslator.getTargetVersion().newerThan(ProtocolVersion.v1_20) && instance.hasVehicle();

View File

@ -86,6 +86,20 @@ public abstract class MixinClientPlayNetworkHandler extends ClientCommonNetworkH
return ProtocolTranslator.getTargetVersion().newerThanOrEqualTo(ProtocolVersion.v1_20_5);
}
@Inject(method = "onEnterReconfiguration", at = @At("HEAD"))
private void disableAutoRead(EnterReconfigurationS2CPacket packet, CallbackInfo ci) {
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_20_3)) {
this.connection.channel.config().setAutoRead(false);
}
}
@Inject(method = "onEnterReconfiguration", at = @At("RETURN"))
private void enableAutoRead(EnterReconfigurationS2CPacket packet, CallbackInfo ci) {
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_20_3)) {
this.connection.channel.config().setAutoRead(true);
}
}
@Redirect(method = "sendChatCommand", at = @At(value = "INVOKE", target = "Ljava/util/List;isEmpty()Z"))
private boolean alwaysSignCommands(List<?> instance) {
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_20_3)) {