Skip to main content

Component registration

Component package structure​

Each component lives in its own package under component/:

component/<name>/
├── <Name>.java # Main component class (extends AComponent / AArmorStandComponent / ATextDisplayComponent)
├── inventory/ # Optional: GUI menus specific to this component
│ └── <Name>Inventory.java
└── listener/ # Optional: event listeners specific to this component
└── <Name>EventsListener.java

Reference implementation: component/lasersender/ (LaserSender + inventory + listener).

Component base classes​

  • AArmorStandComponent — armor-stand-based components.
  • ATextDisplayComponent — TextDisplay-entity-based components.

Both extend AComponent, which implements the IComponent interface.

Component interfaces​

InterfacePurpose
IColorableComponentCan change color
IRotatableComponent3D rotation (pitch/yaw/roll)
IDetectionComponentActivated by conditions (min/max thresholds)
ILightComponentHas a light level property
IPlayerModifiableComponentPlayer-editable in-game
IMirrorContainerContains mirrors (extends IColorableComponent)
IActivableComponentHas an on/off state
IAreaComponentDefines min/max area
IMaterialComponentConfigurable block material
ITaskComponentHas periodic update logic (in common/task/)

Five-file registration checklist​

A new component under component/<name>/ must be wired into all five of:

  1. common/items/ComponentType.java — add a new enum value.
  2. component/mapper/ComponentMapper.java — add toEntity() and fromEntity() branches.
  3. area/ComponentFactory.java — add creation logic.
  4. component/common/inventory/ComponentMenuInventory.java — add the component's menu content (rotations, color, options).
  5. component/common/inventory/ComponentShortcutBarInventory.java — add the component's shortcut bar content (editor hotbar buttons).

Forgetting any of the five breaks the component registration silently — the menu / hotbar / persistence layer that was skipped will just not see the new component.

Wiki update​

When a new component is added, also create its wiki page under wiki/In-game/Features/Components/<component-name>.md and update wiki/_sidebar.md. See Wiki update matrix for the full mapping.