Effect Lore Display

Effect Lore Display

Learn how to customize the way effects are displayed in item lore, including visibility controls, formatting, and display limits.


Overview

zItems provides fine-grained control over how effects appear in item lore. You can:

  • Control visibility of base effects vs additional effects

  • Limit the number of effects shown

  • Customize formatting using messages

  • Show "And More..." when effects are truncated

  • Separate base lore from effect lore


Display Settings

Per-Item Settings

Configure in your item YAML files (items/*.yml):

id: "my_pickaxe"
# ... other settings ...

# Effect Display Control
nb-effects-view: -1  # How many effects to show
base-effects-visible: true  # Show base effects
additional-effects-visible: true  # Show added effects

nb-effects-view

Controls how many effects are displayed in lore:

Value
Behavior

-1

Show all effects (no limit)

0

Show no effects (hide all)

> 0

Show up to N effects, then "And More..."

Examples:

base-effects-visible

Controls whether effects defined in the item config are shown:

Base effects are those defined in the effects: list in the item YAML.

additional-effects-visible

Controls whether effects added via commands are shown:

Additional effects are those applied using /zitems effect apply.


Global Default Settings

Configure in config.yml:

This applies to all items that don't specify nb-effects-view in their YAML.


Lore Formatting

Effect lore is formatted using the messages system. Customize in messages.yml:

Message Placeholders

effects-lore-line

The <effect> placeholder is replaced with the effect's display-name from the effect YAML:

Effect YAML:

Result in lore:


How Lore Generation Works

During Item Build

When an item is first created (/zitems item give):

  1. Base lore is added from lore: in item YAML

  2. Effect lore is generated based on base-effects-visible and nb-effects-view

  3. Both are combined and applied to the item

  4. Effects are stored in PDC (PersistentDataContainer)

Implementation: ZItem.java:build()

When Effects are Applied

When effects are added via /zitems effect apply:

  1. Effect is added to PDC

  2. Lore is recalculated:

    • Base effects = original effects from config

    • Additional effects = effects in PDC not in base

  3. Effect lore is regenerated based on visibility settings

  4. Item lore is updated: base lore + new effect lore

Implementation: ZEffectsManager.java:updateItemLoreWithEffects()


Lore Update Flow


Examples

Show All Effects

Result:

Hide All Effects

Result:

No effect lore is shown at all.

Limit to 2 Effects

Result:

The "And More..." line indicates there are additional effects not shown.

Show Base Only

Result after adding Vein Miner:

Vein Miner is NOT shown because additional-effects-visible: false.

Show Additional Only

Result initially:

No effects shown because only base effect exists.

After adding Vein Miner:

Only the added effect is shown.


Custom Formatting

Rainbow Effect List

Result:

Minimalist Style

Result:

Detailed Style

Result:


Vanilla Items

Effects can be applied to vanilla items using /zitems effect apply (while holding the item).

Vanilla Item Lore Handling

For vanilla items:

  • Existing lore is preserved

  • Effect section is added below existing lore

  • If effects are updated, old effect section is replaced

Example:

Result:


Technical Details

Lore Separation

Custom Items:

  • Base lore is stored in ItemSettings.lore()

  • Effect lore is generated on-demand

  • Combined during build() and updateItemLoreWithEffects()

Vanilla Items:

  • Existing lore is scanned for effect section

  • Effect section identified by Messages.EFFECTS_LORE_TITLE

  • Old effect section removed before adding new one

Effect Order

Effects are displayed in the order they appear:

  1. Base effects (if base-effects-visible: true)

  2. Additional effects (if additional-effects-visible: true)

Within each group, effects are in the order they were added.

PDC Storage

All effects (base + additional) are stored in PersistentDataContainer:

  • Key: Keys.EFFECTS

  • Type: List<Effect>

  • Serialized using ZEffectDataType

The distinction between base and additional is recalculated each time by comparing PDC effects with the item config.


Troubleshooting

Effect lore not showing

Check:

  1. Is nb-effects-view set to 0? (Hides all effects)

  2. Is base-effects-visible or additional-effects-visible false?

  3. Does the effect have a display-name in its YAML?

Debug:

Look for: [zItems] [DEBUG] Updated item lore for <item> with <N> total effects

Lore duplicated

Cause: Calling updateItemLoreWithEffects() multiple times without clearing previous lore.

Solution: This is handled automatically by zItems. If you're using the API:

"And More..." not showing

Check:

  1. Is nb-effects-view set correctly? (Must be > 0 and < total effects)

  2. Do you have more effects than the limit?

Example:

Won't show "And More..." because there's only 1 effect (less than limit).

Custom formatting not applying

Check:

  1. Did you edit messages.yml?

  2. Did you /zitems reload after editing?

  3. Are you using valid MiniMessage syntax?

Test:

If it still doesn't work, check for YAML syntax errors:


API Usage

Updating Lore Programmatically

Generating Effect Lore

The generation logic is in ZEffectsManager.java:


Best Practices

  1. Use -1 for normal items - Show all effects unless you have a reason to hide them

  2. Use 0 for mystery items - Hide effects for surprise mechanics

  3. Use limits for items with many effects - Prevents lore from becoming too long

  4. Keep effect names concise - Long display names can wrap awkwardly

  5. Test with many effects - Ensure lore doesn't overflow (Minecraft has lore limits)

  6. Use consistent formatting - Edit messages.yml for server-wide style


  • Effects System - How effects work

  • Creating Items - Item configuration

  • Configuration - Global settings

  • Effect Handlers Reference - All available effects


Need help? Join our Discord or check GitHub Issues!

Last updated