mirror of
https://github.com/ViaVersion/ViaFabricPlus.git
synced 2025-01-25 22:11:32 +01:00
Use MixinExtras annotations
This commit is contained in:
parent
513ba5bfc3
commit
a861237423
@ -20,6 +20,7 @@
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft;
|
||||
|
||||
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
|
||||
import com.llamalad7.mixinextras.injector.WrapWithCondition;
|
||||
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.protocols.protocol1_12to1_11_1.Protocol1_12To1_11_1;
|
||||
@ -135,10 +136,9 @@ public abstract class MixinMinecraftClient {
|
||||
}
|
||||
}
|
||||
|
||||
@Redirect(method = "doAttack", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;swingHand(Lnet/minecraft/util/Hand;)V"))
|
||||
private void fixSwingPacketOrder(ClientPlayerEntity instance, Hand hand) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_8)) return;
|
||||
instance.swingHand(Hand.MAIN_HAND);
|
||||
@WrapWithCondition(method = "doAttack", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;swingHand(Lnet/minecraft/util/Hand;)V"))
|
||||
private boolean fixSwingPacketOrder(ClientPlayerEntity instance, Hand hand) {
|
||||
return ProtocolHack.getTargetVersion().isNewerThan(VersionEnum.r1_8);
|
||||
}
|
||||
|
||||
@Redirect(method = "tick", at = @At(value = "FIELD", target = "Lnet/minecraft/client/MinecraftClient;attackCooldown:I", ordinal = 1))
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.entity;
|
||||
|
||||
import com.llamalad7.mixinextras.injector.WrapWithCondition;
|
||||
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||
import de.florianmichael.viafabricplus.settings.impl.VisualSettings;
|
||||
import net.minecraft.block.BlockState;
|
||||
@ -93,12 +94,9 @@ public abstract class MixinPlayerEntity extends LivingEntity {
|
||||
return instance.isSprinting();
|
||||
}
|
||||
|
||||
|
||||
@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"))
|
||||
private void dontSwingHand(PlayerEntity instance, Hand hand) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_15_2)) return;
|
||||
|
||||
instance.swingHand(hand);
|
||||
@WrapWithCondition(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"))
|
||||
private boolean dontSwingHand(PlayerEntity instance, Hand hand) {
|
||||
return ProtocolHack.getTargetVersion().isNewerThan(VersionEnum.r1_15_2);
|
||||
}
|
||||
|
||||
@Redirect(method = "checkFallFlying", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/PlayerEntity;hasStatusEffect(Lnet/minecraft/entity/effect/StatusEffect;)Z"))
|
||||
|
Loading…
Reference in New Issue
Block a user