From a479a9d9418cb5df59206795e7f7fd89763ba610 Mon Sep 17 00:00:00 2001 From: Kam Date: Sun, 1 Mar 2026 04:44:42 -0500 Subject: [PATCH] Fix Charging on Staff Resetting --- src/main/java/noppes/npcs/items/ItemStaff.java | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/main/java/noppes/npcs/items/ItemStaff.java b/src/main/java/noppes/npcs/items/ItemStaff.java index 5dc674b30..39de82e37 100644 --- a/src/main/java/noppes/npcs/items/ItemStaff.java +++ b/src/main/java/noppes/npcs/items/ItemStaff.java @@ -84,13 +84,27 @@ public class ItemStaff extends ItemNpcInterface implements IProjectileCallback { public void onUsingTick(ItemStack stack, EntityPlayer player, int count) { int tick = getMaxItemUseDuration(stack) - count; + int chargeTime = 20 + material.getHarvestLevel() * 8; + if (player.worldObj.isRemote) { spawnParticle(stack, player); + + // Reset charge tick on client to prevent client-side timeout + // (resetChargeTick is not synced via DataWatcher, so the client's + // chargeTick would keep climbing and falsely trigger CHARGE_TIMEOUT_GRACE) + if (tick > chargeTime && stack.stackTagCompound != null) { + Entity existing = player.worldObj + .getEntityByID(stack.stackTagCompound.getInteger("MagicProjectile")); + if (existing instanceof EntityAbilityOrb) { + EntityAbilityOrb orb = (EntityAbilityOrb) existing; + if (orb.isCharging()) { + orb.resetChargeTick(); + } + } + } return; } - int chargeTime = 20 + material.getHarvestLevel() * 8; - // Keep a fully-charged orb alive while the player is still holding if (tick > chargeTime && stack.stackTagCompound != null) { Entity existing = ((WorldServer) player.worldObj)