From adc5c3eacf0ce640fb52070f6b0ebfbc99ea0e2b Mon Sep 17 00:00:00 2001 From: Auxilor Date: Sun, 21 Jul 2024 11:23:34 +0100 Subject: [PATCH] Updated item lookup --- docs/all-plugins/the-item-lookup-system.md | 100 +++++++++++++++------ docs/ecoscrolls/how-to-make-a-scroll.md | 3 - 2 files changed, 71 insertions(+), 32 deletions(-) diff --git a/docs/all-plugins/the-item-lookup-system.md b/docs/all-plugins/the-item-lookup-system.md index 60c128f7c2..5373eabe67 100644 --- a/docs/all-plugins/the-item-lookup-system.md +++ b/docs/all-plugins/the-item-lookup-system.md @@ -4,55 +4,80 @@ sidebar_position: 3 --- ## What is the Item Lookup System? -A lot of my plugins have crafting recipes in them and/or add custom items to the server. The Item Lookup system was designed to create a simple, powerful system to have custom item crafting and share items between plugins. + +The item lookup system is how items are loaded from configs. It's designed to be extremely flexible and intuitive, allowing you to use custom items, stacks, enchantments, etc. wherever you want, without having to worry about +what plugin they're from. ## Crafting Recipes -If you've ever seen a crafting recipe in a plugin of mine, there's a decent chance that it looked something like this: + +Crafting recipes in eco plugins often look something like this: + ```yaml recipe: - - "" - - "ecoitems:toughened_string 8 ? string 64" - - "" - - - "" - - "netherite_chestplate || diamond_chestplate" - - "" - - - "ecoitems:arachnid_oculus ? nether_star 2" - - "" - - "ecoitems:arachnid_oculus ? nether_star 2" + - "" + - "ecoitems:toughened_string 8 ? string 64" + - "" + + - "" + - "netherite_chestplate || diamond_chestplate" + - "" + + - "ecoitems:arachnid_oculus ? nether_star 2" + - "" + - "ecoitems:arachnid_oculus ? nether_star 2" ``` -This looks completely meaningless, but it's actually really simple. A crafting recipe is shown as a list of 9 strings, the first three being the top row (left to right), the second three being the middle row (left to right), and the last three being the last row (left to right). +While it may look meaningless, this system is straightforward once you understand how it works. A crafting recipe is written as a list of 9 strings, the first three being the top row (left to right), +the second three being the middle row (left to right), and the last three being the last row (left to right). ## Keys Explained -In each string is the key for an item. A key looks one of three ways: + +In each string is the key for an item. A key looks one of a few ways + - A vanilla minecraft material ID: (e.g. `golden_apple`) - An item from another plugin: (e.g. `ecoitems:packmaster_tear`) - An exact item NBT tag: (e.g. `{id:"stone",Count:3,tag:{Name:"your name"}}`) +- An item tag: (e.g. `#talismans:talisman` or `#items_axes`) -You may also have noticed the `?` in some of the items. This means 'try to use the first item, but if it doesn't exist, use the second item' You can chain these together, but they're actually only useful for me to provide integrations in default configs without breaking things for people who don't use all my plugins together. +#### Vanilla Materials -You can also use `||` to group two items together. This means 'allow the the first item and the second item'. You can chain these together in order to allow many different items. +By default, a vanilla material (e.g. `diamond_pickaxe`) will not accept custom items with the same material. For example, if you have an EcoItems item with `diamond_pickaxe` as its base material, +then that item will not be recognised as a `diamond_pickaxe`. -You can specify the amount of any item by having a space and then a number (the stack size). For example: `string 64` would mean a full stack of string. +If you want custom items to be accepted, place a `*` at the start, so `"diamond_pickaxe"` becomes `"*diamond_pickaxe"`. Outside of crafting recipes, most plugins use `*` items in their +default configs for performance reasons. + +#### Item Tags + +Item tags are groups of items. A list of vanilla tags can be found [here](https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/Tag.html), and you can use them with `#tag`, e.g. `#signs`. + +A list of custom item tags can be found later in this page. + +#### Extra syntax + +- `?` between two items means 'try to use the first item, but if it doesn't exist, use the second item'. You can chain these together. +- `||` groups two items, allowing either one of them to be used. You can chain these together. +- You can specify stack size, e.g. `string 64` would mean a full stack of string. When using exact item NBT, you can't use `?`. `||`, or other modifiers. ## Modifiers -Items can have modifiers applied to them in the key. For example, lets say you're configuring the GUI for EcoSkills. You want it to be a player head with a texture, but you're not sure how to do that, because it looks like you have to just specify a material. Actually, in all eco plugins, wherever it asks for a material, it's actually doing a lookup. You can specify any of the following modifiers to it: -- **Enchantments:** You specify an enchantment by adding `:` to the key, and you can chain these together + +Items can have modifiers applied to them. For example, lets say you're configuring the GUI for EcoSkills. You want it to be a player head with a texture, but you're not sure how to do that, because it looks like you have to just specify a material. Actually, in all eco plugins, wherever it asks for a material, it's actually doing a lookup. You can specify any of the following modifiers to it: + +- **Enchantments:** You can specify an enchantment with `:` - **Skull Texture:** If the material is a player head, you can specify the texture with `texture:`. A list of skulls and textures can be found [here](https://minecraft-heads.com/). - **Player Head:** If the material is a player head, you can specify a player using `head:`. You can also use placeholders, e.g. `head:%player%` -- **Reforge:** If you have reforges installed, you can specify the reforge by adding `reforge:` to the key. +- **Reforge:** You can specify the reforge by adding `reforge:` to the key. - **Name:** You can specify the display name of an item with `name:`. You can have multiple words by surrounding the name with quotes: `name:"Long Name"` -- **Item Flags:** You can specify flags for the item to have, by dropping in any of [these values](https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/inventory/ItemFlag.html) (not case sensitive) +- **Item Flags:** You can specify flags for the item to have, by dropping in any of [these values](https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/inventory/ItemFlag.html) (not case sensitive) - **Unbreakable:** You can make an item unbreakable by having the word `unbreakable` in the flags -- **Custom Model Data:** You can specify custom model data with `custom-model-data:` +- **Custom Model Data:** You can specify custom model data with `custom_model_data:` - **Spawner Entity:** You can specify the spawner entity with `entity:` - **Leather Armor Color:** You can specify the leather armor color with `color:#hex`, e.g. `color:#303030` These modifiers are only available on Paper 1.21+: + - **Armor Trims:** You can specify armor trims with `trim::`, e.g. `trim:emerald:snout` - **Fire Resistance:** You can make an item fire resistant with `fire_resistant` - **Enchantment Glint:** You can give an enchantment glint with `glint` @@ -60,10 +85,9 @@ These modifiers are only available on Paper 1.21+: - **Durability:** You can set the item durability with `max_damage:` - **Stack Size:** You can set the max stack size with `max_stack_size:` -So, lets say you have an EcoMobs mob, and you want it to drop a rare custom weapon with extra modifiers already applied. Without the Item Lookup system, this wouldn't be possible, but thanks to it, you can just do this: `ecoitems:enlightened_blade razor:4 unbreaking:3 criticals:2 fire_aspect:2 reforge:mighty unbreakable hide_attributes custom-model-data:2` +So, lets say you have an EcoMobs mob, and you want it to drop a rare custom weapon with extra modifiers already applied. Without the Item Lookup system, this wouldn't be possible, but thanks to it, you can just do this: `ecoitems:enlightened_blade razor:4 unbreaking:3 criticals:2 fire_aspect:2 reforge:mighty unbreakable hide_attributes custom_model_data:2` -## Using items from my other plugins -You can use items from my other plugins anywhere using The Item Lookup system. +## Using items in eco plugins | Plugin | Item Lookup Key | | ------------ | ------------------------------------------------------------------------------------------------------------------- | @@ -77,11 +101,24 @@ You can use items from my other plugins anywhere using The Item Lookup system. | StatTrackers | `stattrackers:` | | Talismans | `talismans:` | +## Using item tags in eco plugins + +| Plugin | Item Tag | Description | +| ---------- | --------------------- | ------------------------------- | +| EcoItems | `#ecoitems:item` | Any EcoItems item | +| EcoScrolls | `#ecoscrolls:scroll` | Any EcoScrolls scroll | +| Reforges | `#reforges:stone` | Any reforge stone | +| Reforges | `#reforges:reforged` | Any item with a reforge present | +| Talismans | `#talismans:talisman` | Any talisman | + ## Using items in MythicMobs + If you want to use a lookup item in MythicMobs, just do it like this: `eco{type=}`, e.g. `eco{type=ecoitems:}` ## Using items in ShopGUIPlus + If you want to use a lookup item in ShopGUIPlus, just do it like this: + ```yaml type: item item: @@ -91,24 +128,29 @@ sellPrice: 7500 slot: 27 ``` -## Custom Items +## Using items from third-party plugins + Sometimes custom item IDs are namespaced. In order to make this work, you have to specify them like `plugin:namespace__key`, where two underscores denote where the `:` would normally go. + ### ItemsAdder + ```yaml # ItemsAdder configuration info: namespace: my_items items: my_helmet: - display_name: '&9Custom Helmet' + display_name: "&9Custom Helmet" ``` + ItemsAdder items are namespaced, so for example if you have an ItemsAdder item called `crystal_pack:alumite_pickaxe`, it would be `itemsadder:crystal_pack__alumite_pickaxe` in config. Using this in the Item Lookup System would look like: `itemsadder:my_items__my_helmet`. ### Oraxen + To use custom items from Oraxen, you can use `oraxen:`. ### ItemBridge -To use custom items from ItemBridge, you can use `itembridge:saved__`. If it's an item from a supported plugin, it's `itembridge:__` +To use custom items from ItemBridge, you can use `itembridge:saved__`. If it's an item from a supported plugin, it's `itembridge:__` diff --git a/docs/ecoscrolls/how-to-make-a-scroll.md b/docs/ecoscrolls/how-to-make-a-scroll.md index beaf1ac90b..c540a42bdb 100644 --- a/docs/ecoscrolls/how-to-make-a-scroll.md +++ b/docs/ecoscrolls/how-to-make-a-scroll.md @@ -59,8 +59,6 @@ effects: # Read https://plugins.auxilor.io/effects/configuring-a-condition # The conditions for the scroll to work conditions: [ ] -<<<<<<< HEAD -======= # Options for the physical scroll item item: @@ -97,7 +95,6 @@ inscription: # If your scroll works by modifying the item (e.g. adding enchantments, changing durability), # then put those effects here. effects: [ ] ->>>>>>> 7a16d72b6530077840c1c0cee3e0c348ff31636d ``` ## Understanding all the sections