Skip to main content

NameplateAPI — Static Methods

MethodDescription
describe(plugin, segmentId, displayName)Register UI metadata. Defaults to SegmentTarget.ALL, no example.
describe(plugin, segmentId, displayName, target)Register UI metadata with an entity target hint.
describe(plugin, segmentId, displayName, target, example)Register UI metadata with target hint and example preview text.
describeVariants(plugin, segmentId, variantNames)Register format variant names for a segment. Index 0 is the default.
undescribe(plugin, segmentId)Remove a segment description from the UI at runtime.
register(store, entityRef, segmentId, text)Set or update nameplate text for a segment on an entity.
remove(store, entityRef, segmentId)Remove a segment’s text from an entity. Auto-removes the component if empty.
getComponentType()Get the ComponentType<EntityStore, NameplateData> for direct ECS access.

Parameter Details

describe() parameters:
ParameterTypeDescription
pluginJavaPluginYour plugin instance (pass this from setup())
segmentIdStringUnique key for this segment within your plugin (e.g. "health", "guild")
displayNameStringHuman-readable name shown in the UI (e.g. "Health Bar")
targetSegmentTargetUI hint for which entity types this applies to
exampleStringPreview text shown in the UI (e.g. "67/67")
register() parameters:
ParameterTypeDescription
storeStore<EntityStore>The entity store
entityRefRef<EntityStore>Reference to the target entity
segmentIdStringThe segment key (must match what you passed to describe())
textStringThe text value to display

NameplateData — Instance Methods

MethodReturnDescription
setText(key, text)voidSet or update a segment’s text. Pass null to remove.
getText(key)StringGet a segment’s current text. Returns null if not set.
removeText(key)voidRemove a segment.
getEntries()Set<Map.Entry>Unmodifiable view of all key-value entries.
isEmpty()booleanReturns true if no entries exist.

SegmentTarget — Enum

ValueUI TagDescription
ALL[All]Applies to all entity types
PLAYERS[Players]Intended for player entities
NPCS[NPCs]Intended for NPC entities
The target is a UI hint only. It does not restrict which entity types you can register the segment on.

Exceptions

ExceptionParentWhen It’s Thrown
NameplateExceptionRuntimeExceptionBase class — not thrown directly
NameplateNotInitializedExceptionNameplateExceptionAPI called before NameplateBuilder loaded. Check manifest.json dependency.
NameplateArgumentExceptionNameplateExceptionnull or blank passed to a required parameter.

Key Conventions

Segment IDs

  • Must be non-null and non-blank
  • Scoped to your plugin — two mods can both use "health" without conflict
  • Used as the key in NameplateData.setText() and NameplateData.getText()

Variant Key Suffixes

  • Variant 0 (default) uses the base key: "health"
  • Variant 1 uses .1 suffix: "health.1"
  • Variant 2 uses .2 suffix: "health.2"
  • The aggregator falls back to the base key if a suffixed key is missing

Hidden Keys

  • Keys starting with _ (underscore) are hidden metadata
  • Stored in NameplateData but never shown in output or UI
  • Example: "_spawn_tick", "_phase"