Package net.citizensnpcs.api.trait.trait
Class Equipment
java.lang.Object
net.citizensnpcs.api.trait.Trait
net.citizensnpcs.api.trait.trait.Equipment
Represents an NPC's equipment.
-
Nested Class Summary
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionget
(int slot) Get an NPC's equipment from the given slot.get
(Equipment.EquipmentSlot slot) Get all of an NPC's equipment.Get all of the equipment as aMap
.void
Loads a trait.void
onAttach()
Called when the trait has been attached to anNPC
.void
onSpawn()
Called when anNPC
is spawned.void
run()
Called every tick if overridden.void
Saves a trait.void
Set the armor from the given slot as the given item.void
set
(Equipment.EquipmentSlot slot, ItemStack item)
-
Constructor Details
-
Equipment
public Equipment()
-
-
Method Details
-
get
- See Also:
-
get
Get an NPC's equipment from the given slot.- Parameters:
slot
- Slot where the armor is located (0-6)- Returns:
- ItemStack from the given armor slot
-
getEquipment
Get all of an NPC's equipment.- Returns:
- An array of an NPC's equipment
-
getEquipmentBySlot
Get all of the equipment as aMap
.- Returns:
- A mapping of slot to item
-
load
Description copied from class:Trait
Loads a trait.- Overrides:
load
in classTrait
- Parameters:
key
- DataKey to load from- Throws:
NPCLoadException
- Thrown if this trait failed to load properly
-
onAttach
public void onAttach()Description copied from class:Trait
-
onSpawn
public void onSpawn()Description copied from class:Trait
Called when anNPC
is spawned.NPC.getEntity()
will return null until this is called. This is also called onAttach when the NPC is already spawned. -
run
public void run()Description copied from class:Trait
Called every tick if overridden. -
save
Description copied from class:Trait
Saves a trait. -
set
- See Also:
-
set
Set the armor from the given slot as the given item.- Parameters:
slot
- Slot of the armor (must be between 0 and 5)item
- Item to set the armor as
-