Class NBTSimpleInventoryItemHeld
java.lang.Object
org.cyclops.cyclopscore.inventory.SimpleInventory
org.cyclops.cyclopscore.inventory.NBTSimpleInventoryItemHeld
- All Implemented Interfaces:
net.minecraft.world.Clearable
,net.minecraft.world.Container
,net.minecraft.world.WorldlyContainer
,INBTInventory
,INBTSerializable
A simple inventory for a currently held item by a player that can be stored in NBT.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.cyclops.cyclopscore.persist.nbt.INBTSerializable
INBTSerializable.SelfNBTClassType
-
Field Summary
Modifier and TypeFieldDescriptionprotected final ItemLocation
protected final net.minecraft.world.entity.player.Player
protected final String
Fields inherited from class org.cyclops.cyclopscore.inventory.SimpleInventory
contents
Fields inherited from interface net.minecraft.world.Container
DEFAULT_DISTANCE_LIMIT, LARGE_MAX_STACK_SIZE
-
Constructor Summary
ConstructorDescriptionNBTSimpleInventoryItemHeld
(net.minecraft.world.entity.player.Player player, ItemLocation itemLocation, int size, int stackLimit, String tagName) Make a new instance. -
Method Summary
Modifier and TypeMethodDescriptionvoid
readFromNBT
(net.minecraft.nbt.CompoundTag data, String tagName) Read inventory data from the given NBT.void
void
writeToNBT
(net.minecraft.nbt.CompoundTag data, String tagName) Write inventory data to the given NBT.Methods inherited from class org.cyclops.cyclopscore.inventory.SimpleInventory
addDirtyMarkListener, canPlaceItem, canPlaceItemThroughFace, canTakeItemThroughFace, clearContent, fromNBT, getContainerSize, getItem, getItemHandler, getItemHandlerSided, getItemStacks, getMaxStackSize, getSlotsForFace, getState, isEmpty, onInventoryChanged, read, removeDirtyMarkListener, removeItem, removeItemNoUpdate, setItem, startOpen, stillValid, stopOpen, toNBT, write
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.minecraft.world.Container
canTakeItem, countItem, hasAnyMatching, hasAnyOf
-
Field Details
-
player
protected final net.minecraft.world.entity.player.Player player -
itemLocation
-
tagName
-
-
Constructor Details
-
NBTSimpleInventoryItemHeld
public NBTSimpleInventoryItemHeld(net.minecraft.world.entity.player.Player player, ItemLocation itemLocation, int size, int stackLimit, String tagName) Make a new instance.- Parameters:
player
- The player holding the item.itemLocation
- The item location.size
- The amount of slots in the inventory.stackLimit
- The stack limit for each slot.tagName
- The NBT tag name to store this inventory in. This should be the same tag name that is used to call the NBT read/write methods.
-
-
Method Details
-
setChanged
public void setChanged()- Specified by:
setChanged
in interfacenet.minecraft.world.Container
- Overrides:
setChanged
in classSimpleInventory
-
readFromNBT
Description copied from class:SimpleInventory
Read inventory data from the given NBT.- Overrides:
readFromNBT
in classSimpleInventory
- Parameters:
data
- The NBT data containing inventory data.tagName
- The NBT tag name where the info is located.
-
writeToNBT
Description copied from class:SimpleInventory
Write inventory data to the given NBT.- Overrides:
writeToNBT
in classSimpleInventory
- Parameters:
data
- The NBT tag that will receive inventory data.tagName
- The NBT tag name where the info must be located.
-