Class PlayerInventory
java.lang.Object
fr.fidorial.inventory.SimpleContainer
fr.fidorial.inventory.PlayerInventory
- All Implemented Interfaces:
Container
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe chestplate slot.static final intThe boots slot.static final intThe helmet slot.static final intThe number of hotbar slots.static final intThe first hotbar slot.static final intThe leggings slot.static final intThe first slot of the main inventory, right after the hotbar.static final intThe off hand slot.static final intThe number of slots of a player inventory, reserved ones included.static final intThe number of slots of the hotbar and the main inventory together, from 0. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic @Nullable EquipmentSlotequipmentSlotAt(int slot) The other way round fromslotOf(EquipmentSlot).static intslotOf(EquipmentSlot slot) Where a piece of equipment sits in this inventory.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Container
firstEmpty, setContents
-
Field Details
-
SIZE
public static final int SIZEThe number of slots of a player inventory, reserved ones included.- Since:
- 0.1.0
- See Also:
-
HOTBAR_START
public static final int HOTBAR_STARTThe first hotbar slot.- Since:
- 0.1.0
- See Also:
-
HOTBAR_SIZE
public static final int HOTBAR_SIZEThe number of hotbar slots.- Since:
- 0.1.0
- See Also:
-
MAIN_START
public static final int MAIN_STARTThe first slot of the main inventory, right after the hotbar.- Since:
- 0.1.0
- See Also:
-
STORAGE_SIZE
public static final int STORAGE_SIZEThe number of slots of the hotbar and the main inventory together, from 0.- Since:
- 0.1.0
- See Also:
-
FEET
public static final int FEETThe boots slot.- Since:
- 0.1.0
- See Also:
-
LEGS
public static final int LEGSThe leggings slot.- Since:
- 0.1.0
- See Also:
-
CHEST
public static final int CHESTThe chestplate slot.- Since:
- 0.1.0
- See Also:
-
HEAD
public static final int HEADThe helmet slot.- Since:
- 0.1.0
- See Also:
-
OFF_HAND
public static final int OFF_HANDThe off hand slot.- Since:
- 0.1.0
- See Also:
-
-
Constructor Details
-
PlayerInventory
public PlayerInventory()Creates an empty inventory.- Since:
- 0.1.0
-
-
Method Details
-
slotOf
Where a piece of equipment sits in this inventory.- Parameters:
slot- the equipment slot- Returns:
- the inventory slot,
-1for the main hand (it follows the selected hotbar slot) and for the slots a player does not have - Since:
- 0.1.0
-
equipmentSlotAt
The other way round fromslotOf(EquipmentSlot).- Parameters:
slot- an inventory slot- Returns:
- the equipment slot it holds,
nullfor the hotbar, the main inventory and the reserved slots - Since:
- 0.1.0
-