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 SummaryConstructors
- 
Method SummaryModifier 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- 
Inventorypublic Inventory()
 
- 
- 
Method Details- 
getContentsGets the contents of an NPC's inventory.- Returns:
- ItemStack array of an NPC's inventory contents
 
- 
getInventoryView
- 
loadDescription copied from class:TraitLoads a trait.- Overrides:
- loadin class- Trait
- Parameters:
- key- DataKey to load from
- Throws:
- NPCLoadException- Thrown if this trait failed to load properly
 
- 
onDespawnpublic void onDespawn()Description copied from class:TraitCalled just before the attachedNPCis despawned.NPC.getEntity()will be non-null.
- 
onSpawnpublic 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
- 
runpublic void run()Description copied from class:TraitCalled every tick if overridden.
- 
saveDescription copied from class:TraitSaves a trait.
- 
setContentsSets the contents of an NPC's inventory.- Parameters:
- contents- ItemStack array to set as the contents of an NPC's inventory
 
- 
setItem
- 
toString
 
-