Implemented sprinting condition changes in 1.19.x protocols

This commit is contained in:
FlorianMichael 2023-11-12 23:23:43 +01:00
parent 9878f247bd
commit aa7191801d
No known key found for this signature in database
GPG Key ID: C2FB87E71C425126

View File

@ -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 abstract class MixinClientPlayerEntity extends AbstractClientPlayerEntity
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)) {