mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-19 07:19:05 +00:00
Fix Charging on Staff Resetting
This commit is contained in:
1 parent
40613fa56a
commit
a479a9d941
1 file changed
+16
-2
@@ -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)
|
||||
|
||||
Reference in new issue
Block a user