The metadata system in zItems allows you to configure advanced item properties like food effects, potion effects, leather armor colors, armor trims, and more through a flexible, type-safe configuration system.
Metadata represents specialized item properties that go beyond basic attributes. Each metadata type applies to specific item types (e.g., food metadata only works on edible items, leather armor metadata only works on leather armor).
Polymorphic Configuration : Each metadata type has its own configuration structure
Type-Safe : Structura validates metadata against the correct Java class
Auto-Discovery : Metadata implementations are discovered via @AutoMetadata annotation
Item-Specific : Each metadata type only works with compatible items
Metadata is configured in the metadata section of item configs:
Copy id : " my_item "
material : GOLDEN_APPLE
metadata :
food : # Metadata type (discriminator)
nutrition : 8
saturation : 9.6
# Can have multiple metadata types Discriminator : food Compatible Materials : Any edible item (Paper 1.20.5+) Purpose : Configure food properties and consumption effects
Configuration
Fields Reference
Field
Type
Default
Description
Hunger points restored (half drumsticks)
Can eat even when hunger is full
Time to consume (seconds)
Cooldown after use (seconds)
List<PotionEffectWrapper>
Potion effects on consumption
Animation Types
EAT - Normal eating animation
DRINK - Drinking animation
BLOCK - Shield blocking animation
BOW - Bow drawing animation
SPEAR - Trident throwing animation
CROSSBOW - Crossbow loading animation
SPYGLASS - Spyglass looking animation
TOOT_HORN - Horn tooting animation
BRUSH - Brush using animation
Complete Example
Discriminator : potion Compatible Materials : POTION, SPLASH_POTION, LINGERING_POTION, TIPPED_ARROW Purpose : Configure potion colors and effects
Configuration
Fields Reference
Field
Type
Default
Description
Potion color (hex or Bukkit)
List<PotionEffectWrapper>
Base Potion Types
Common types: STRENGTH, SPEED, HEALING, HARMING, REGENERATION, FIRE_RESISTANCE, WATER_BREATHING, INVISIBILITY, NIGHT_VISION, WEAKNESS, POISON, SLOWNESS, etc.
See Bukkit PotionTypearrow-up-right for all types.
Complete Example
Discriminator : leather-armor Compatible Materials : LEATHER_HELMET, LEATHER_CHESTPLATE, LEATHER_LEGGINGS, LEATHER_BOOTS, LEATHER_HORSE_ARMOR Purpose : Dye leather armor
Configuration
Color Formats
Hex Color :
Bukkit Color (RGB):
Complete Example
Discriminator : trim Compatible Materials : Any armor piece Purpose : Apply armor trims (1.20+)
Configuration
Trim Materials
QUARTZ, IRON, NETHERITE, REDSTONE, COPPER, GOLD, EMERALD, DIAMOND, LAPIS, AMETHYST
Trim Patterns
SENTRY, VEX, WILD, COAST, DUNE, WAYFINDER, RAISER, SHAPER, HOST, WARD, SILENCE, TIDE, SNOUT, RIB, EYE, SPIRE
Complete Example
Discriminator : banner Compatible Materials : Any banner Purpose : Add patterns to banners
Configuration
Pattern Types
BASE, STRIPE_BOTTOM, STRIPE_TOP, STRIPE_LEFT, STRIPE_RIGHT, STRIPE_CENTER, STRIPE_MIDDLE, STRIPE_DOWNRIGHT, STRIPE_DOWNLEFT, SMALL_STRIPES
CROSS, STRAIGHT_CROSS, TRIANGLE_BOTTOM, TRIANGLE_TOP, TRIANGLES_BOTTOM, TRIANGLES_TOP
DIAGONAL_LEFT, DIAGONAL_RIGHT, DIAGONAL_UP_LEFT, DIAGONAL_UP_RIGHT
CIRCLE, RHOMBUS, HALF_VERTICAL, HALF_HORIZONTAL, HALF_VERTICAL_RIGHT, HALF_HORIZONTAL_BOTTOM
BORDER, CURLY_BORDER, GRADIENT, GRADIENT_UP, BRICKS, GLOBE, CREEPER, SKULL, FLOWER, MOJANG, PIGLIN
Complete Example
Discriminator : enchant-storage Compatible Materials : ENCHANTED_BOOK Purpose : Store enchantments in books
Configuration
Complete Example
Discriminator : tool Compatible Materials : Any tool Purpose : Configure tool properties (damage on block break, default mining speed)
Discriminator : block-state Compatible Materials : Block items Purpose : Store block state data
Discriminator : can-break / can-place-on Compatible Materials : Any item Purpose : Adventure mode block restrictions
You can apply multiple metadata types to a single item:
Developers can create custom metadata types using the API:
Step 2: Register Package
Step 3: Use in Configuration
Use metadata for:
Item-specific properties (food, potions, armor colors)
Complex nested data structures
Type-specific configurations
When to Use Item Properties
Use regular properties for:
Basic item settings (display name, lore, material)
Universal item attributes (unbreakable, enchantments, flags)
Example Comparison :
2. Validate Configuration
Test your metadata configurations:
3. Check Paper vs Spigot
Some metadata is Paper-only:
On Spigot, these fields will be ignored.
Troubleshooting
Symptoms : Item doesn't have expected properties
Checklist :
Is the material compatible? (e.g., leather-armor only works on leather armor)
Is the metadata type spelled correctly?
Check console for errors when loading
Debug :
Problem : Leather armor or potion has wrong color
Solutions :
Check hex format: #RRGGBB
Verify color value is valid
Effects Not Working
Problem : Food or potion effects not applying
Solutions :
Duration is in ticks (20 ticks = 1 second)
Amplifier starts at 0 (0 = Level I, 1 = Level II, etc.)
Check effect type is valid
Metadata is applied when an item is built (ZItem.build()), not on every use. This means:
✅ Efficient - no runtime overhead
✅ Cached - item meta is stored
❌ Not dynamic - cannot change based on runtime conditions
Creating Items Guide - Complete item configuration
Effect System - Dynamic item behaviors
Need help? Join our Discordarrow-up-right or check GitHub Issuesarrow-up-right !