Slot
Custom slot implementation.
Overview
This slot interacts with the WearablesComponent to manage wearable items in a player's inventory. Extends Slot to integrate with Minecraft's inventory system, allowing for seamless interaction with wearable items.
Usage
Use the @Override tag to implement the necessary methods for your custom slot. For example:
@Override
public ItemStack getStack() {
return WearablesComponents.WEARABLES.get(player)
.getStack(slotType, slotIndex);
}
Methods
| Method | Description |
|---|---|
canInsert(ItemStack stack) | Checks the given stack if it can be inserted into a slot. |
getStack() | Returns the ItemStack currently in the slot, or null. |
setStack(ItemStack stack, ItemStack previous) | Sets the stack in the slot, via WearablesComponents. |
takeStack() | Removes the ItemStack from the slot. Used in unequipping the item. |
hasStack() | Checks if the slot is empty or taken. |
getMaxItemCount(ItemStack stack) | Returns the max item count for the slot. By default this is 1. |
canTakeItems(PlayerEntity player) | Returns true or false if the given player can remove the equipped item. |
Events
This class does not fire or use any events.
