Fabric-Shield-Lib icon indicating copy to clipboard operation
Fabric-Shield-Lib copied to clipboard

Add ItemStack context to `getCoolDownTicks` in shield item class

Open IMB11 opened this issue 11 months ago • 4 comments

Would be useful for enchantments that affect cooldown ticks.

IMB11 avatar Jan 03 '25 16:01 IMB11

Example:

@Override
    public int getCoolDownTicks(@Nullable ItemStack itemStack) {

        if (itemStack != null) {
            ... = itemStack.getEnchantments().getLevel(...);

            return super.getCoolDownTicks() * ...;
        }

        return super.getCoolDownTicks();
    }
    ```

IMB11 avatar Jan 03 '25 16:01 IMB11

Yeah, looks good! So I just need to change this line to public int getCoolDownTicks(@Nullable ItemStack itemStack) {?

CringeStar avatar Jan 03 '25 20:01 CringeStar

Done in 1.21.3 and 1.21.4 versions, not sure how far we'll backport.

CringeStar avatar Jan 20 '25 05:01 CringeStar

Marked stale due to inactivity.

github-actions[bot] avatar Nov 17 '25 08:11 github-actions[bot]

Okay, so this has been added in newer versions & will be back-ported eventually, I've been working on getting 2.0 more stable before attempting a backport.

StellarWind22 avatar Nov 24 '25 11:11 StellarWind22