Package net.minecraft.world
Class SimpleContainer
java.lang.Object
net.minecraft.world.SimpleContainer
- All Implemented Interfaces:
Clearable
,Container
,StackedContentsCompatible
- Direct Known Subclasses:
ComposterBlock.EmptyContainer
,ComposterBlock.InputContainer
,ComposterBlock.OutputContainer
,PlayerEnderChestContainer
,RecipeBookExtensionTest.RecipeBookTestContainer
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final NonNullList
<ItemStack> private List
<ContainerListener> private final int
Fields inherited from interface net.minecraft.world.Container
DEFAULT_DISTANCE_BUFFER
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addListener
(ContainerListener pListener) Add a listener that will be notified when any item in this inventory is modified.boolean
canAddItem
(ItemStack pStack) void
createTag
(HolderLookup.Provider pLevelRegistry) void
fillStackedContents
(StackedContents pHelper) void
fromTag
(ListTag pTag, HolderLookup.Provider pLevelRegistry) int
getItem
(int pIndex) Returns the stack in the given slot.getItems()
boolean
isEmpty()
private void
moveItemsBetweenStacks
(ItemStack pStack, ItemStack pOther) private void
moveItemToEmptySlots
(ItemStack pStack) private void
removeItem
(int pIndex, int pCount) Removes up to a specified number of items from an inventory slot and returns them in a new stack.removeItemNoUpdate
(int pIndex) Removes a stack from the given slot and returns it.removeItemType
(Item pItem, int pAmount) void
removeListener
(ContainerListener pListener) Removes the specifiedContainerListener
from receiving further change notices.void
void
Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections).boolean
stillValid
(Player pPlayer) Don't rename this method to canInteractWith due to conflicts with ContainertoString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface net.minecraft.world.Container
canPlaceItem, canTakeItem, countItem, getMaxStackSize, getMaxStackSize, hasAnyMatching, hasAnyOf, startOpen, stopOpen
-
Field Details
-
size
private final int size -
items
-
listeners
-
-
Constructor Details
-
SimpleContainer
public SimpleContainer(int pSize) -
SimpleContainer
-
-
Method Details
-
addListener
Add a listener that will be notified when any item in this inventory is modified. -
removeListener
Removes the specifiedContainerListener
from receiving further change notices. -
getItem
Returns the stack in the given slot. -
removeAllItems
-
removeItem
Removes up to a specified number of items from an inventory slot and returns them in a new stack.- Specified by:
removeItem
in interfaceContainer
-
removeItemType
-
addItem
-
canAddItem
-
removeItemNoUpdate
Removes a stack from the given slot and returns it.- Specified by:
removeItemNoUpdate
in interfaceContainer
-
setItem
Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections). -
getContainerSize
public int getContainerSize()- Specified by:
getContainerSize
in interfaceContainer
-
isEmpty
public boolean isEmpty() -
setChanged
public void setChanged()- Specified by:
setChanged
in interfaceContainer
-
stillValid
Don't rename this method to canInteractWith due to conflicts with Container- Specified by:
stillValid
in interfaceContainer
-
clearContent
public void clearContent()- Specified by:
clearContent
in interfaceClearable
-
fillStackedContents
- Specified by:
fillStackedContents
in interfaceStackedContentsCompatible
-
toString
-
moveItemToEmptySlots
-
moveItemToOccupiedSlotsWithSameType
-
moveItemsBetweenStacks
-
fromTag
-
createTag
-
getItems
-