Class IndexedInventory
java.lang.Object
org.cyclops.cyclopscore.inventory.SimpleInventory
org.cyclops.cyclopscore.inventory.LargeInventory
org.cyclops.cyclopscore.inventory.IndexedInventory
- All Implemented Interfaces:
net.minecraft.world.Clearable
,net.minecraft.world.Container
,net.minecraft.world.WorldlyContainer
,INBTInventory
,IndexedSlotlessItemHandlerWrapper.IInventoryIndexReference
,INBTSerializable
public class IndexedInventory
extends LargeInventory
implements IndexedSlotlessItemHandlerWrapper.IInventoryIndexReference
An inventory that adds an index from item to slot on a regular inventory.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.cyclops.cyclopscore.persist.nbt.INBTSerializable
INBTSerializable.SelfNBTClassType
-
Field Summary
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
ConstructorDescriptionDefault constructor for NBT persistence, don't call this yourself.IndexedInventory
(int size, int stackLimit) Make a new instance. -
Method Summary
Modifier and TypeMethodDescriptionvoid
protected void
Map<net.minecraft.world.item.Item,
it.unimi.dsi.fastutil.ints.Int2ObjectMap<net.minecraft.world.item.ItemStack>> getIndex()
int
void
readFromNBT
(net.minecraft.nbt.CompoundTag data, String tag) Read inventory data from the given NBT.void
setItem
(int slotId, net.minecraft.world.item.ItemStack itemStack) Methods inherited from class org.cyclops.cyclopscore.inventory.LargeInventory
writeToNBT
Methods inherited from class org.cyclops.cyclopscore.inventory.SimpleInventory
addDirtyMarkListener, canPlaceItem, canPlaceItemThroughFace, canTakeItemThroughFace, fromNBT, getContainerSize, getItem, getItemHandler, getItemHandlerSided, getItemStacks, getMaxStackSize, getSlotsForFace, getState, isEmpty, onInventoryChanged, read, removeDirtyMarkListener, removeItem, removeItemNoUpdate, setChanged, 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
-
Constructor Details
-
IndexedInventory
public IndexedInventory()Default constructor for NBT persistence, don't call this yourself. -
IndexedInventory
public IndexedInventory(int size, int stackLimit) Make a new instance.- Parameters:
size
- The amount of slots in the inventory.stackLimit
- The stack limit for each slot.
-
-
Method Details
-
createIndex
protected void createIndex() -
readFromNBT
Description copied from class:LargeInventory
Read inventory data from the given NBT.- Overrides:
readFromNBT
in classLargeInventory
- Parameters:
data
- The NBT data containing inventory data.tag
- The NBT tag name where the info is located.
-
setItem
public void setItem(int slotId, net.minecraft.world.item.ItemStack itemStack) - Specified by:
setItem
in interfacenet.minecraft.world.Container
- Overrides:
setItem
in classSimpleInventory
-
clearContent
public void clearContent()- Specified by:
clearContent
in interfacenet.minecraft.world.Clearable
- Overrides:
clearContent
in classSimpleInventory
-
getInventoryReferenceStackLimit
public int getInventoryReferenceStackLimit()- Specified by:
getInventoryReferenceStackLimit
in interfaceIndexedSlotlessItemHandlerWrapper.IInventoryIndexReference
-
getIndex
public Map<net.minecraft.world.item.Item,it.unimi.dsi.fastutil.ints.Int2ObjectMap<net.minecraft.world.item.ItemStack>> getIndex()- Specified by:
getIndex
in interfaceIndexedSlotlessItemHandlerWrapper.IInventoryIndexReference
-
getEmptySlots
- Specified by:
getEmptySlots
in interfaceIndexedSlotlessItemHandlerWrapper.IInventoryIndexReference
-
getNonEmptySlots
- Specified by:
getNonEmptySlots
in interfaceIndexedSlotlessItemHandlerWrapper.IInventoryIndexReference
-