ConsumableComponentHelper
com.jsmacrosce.jsmacros.client.api.helper.inventory.ConsumableComponentHelper
Reads how a stack is consumed. Nutrition and potion contents are separate components.
js
const use = Player.getPlayer()?.getMainHand().getComponents().getConsumable();
if (use != null) Chat.log(`${use.getAnimation()} takes ${use.getDurationTicks()} ticks`);Methods
getAnimation
getDurationSeconds
getDurationSeconds(): float#Returns: the configured consumption time in seconds
getDurationTicks
getDurationTicks(): int#Returns: the consumption time Minecraft uses, in ticks
getEffects
getEffects(): List<ConsumeEffectHelper>#Lists the effects configured in this component. Other components, such as potion contents, can provide additional effects.
Returns: the configured effects in Minecraft's application order
getSoundId
hasParticles
hasParticles(): boolean#Returns: whether consuming the item is configured to show particles