Package net.minecraft.inventory
Class Inventory
- java.lang.Object
-
- net.minecraft.inventory.Inventory
-
- All Implemented Interfaces:
IClearable
,IInventory
,IRecipeHelperPopulator
- Direct Known Subclasses:
ComposterBlock.EmptyInventory
,ComposterBlock.FullInventory
,ComposterBlock.PartialInventory
,EnderChestInventory
public class Inventory extends java.lang.Object implements IInventory, IRecipeHelperPopulator
-
-
Field Summary
Fields Modifier and Type Field Description private NonNullList<ItemStack>
items
private java.util.List<IInventoryChangedListener>
listeners
private int
size
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ItemStack
addItem(ItemStack p_174894_1_)
void
addListener(IInventoryChangedListener p_110134_1_)
boolean
canAddItem(ItemStack p_233541_1_)
void
clearContent()
ListNBT
createTag()
void
fillStackedContents(RecipeItemHelper p_194018_1_)
void
fromTag(ListNBT p_70486_1_)
int
getContainerSize()
ItemStack
getItem(int p_70301_1_)
boolean
isEmpty()
private boolean
isSameItem(ItemStack p_233540_1_, ItemStack p_233540_2_)
private void
moveItemsBetweenStacks(ItemStack p_223373_1_, ItemStack p_223373_2_)
private void
moveItemToEmptySlots(ItemStack p_223375_1_)
private void
moveItemToOccupiedSlotsWithSameType(ItemStack p_223372_1_)
java.util.List<ItemStack>
removeAllItems()
ItemStack
removeItem(int p_70298_1_, int p_70298_2_)
ItemStack
removeItemNoUpdate(int p_70304_1_)
ItemStack
removeItemType(Item p_223374_1_, int p_223374_2_)
void
removeListener(IInventoryChangedListener p_110132_1_)
void
setChanged()
void
setItem(int p_70299_1_, ItemStack p_70299_2_)
boolean
stillValid(PlayerEntity p_70300_1_)
java.lang.String
toString()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface net.minecraft.inventory.IInventory
canPlaceItem, countItem, getMaxStackSize, hasAnyOf, startOpen, stopOpen
-
-
-
-
Field Detail
-
size
private final int size
-
items
private final NonNullList<ItemStack> items
-
listeners
private java.util.List<IInventoryChangedListener> listeners
-
-
Constructor Detail
-
Inventory
public Inventory(int p_i50397_1_)
-
Inventory
public Inventory(ItemStack... p_i50398_1_)
-
-
Method Detail
-
addListener
public void addListener(IInventoryChangedListener p_110134_1_)
-
removeListener
public void removeListener(IInventoryChangedListener p_110132_1_)
-
getItem
public ItemStack getItem(int p_70301_1_)
- Specified by:
getItem
in interfaceIInventory
-
removeAllItems
public java.util.List<ItemStack> removeAllItems()
-
removeItem
public ItemStack removeItem(int p_70298_1_, int p_70298_2_)
- Specified by:
removeItem
in interfaceIInventory
-
canAddItem
public boolean canAddItem(ItemStack p_233541_1_)
-
removeItemNoUpdate
public ItemStack removeItemNoUpdate(int p_70304_1_)
- Specified by:
removeItemNoUpdate
in interfaceIInventory
-
setItem
public void setItem(int p_70299_1_, ItemStack p_70299_2_)
- Specified by:
setItem
in interfaceIInventory
-
getContainerSize
public int getContainerSize()
- Specified by:
getContainerSize
in interfaceIInventory
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty
in interfaceIInventory
-
setChanged
public void setChanged()
- Specified by:
setChanged
in interfaceIInventory
-
stillValid
public boolean stillValid(PlayerEntity p_70300_1_)
- Specified by:
stillValid
in interfaceIInventory
-
clearContent
public void clearContent()
- Specified by:
clearContent
in interfaceIClearable
-
fillStackedContents
public void fillStackedContents(RecipeItemHelper p_194018_1_)
- Specified by:
fillStackedContents
in interfaceIRecipeHelperPopulator
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
moveItemToEmptySlots
private void moveItemToEmptySlots(ItemStack p_223375_1_)
-
moveItemToOccupiedSlotsWithSameType
private void moveItemToOccupiedSlotsWithSameType(ItemStack p_223372_1_)
-
moveItemsBetweenStacks
private void moveItemsBetweenStacks(ItemStack p_223373_1_, ItemStack p_223373_2_)
-
fromTag
public void fromTag(ListNBT p_70486_1_)
-
createTag
public ListNBT createTag()
-
-