diff --git a/src/main/java/com/mixces/legacyanimations/mixin/FishingBobberEntityRendererMixin.java b/src/main/java/com/mixces/legacyanimations/mixin/FishingBobberEntityRendererMixin.java index f00460e..a22adb2 100644 --- a/src/main/java/com/mixces/legacyanimations/mixin/FishingBobberEntityRendererMixin.java +++ b/src/main/java/com/mixces/legacyanimations/mixin/FishingBobberEntityRendererMixin.java @@ -1,5 +1,6 @@ package com.mixces.legacyanimations.mixin; +import com.llamalad7.mixinextras.sugar.Local; import com.mixces.legacyanimations.config.LegacyAnimationsSettings; import com.mixces.legacyanimations.util.HandUtils; import net.minecraft.client.MinecraftClient; @@ -11,10 +12,12 @@ import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.projectile.FishingBobberEntity; +import net.minecraft.item.Items; import net.minecraft.util.math.MathHelper; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.ModifyArg; import org.spongepowered.asm.mixin.injection.Redirect; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @@ -51,4 +54,17 @@ public float useInterpolatedEyeHeight(PlayerEntity instance) { return MathHelper.lerp(dispatcher.camera.getLastTickDelta(), ((AccessorCamera) dispatcher.camera).getLastCameraY(), ((AccessorCamera) dispatcher.camera).getCameraY()); } + // todo Fix rod line +// @ModifyArg( +// method = "render(Lnet/minecraft/entity/projectile/FishingBobberEntity;FFLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;I)V", +// at = @At( +// value = "INVOKE", +// target = "Lnet/minecraft/client/render/Camera$Projection;getPosition(FF)Lnet/minecraft/util/math/Vec3d;" +// ), +// index = 0 +// ) +// public float fixWrongRod(float factorX, @Local(ordinal = 0) PlayerEntity playerEntity) { +// return (playerEntity.getOffHandStack().isOf(Items.FISHING_ROD) ? -1 : 1) * factorX; +// } + } diff --git a/src/main/java/com/mixces/legacyanimations/mixin/HeldItemRendererMixin.java b/src/main/java/com/mixces/legacyanimations/mixin/HeldItemRendererMixin.java index 9b44401..f3a5e32 100644 --- a/src/main/java/com/mixces/legacyanimations/mixin/HeldItemRendererMixin.java +++ b/src/main/java/com/mixces/legacyanimations/mixin/HeldItemRendererMixin.java @@ -5,6 +5,8 @@ import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; import com.llamalad7.mixinextras.sugar.Local; import com.mixces.legacyanimations.config.LegacyAnimationsSettings; +import com.mixces.legacyanimations.util.ServerUtils; +import net.minecraft.client.MinecraftClient; import net.minecraft.client.network.AbstractClientPlayerEntity; import net.minecraft.client.network.ClientPlayerEntity; import net.minecraft.client.render.VertexConsumerProvider; @@ -28,7 +30,6 @@ public abstract class HeldItemRendererMixin { @Shadow protected abstract void applySwingOffset(MatrixStack matrices, Arm arm, float swingProgress); - @Shadow protected abstract void applyEquipOffset(MatrixStack matrices, Arm arm, float equipProgress); @Shadow private float equipProgressOffHand; @Shadow private ItemStack mainHand; @Shadow private ItemStack offHand; @@ -66,7 +67,8 @@ private void addSwingOffset(AbstractClientPlayerEntity player, float tickDelta, ) ) private void addSwordBlock(AbstractClientPlayerEntity player, float tickDelta, float pitch, Hand hand, float swingProgress, ItemStack item, float equipProgress, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, CallbackInfo ci) { - if (LegacyAnimationsSettings.CONFIG.instance().oldSwordBlock && item.getItem() instanceof SwordItem && player.getOffHandStack().getItem() instanceof ShieldItem && player.isUsingItem()) { + boolean isUsing = ServerUtils.INSTANCE.isOnHypixel() ? MinecraftClient.getInstance().options.useKey.isPressed() : player.isUsingItem(); + if (LegacyAnimationsSettings.CONFIG.instance().oldSwordBlock && item.getItem() instanceof SwordItem && player.getOffHandStack().getItem() instanceof ShieldItem && isUsing) { boolean bl = hand == Hand.MAIN_HAND; Arm arm = bl ? player.getMainArm() : player.getMainArm().getOpposite(); boolean bl2 = arm == Arm.RIGHT; @@ -87,7 +89,8 @@ private void addSwordBlock(AbstractClientPlayerEntity player, float tickDelta, f ) ) private boolean disableSwingTranslation(MatrixStack instance, float x, float y, float z, AbstractClientPlayerEntity player, float tickDelta, float pitch, Hand hand, float swingProgress, ItemStack item, float equipProgress, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light) { - return !LegacyAnimationsSettings.CONFIG.instance().oldSwordBlock || !(item.getItem() instanceof SwordItem) || !(player.getOffHandStack().getItem() instanceof ShieldItem) || !player.isUsingItem(); + boolean isUsing = ServerUtils.INSTANCE.isOnHypixel() ? MinecraftClient.getInstance().options.useKey.isPressed() : player.isUsingItem(); + return !LegacyAnimationsSettings.CONFIG.instance().oldSwordBlock || !(item.getItem() instanceof SwordItem) || !(player.getOffHandStack().getItem() instanceof ShieldItem) || !isUsing; } @WrapOperation(