From 87284fb10b8648677461bdce96aec267c7b3fccb Mon Sep 17 00:00:00 2001 From: Wyvest <45589059+Wyvest@users.noreply.github.com> Date: Mon, 9 Jan 2023 10:31:04 -0500 Subject: [PATCH] fix particles appearing even if nothing is held --- gradle.properties | 2 +- .../overflowanimations/handlers/AnimationHandler.java | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/gradle.properties b/gradle.properties index 9ca72fd..096e687 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ mod_name = OverflowAnimations mod_id = overflowanimations -mod_version = 2.0.1-beta5 +mod_version = 2.0.1-beta6 essential.defaults.loom=0 diff --git a/src/main/java/cc/polyfrost/overflowanimations/handlers/AnimationHandler.java b/src/main/java/cc/polyfrost/overflowanimations/handlers/AnimationHandler.java index 9ad6765..46170ed 100644 --- a/src/main/java/cc/polyfrost/overflowanimations/handlers/AnimationHandler.java +++ b/src/main/java/cc/polyfrost/overflowanimations/handlers/AnimationHandler.java @@ -82,10 +82,13 @@ private void updateSwingProgress() { mc.objectMouseOver != null && mc.objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { if (OldAnimationsSettings.punchingParticles && isSwingInProgress) { - if (!OldAnimationsSettings.adventureParticles) { - mc.effectRenderer.addBlockHitEffects(mc.objectMouseOver.getBlockPos(), mc.objectMouseOver.sideHit); - } else if (player.capabilities.allowEdit) { - mc.effectRenderer.addBlockHitEffects(mc.objectMouseOver.getBlockPos(), mc.objectMouseOver.sideHit); + ItemStack heldItem = mc.thePlayer.getHeldItem(); + if (heldItem != null && heldItem.getItemUseAction() != EnumAction.NONE) { + if (!OldAnimationsSettings.adventureParticles) { + mc.effectRenderer.addBlockHitEffects(mc.objectMouseOver.getBlockPos(), mc.objectMouseOver.sideHit); + } else if (player.capabilities.allowEdit) { + mc.effectRenderer.addBlockHitEffects(mc.objectMouseOver.getBlockPos(), mc.objectMouseOver.sideHit); + } } } if (!this.isSwingInProgress || this.swingProgressInt >= max >> 1 || this.swingProgressInt < 0) {