Using RelicAPI
The RelicAPI class provides the primary entry point for developers to interact with the Relique system. It allows you to query equipped items, modify slot limits, and safely equip or unequip relics for any LivingEntity.
Because Relique supports custom entities and mobs, all API methods accept a LivingEntity rather than strictly a Player.
Retrieving Equipped Relics
When retrieving items through the API, the returned ItemStack instances are safe clones. Modifying the returned items will not alter the entity's actual equipment. If you need to update an item's data, you must modify the clone and pass it back through equip().
Method | Description |
|---|---|
| Returns a list of all items currently equipped in the specified slot. Empty slots are represented by |
| Returns an |
| Returns a flat list of |
Example:
Managing Equipment
The API provides methods to safely equip and unequip items. Using these methods guarantees that all necessary events (RelicEquipEvent, RelicUnequipEvent) are fired, attribute modifiers are correctly applied or removed, and equip sounds are played.
Method | Description |
|---|---|
| Attempts to equip an item into the specified slot and index. Returns |
| Removes and returns the item at the specified slot index. Returns |
| Checks if the item at the index can be unequipped. Evaluates the Curse of Binding enchantment and Creative mode bypasses. |
Modifying Slot Limits
Slot capacities are backed by AbyssalLib entity attributes. This means limits are persistent, and can be modified dynamically per-entity.
Method | Description |
|---|---|
| Returns the maximum number of items the entity can hold in the specified slot. |
| Increases the capacity of the specified slot. |
| Decreases the capacity of the specified slot. |
| Explicitly sets the capacity of the specified slot. |
Utilities and Validation
These methods allow you to query the global configuration of the Relique ecosystem and validate items against slot rules.
Method | Description |
|---|---|
| Runs the item through all registered |
| Returns a sorted list of all registered slot IDs across all loaded namespaces. |
| Returns the immutable |