damage

abstract int damage(ItemStack stack, int amount, LivingEntity entity, Consumer<LivingEntity> breakCallback)

Called to apply damage to the given stack.This can be used to e.g. drain from a battery before actually damaging the item.

Return

The amount of damage to pass to vanilla's logic

Parameters

amount

The amount of damage originally requested

breakCallback

Callback when the stack reaches zero damage. See damage and its callsites for more information.

Sources

jvm source
Link copied to clipboard