Skip to main content

Consumables

Consumables are items that can be made "edible" to the player and "consuming" it will allow them to run an action or receive a kit. It can be defined and applied to items in kits. When consumed, these items can trigger actions, and override vanilla eating or drinking behavior.

Consumables Element

ElementDescription
<consumables> </consumables>Node containing the consumables definitions.
Sub-elements
<consumable> </consumable>An individual consumable.

Consumable Attributes

AttributeDescriptionValueDefault
idRequiredUnique identifier used to reference this consumable from other places in the XML.String
actionRequiredRun the specified action upon consumption.Action ID
onRequiredSpecify how the consumable should be used.eat
right click
left click
click (both)
overrideThe consumable is affected by vanilla behaviors, such as giving the player potion effects.
This is useful when using potion bottles and golden apples as the consumable item.
true/falsetrue
consumePGM will consume the item once per use for the user.
Note: This attribute is ignored if the value of on attribute is eat.
true/false*

Override & Consume Behavior

Some combinations of override and consume values can lead to unexpected behaviors involving either the user's client or PGM itself. This chart outlines the expected vanilla behavior for each configuration.

OverrideConsumeVanilla BehaviorResult
falsefalseNo consume (e.g.: stick)Optimal0 used
falsefalseConsumes (e.g.: snowball)Sub-optimal1 used
falsetrueNo consume (e.g.: stick)Optimal1 used
falsetrueConsumes (e.g.: snowball)Invalid2 used
truefalseAny caseOptimal0 used
truetrueAny caseOptimal1 used

Examples

<!-- Create the consumable "porkchop-that-says-yum" -->
<consumables>
<consumable id="porkchop-that-says-yum" action="say-yum" on="eat" override="false"/>
</consumables>
<!-- Apply the consumable to an item -->
<kits>
<kit id="spawn">
<item slot="1" amount="5" consumable="porkchop-that-says-yum" material="pork"/>
</kit>
</kits>
<!-- Define the action the consumable will run -->
<actions>
<message id="say-yum" text="Yum!"/>
</actions>
<!-- Create the consumable "fast-apple" -->
<consumables>
<consumable id="fast-apple" action="speed-kit" on="eat"/>
</consumables>
<kits>
<!-- Apply the consumable to an item -->
<kit id="spawn">
<item slot="1" consumable="fast-apple" name="Fast Apple" material="golden apple"/>
</kit>
<!-- Define the kit the consumable gives you -->
<kit id="speed-kit">
<effect duration="4" amplifier="10">speed</effect>
</kit>
</kits>
<!-- Create the consumable "heal" -->
<!-- When the healing stick is right clicked, it is "consumed" and applies the
heal-click action (kit) that sets the player's health back to 20 -->
<consumables>
<consumable id="heal" action="heal-click" on="click" override="true" consume="true"/>
</consumables>
<kits>
<!-- Apply the consumable to an item -->
<kit id="spawn-kit">
<item material="stick" consumable="heal" name="Healing stick!"/>
</kit>
<!-- Define the kit the consumable gives you -->
<kit id="heal-click">
<health>20</health>
</kit>
</kits>