From aa7191801d17b7c93d3576c6db77ded580fbd651 Mon Sep 17 00:00:00 2001 From: FlorianMichael <60033407+FlorianMichael@users.noreply.github.com> Date: Sun, 12 Nov 2023 23:23:43 +0100 Subject: [PATCH] Implemented sprinting condition changes in 1.19.x protocols --- .../entity/MixinClientPlayerEntity.java | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinClientPlayerEntity.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinClientPlayerEntity.java index b435930af..67deff7e3 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinClientPlayerEntity.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinClientPlayerEntity.java @@ -17,12 +17,8 @@ */ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.entity; -import com.llamalad7.mixinextras.injector.WrapWithCondition; import com.mojang.authlib.GameProfile; import de.florianmichael.viafabricplus.definition.ClientsideFixes; -import net.minecraft.client.network.ClientPlayNetworkHandler; -import net.minecraft.network.packet.Packet; -import net.minecraft.network.packet.c2s.play.ClientCommandC2SPacket; import net.minecraft.world.GameMode; import net.raphimc.vialoader.util.VersionEnum; import de.florianmichael.viafabricplus.settings.impl.DebugSettings; @@ -220,6 +216,22 @@ public boolean removeBl8Boolean(boolean value) { return value; } + @Redirect(method = "canStartSprinting", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;isFallFlying()Z")) + public boolean removeElytraMovementCheck(ClientPlayerEntity instance) { + if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_19_4)) { + return false; + } + return instance.isFallFlying(); + } + + @Redirect(method = "canSprint", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;hasVehicle()Z")) + public boolean removeVehicleCondition(ClientPlayerEntity instance) { + if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_19_1tor1_19_2)) { + return false; + } + return instance.hasVehicle(); + } + @Override public boolean isCreative() { if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_7_6tor1_7_10)) {