plugins/LodeItems/items/, with textures and models beside the YAML. Your plugin can use the same files:
- Read any entry as the owner wrote it, with its file and line, as a
ContentEntry. - Add your own keys to Lode Items entries, such as
mana-cost:on an item. - Add your own
type:, such astype: spell, so owners define your content in the same folders. - Find the files an entry names, with the same path rules Lode Items uses for
texture:andmodel:.
Reading entries
Entry methods are static methods onorg.lodemc.api.LodeItemsApi. Only entries that loaded without errors are included.
List<ContentEntry>
Every entry of the last load, in load order, whatever its type: items, blocks, props, glyphs, sounds, recipes, and types registered by plugins.
List<ContentEntry>
The entries of one
type:, such as item, block, prop or a type you registered. Entries without a type: are item.ContentEntry
The entry with id
id, or null. Also takes the id as a String. Glyphs, sounds and other types that don’t give an item only need ids unique within their own type, so if several entries share an id this returns the one that gives an item.ContentEntry
The entry of
type with id id, or null.ContentEntry
One entry as written. Values come back as plain Java:Map<String, Object> for sections, List<Object> for lists, and String, Long, Double or Boolean for values.
The
fallback is optional on every getter.
Finding files next to the YAML
resolveAsset finds a file the way Lode Items finds texture: and model: files:
fireball.pngoricons/fireball.png: relative to the folder of the entry’s YAML file/shared/fireball.png: from theitems/root
null for a namespace:path resource location, for a path that leads outside items/, and for a file that doesn’t exist. Unlike texture:, it doesn’t add an extension for you.
Your own config
Register keys and types in your plugin’sonLoad. Lode Items loads its content after every plugin’s onLoad, so the first load already knows about them. Both are removed when your plugin disables.
void
Lets owners write
key at the top of any entry. Without it, Lode Items warns about it as an unknown option (“Unknown option ‘mana-cost’ - it is ignored”). Lode Items itself ignores the value; read it with ContentEntry.get. Only top-level keys are covered: put everything else in a section under your key.void
Makes
type: <type> a valid entry type that belongs to your plugin. Type names use lower case letters, digits, _ and -. Lode Items builds nothing from these entries and doesn’t check their keys; it only loads them as ContentEntrys for you. They follow every other rule of the items/ folder: any file at any depth, one id per entry, friendly errors for broken YAML.void
Reads
items/ again and rebuilds the resource pack, like /lodeitems reload. The pack is sent again to online players if it changed. It’s heavy, so call it only when your own content changed.Example: a new kind of content
A spells plugin lets owners define spells initems/, each with an icon beside its YAML, and ships the icons in Lode Items’ resource pack.
items/spells/fire/fireball.yml
item_model component set to myspells:fireball then shows the spell’s icon. See Resource pack for the file helpers.