From bbd910119f5bb66cf492e5fbc57cf2ecfb332a77 Mon Sep 17 00:00:00 2001 From: Pear <20259871+TheRealPear@users.noreply.github.com> Date: Sat, 13 Apr 2024 00:59:19 -0400 Subject: [PATCH] Rewrite and add consumables (#116) * Rewrite and add consumables Building on top of #90 Signed-off-by: TheRealPear <20259871+TheRealPear@users.noreply.github.com> Co-Authored-By: Half <41559602+OhPointFive@users.noreply.github.com> * Merge kit attribute into action attribute Signed-off-by: TheRealPear <20259871+TheRealPear@users.noreply.github.com> --------- Signed-off-by: TheRealPear <20259871+TheRealPear@users.noreply.github.com> Co-authored-by: Half <41559602+OhPointFive@users.noreply.github.com> --- docs/modules/gear/consumables.mdx | 67 +++++++++++++++++++++++++++++++ docusaurus.config.js | 2 +- sidebars.js | 1 + 3 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 docs/modules/gear/consumables.mdx diff --git a/docs/modules/gear/consumables.mdx b/docs/modules/gear/consumables.mdx new file mode 100644 index 00000000..c686f79d --- /dev/null +++ b/docs/modules/gear/consumables.mdx @@ -0,0 +1,67 @@ +--- +id: consumables +title: 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](/docs/modules/gear/kits). +When consumed, these items can trigger [actions](/docs/modules/mechanics/actions-triggers), and override vanilla eating or drinking behavior. + +#### Consumables Element + +
+ | Element | Description | + |---|---| + | ` ` | Node containing the consumables definitions. | + + | Sub-elements || + |---|---| + | ` ` | An individual consumable. | +
+ +#### Consumable Attributes + +
+ | Attribute | Description | Value | Default | + |---|---|---|---| + | `id` | RequiredUnique identifier used to reference this consumable from other places in the XML. | String | + | `action`|`kit` | RequiredRun the specified action upon consumption. | [Action ID](/docs/modules/mechanics/actions-triggers) | + | `on` | RequiredSpecify how the consumable should be used.
**Note:** The only action currently supported is `eat`. In the future, more actions such as clicking will be supported. | `eat` | + | `override` | 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/false | true | +
+ +### Examples + +```xml + + + + + + + + + + + + + + +``` + +```xml + + + + + + + + + + + + speed + + +``` diff --git a/docusaurus.config.js b/docusaurus.config.js index db8083cf..5ce07e25 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -85,7 +85,7 @@ const config = { announcementBar: { id: 'new_features', content: - 'New Features: Map Variants, Constants, Structures, and Ender Chests', + 'New Features: Consumables, Map Variants, Constants, and Structures', backgroundColor: '#fafbfc', textColor: '#091E42', isCloseable: true, diff --git a/sidebars.js b/sidebars.js index 772031a3..9f9917a5 100644 --- a/sidebars.js +++ b/sidebars.js @@ -68,6 +68,7 @@ const sidebars = { "modules/gear/crafting", "modules/gear/repair-remove-keep", "modules/gear/projectiles", + "modules/gear/consumables", "modules/gear/tnt", "modules/gear/kill-rewards", "modules/gear/lootables"],