Fixed bad packet checks

This commit is contained in:
FlorianMichael 2023-06-04 18:38:07 +02:00
parent 9453d26b81
commit c61605775f
No known key found for this signature in database
GPG Key ID: C2FB87E71C425126
2 changed files with 16 additions and 3 deletions

View File

@ -19,7 +19,6 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.entity;
import com.mojang.authlib.GameProfile;
import net.raphimc.vialoader.util.VersionEnum;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import de.florianmichael.viafabricplus.base.settings.groups.DebugSettings;
import de.florianmichael.viafabricplus.definition.v1_8.ArmorPointCalculation;
import de.florianmichael.viafabricplus.injection.access.IClientPlayerEntity;
@ -167,6 +166,14 @@ public abstract class MixinClientPlayerEntity extends AbstractClientPlayerEntity
}
}
@Redirect(method = "tickMovement", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;isClimbing()Z"))
public boolean alwaysSendPacket(ClientPlayerEntity instance) {
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_15_2)) {
return false;
}
return isClimbing();
}
@Redirect(method = "autoJump", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/math/MathHelper;inverseSqrt(F)F"))
public float useFastInverse(float x) {
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_19_3)) {

View File

@ -17,8 +17,8 @@
*/
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.entity;
import net.minecraft.util.Hand;
import net.raphimc.vialoader.util.VersionEnum;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import de.florianmichael.viafabricplus.base.settings.groups.VisualSettings;
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
import net.minecraft.entity.EntityDimensions;
@ -31,7 +31,6 @@ import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.sound.SoundEvent;
import net.minecraft.util.Identifier;
import net.minecraft.world.World;
import net.raphimc.viabedrock.api.BedrockProtocolVersion;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
@ -115,6 +114,13 @@ public abstract class MixinPlayerEntity extends LivingEntity {
}
}
@Redirect(method = "dropItem(Lnet/minecraft/item/ItemStack;ZZ)Lnet/minecraft/entity/ItemEntity;", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/PlayerEntity;swingHand(Lnet/minecraft/util/Hand;)V"))
public void dontSwingHand(PlayerEntity instance, Hand hand) {
if (ProtocolHack.getTargetVersion().isOlderThan(VersionEnum.r1_15_2)) return;
instance.swingHand(hand);
}
@Unique
public boolean viafabricplus_isSprinting;