Items equipped in relic slots can grant attribute modifiers (like extra health or speed) and play specific sound effects when equipped or unequipped. This data is stored directly on the item using custom data components, allowing you to configure unique stats and sounds per item.
For Server Owners: NBT Configuration
To create a relic with custom attributes or sounds using in-game commands or vanilla datapacks, you must define them inside the minecraft:custom_data component.
AbyssalLib automatically reads any data placed inside a nested CustomComponents tag, which itself sits inside a CustomData tag.
Format Details
Component ID
Expected NBT Structure
relique:relic_properties
A list of modifier objects containing attribute, id, amount, operation, and a list of valid slots.
relique:relic_sounds
An object containing equip and unequip sound keys.
/give Command Example
This command gives the player a Diamond that grants +5 Max Health when equipped in the ring slot, and plays a specific sound when equipped or unequipped.
Attribute Operations: Relique uses standard Bukkit attribute operations:
ADD_NUMBER: Adds (or subtracts) a flat amount to the base value.
ADD_SCALAR: Adds a scalar of the amount to the base value.
MULTIPLY_SCALAR_1: Multiplies the value by the specified scalar.
For Developers: The ComponentMap API
If you are generating relics dynamically via code, you should not modify raw NBT tags manually. Instead, use AbyssalLib's ComponentMap to safely apply the strongly-typed data components to your ItemStack.
The ComponentMap acts as a bridge, instantly serializing your Java objects into the correct persistent NBT structure on the item.
Example: Applying Properties via Code
public ItemStack createCustomRelic() {
ItemStack item = new ItemStack(Material.DIAMOND);
// 1. Wrap the Bukkit ItemStack in a ComponentMap
ComponentMap components = new ComponentMap(item);
// 2. Define our custom attribute modifier
RelicAttributeModifier healthBonus = new RelicAttributeModifier(
Key.key("minecraft", "generic.max_health"), // The attribute to modify
Key.key("relique", "health_bonus"), // A unique ID for this specific modifier
5.0, // The amount to add
Operation.ADD_NUMBER, // The mathematical operation
List.of("ring") // Which slots this applies in (use "any" for all)
);
// 3. Apply the properties component
components.setData(new RelicProperties(
new RelicProperties.Properties(List.of(healthBonus))
));
// 4. Apply the custom equip sounds
components.setData(new RelicEquipSound(
new RelicEquipSound.Sounds(
Key.key("minecraft:item.armor.equip_diamond"), // Equip sound
Key.key("minecraft:entity.chicken.egg") // Unequip sound
)
));
// The underlying ItemStack is now automatically updated with the correct NBT!
return item;
}