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
Nested ClassesModifier and TypeClassDescriptionstatic enumstatic class -
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionget(Equipment.EquipmentSlot eslot) Get an NPC's equipment from the given slot.Gets the NPC's cosmetic equipment from the given slot.Get all of an NPC's cosmetic equipment.Get all of an NPC's equipment.Get all of the equipment as aMap.voidLoads a trait.voidonAttach()Called when the trait has been attached to anNPC.voidonSpawn()Called when anNPCis spawned.voidrun()Called every tick if overridden.voidSaves a trait.voidset(Equipment.EquipmentSlot eslot, ItemStack item) Set the armor from the given slot as the given item.voidsetCosmetic(Equipment.EquipmentSlot slot, ItemStack stack) Set the cosmetic equipment in the given slot
-
Constructor Details
-
Equipment
public Equipment()
-
-
Method Details
-
get
Get an NPC's equipment from the given slot.- Parameters:
slot- Slot where the equipment is located- Returns:
- ItemStack from the given equipment slot
-
getCosmetic
Gets the NPC's cosmetic equipment from the given slot. Nullable.- Parameters:
slot- Equipment slot- Returns:
- ItemStack or null in the given equipment slot
-
getCosmeticEquipment
Get all of an NPC's cosmetic equipment.- Returns:
- An array of an NPC's cosmetic equipment
-
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:TraitLoads a trait.- Overrides:
loadin 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:TraitCalled when anNPCis 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:TraitCalled every tick if overridden. -
save
Description copied from class:TraitSaves a trait. -
set
Set the armor from the given slot as the given item.- Parameters:
item- Item to set the armor asslot- Equipment slot
-
setCosmetic
Set the cosmetic equipment in the given slot- Parameters:
slot- The equipment slotstack- Thew new itemstack
-