Skip to content

Commit

Permalink
Implemented sprinting condition changes in 1.19.x protocols
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorianMichael committed Nov 12, 2023
1 parent 9878f24 commit aa71918
Showing 1 changed file with 16 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)) {
Expand Down

0 comments on commit aa71918

Please sign in to comment.