Class ItemHandlerInventoryState
java.lang.Object
org.cyclops.commoncapabilities.api.capability.inventorystate.ItemHandlerInventoryState
- All Implemented Interfaces:
net.minecraftforge.items.IItemHandler
,IInventoryState
- Direct Known Subclasses:
ItemHandlerModifiableInventoryState
public class ItemHandlerInventoryState
extends Object
implements IInventoryState, net.minecraftforge.items.IItemHandler
An inventory state implementation that wraps around an
IItemHandlerModifiable
.-
Constructor Summary
ConstructorDescriptionItemHandlerInventoryState
(net.minecraftforge.items.IItemHandler itemHandler) -
Method Summary
Modifier and TypeMethodDescriptionnet.minecraft.world.item.ItemStack
extractItem
(int slot, int amount, boolean simulate) int
getSlotLimit
(int slot) int
getSlots()
net.minecraft.world.item.ItemStack
getStackInSlot
(int slot) int
getState()
Get a state value which represents the current state of an inventory.net.minecraft.world.item.ItemStack
insertItem
(int slot, net.minecraft.world.item.ItemStack stack, boolean simulate) boolean
isItemValid
(int slot, net.minecraft.world.item.ItemStack itemStack) protected void
-
Constructor Details
-
ItemHandlerInventoryState
public ItemHandlerInventoryState(net.minecraftforge.items.IItemHandler itemHandler)
-
-
Method Details
-
setNewHash
protected void setNewHash() -
getState
public int getState()Description copied from interface:IInventoryState
Get a state value which represents the current state of an inventory. This method must be able to calculate the state very quickly. Ideally, this should be pre-calculated. If inventory contents change, this method is guaranteed to return a different result. A different state does however not necessarily guarantee an inventory change but it should in most cases since callers might gate expensive logic behind hash changes.- Specified by:
getState
in interfaceIInventoryState
- Returns:
- A value representing the current state of an inventory.
-
getSlots
public int getSlots()- Specified by:
getSlots
in interfacenet.minecraftforge.items.IItemHandler
-
getStackInSlot
public net.minecraft.world.item.ItemStack getStackInSlot(int slot) - Specified by:
getStackInSlot
in interfacenet.minecraftforge.items.IItemHandler
-
insertItem
public net.minecraft.world.item.ItemStack insertItem(int slot, net.minecraft.world.item.ItemStack stack, boolean simulate) - Specified by:
insertItem
in interfacenet.minecraftforge.items.IItemHandler
-
extractItem
public net.minecraft.world.item.ItemStack extractItem(int slot, int amount, boolean simulate) - Specified by:
extractItem
in interfacenet.minecraftforge.items.IItemHandler
-
getSlotLimit
public int getSlotLimit(int slot) - Specified by:
getSlotLimit
in interfacenet.minecraftforge.items.IItemHandler
-
isItemValid
public boolean isItemValid(int slot, @Nonnull net.minecraft.world.item.ItemStack itemStack) - Specified by:
isItemValid
in interfacenet.minecraftforge.items.IItemHandler
-