Wearable Component
Player component handler for wearable items.
Overview
This component is attached to players and manages their wearable items.
It provides methods to equip and unequip items, as well as to access the inventory of wearables.
This interface extends both Component and WearablesInventory,
allowing it to be used as a component in the CCA system while also providing the necessary methods to manage wearable items
Usage
Use the @Override tag to implement the necessary methods for your custom slot. For example:
@Override
public void setStack(ItemStack stack, ItemStack previous) {
WearablesComponents.WEARABLES.get(player)
.trySet(player, slotType, slotIndex, stack);
markDirty();
}
Methods
| Method | Description |
|---|---|
trySet(PlayerEntity player, Identifier slotType, int index, ItemStack stack) | Performs validation to ensure that the item stack is a valid wearable item for the specified slot type |
remove(PlayerEntity player, Identifier slotType, int index) | Performs validation to ensure that the item stack can be unequipped. |
Events
This class does not fire or use any events.
