Add a hook to allow continuously using items through stack changes (#4834)

This commit is contained in:
Ben Staddon authored and tterrag committed 2019-04-23 15:12:55 -04:00
1 parent 1a7e05a3da
commit 817546e4c8
4 files changed
+167 -7

No files matched your search

@@ -647,6 +647,20 @@ public interface IForgeItem
&& (newStack.isDamageable() || newStack.getDamage() == oldStack.getDamage()));
}
/**
* Called while an item is in 'active' use to determine if usage should
* continue. Allows items to continue being used while sustaining damage, for
* example.
*
* @param oldStack the previous 'active' stack
* @param newStack the stack currently in the active hand
* @return true to set the new stack to active and continue using it
*/
default boolean canContinueUsing(ItemStack oldStack, ItemStack newStack)
{
return oldStack.equals(newStack);
}
/**
* Called to get the Mod ID of the mod that *created* the ItemStack, instead of
* the real Mod ID that *registered* it.