Skip to content

Commit

Permalink
Code style fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorianMichael committed Dec 2, 2024
1 parent 3d7ee17 commit da32f84
Showing 1 changed file with 14 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,20 @@ public abstract class MixinHeldItemRenderer {
slice = @Slice(from = @At(value = "INVOKE", target = "Lnet/minecraft/item/ItemStack;getUseAction()Lnet/minecraft/item/consume/UseAction;")),
at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/item/HeldItemRenderer;applyEquipOffset(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/util/Arm;F)V", ordinal = 2, shift = At.Shift.AFTER))
private void transformSwordBlockingPosition(AbstractClientPlayerEntity player, float tickDelta, float pitch, Hand hand, float swingProgress, ItemStack item, float equipProgress, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, CallbackInfo ci) {
if (VisualSettings.global().swordBlockingAnimation.isEnabled()) {
final Arm arm = hand == Hand.MAIN_HAND ? player.getMainArm() : player.getMainArm().getOpposite();
final int direction = arm == Arm.RIGHT ? 1 : -1;
viaFabricPlus$applySwingOffset(player, hand, swingProgress, matrices);
if (!(item.getItem() instanceof ShieldItem)) {
// Values stripped from early 1.9 snapshots, 15w33b specifically, which is the version prior to them removing sword blocking
matrices.translate(direction * -0.14142136F, 0.08F, 0.14142136F);
matrices.multiply(RotationAxis.POSITIVE_X.rotationDegrees(-102.25F));
matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(direction * 13.365F));
matrices.multiply(RotationAxis.POSITIVE_Z.rotationDegrees(direction * 78.05F));
}
if (!VisualSettings.global().swordBlockingAnimation.isEnabled()) {
return;
}

final Arm arm = hand == Hand.MAIN_HAND ? player.getMainArm() : player.getMainArm().getOpposite();
final int direction = arm == Arm.RIGHT ? 1 : -1;

viaFabricPlus$applySwingOffset(player, hand, swingProgress, matrices);
if (!(item.getItem() instanceof ShieldItem)) {
// Values stripped from early 1.9 snapshots, 15w33b specifically, which is the version prior to them removing sword blocking
matrices.translate(direction * -0.14142136F, 0.08F, 0.14142136F);
matrices.multiply(RotationAxis.POSITIVE_X.rotationDegrees(-102.25F));
matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(direction * 13.365F));
matrices.multiply(RotationAxis.POSITIVE_Z.rotationDegrees(direction * 78.05F));
}
}

Expand Down

0 comments on commit da32f84

Please sign in to comment.