Package net.citizensnpcs.api.trait.trait
Class Inventory
java.lang.Object
net.citizensnpcs.api.trait.Trait
net.citizensnpcs.api.trait.trait.Inventory
Represents an NPC's inventory.
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGets the contents of an NPC's inventory.voidLoads a trait.voidCalled just before the attachedNPCis despawned.voidonSpawn()Called when anNPCis spawned.voidopenInventory(Player sender) voidrun()Called every tick if overridden.voidSaves a trait.voidsetContents(ItemStack[] contents) Sets the contents of an NPC's inventory.voidtoString()
-
Constructor Details
-
Inventory
public Inventory()
-
-
Method Details
-
getContents
Gets the contents of an NPC's inventory.- Returns:
- ItemStack array of an NPC's inventory contents
-
getInventoryView
-
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
-
onDespawn
public void onDespawn()Description copied from class:TraitCalled just before the attachedNPCis despawned.NPC.getEntity()will be non-null. -
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. -
openInventory
-
run
public void run()Description copied from class:TraitCalled every tick if overridden. -
save
Description copied from class:TraitSaves a trait. -
setContents
Sets the contents of an NPC's inventory.- Parameters:
contents- ItemStack array to set as the contents of an NPC's inventory
-
setItem
-
toString
-