Class SimpleContainer
java.lang.Object
net.minecraft.world.SimpleContainer
- All Implemented Interfaces:
Iterable<ItemStack>, Clearable, Container, SlotProvider, StackedContentsCompatible, ContainerExtension
- Direct Known Subclasses:
ComposterBlock.EmptyContainer, ComposterBlock.InputContainer, ComposterBlock.OutputContainer, PlayerEnderChestContainer
-
Nested Class Summary
Nested classes/interfaces inherited from interface Container
Container.ContainerIterator -
Field Summary
FieldsFields inherited from interface Container
DEFAULT_DISTANCE_BUFFER -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancanAddItem(ItemStack itemStack) voidvoidfillStackedContents(StackedItemContents contents) voidintgetItem(int slot) Returns the stack in the given slot.getItems()booleanisEmpty()private voidmoveItemsBetweenStacks(ItemStack sourceStack, ItemStack targetStack) private voidmoveItemToEmptySlots(ItemStack sourceStack) private voidmoveItemToOccupiedSlotsWithSameType(ItemStack sourceStack) removeItem(int slot, int count) Removes up to a specified number of items from an inventory slot and returns them in a new stack.removeItemNoUpdate(int slot) Removes a stack from the given slot and returns it.removeItemType(Item itemType, int count) voidvoidSets the given item stack to the specified slot in the inventory (can be crafting or armor sections).voidSets the given item stack to the specified slot in the inventory (can be crafting or armor sections).booleanstillValid(Player player) Don't rename this method to canInteractWith due to conflicts with ContainervoidtoString()Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface Container
canPlaceItem, canTakeItem, countItem, getEntitiesWithContainerOpen, getMaxStackSize, getMaxStackSize, getSlot, hasAnyMatching, hasAnyOf, iterator, startOpen, stopOpenMethods inherited from interface ContainerExtension
onTransferMethods inherited from interface Iterable
forEach, spliteratorMethods inherited from interface SlotProvider
getSlotsFromRange
-
Field Details
-
size
private final int size -
items
-
-
Constructor Details
-
SimpleContainer
public SimpleContainer(int size) -
SimpleContainer
-
-
Method Details
-
getItem
-
removeAllItems
-
removeItem
Removes up to a specified number of items from an inventory slot and returns them in a new stack.- Specified by:
removeItemin interfaceContainer
-
removeItemType
-
addItem
-
canAddItem
-
removeItemNoUpdate
Removes a stack from the given slot and returns it.- Specified by:
removeItemNoUpdatein interfaceContainer
-
setItem
-
setItem
Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections).- Specified by:
setItemin interfaceContainerExtension- Parameters:
insideTransaction- Whentrue, non-transactional actions should be deferred. Whenfalse, non-transactional actions can be performed immediately.- See Also:
-
setChanged
public void setChanged()- Specified by:
setChangedin interfaceContainer
-
getContainerSize
public int getContainerSize()- Specified by:
getContainerSizein interfaceContainer
-
isEmpty
-
stillValid
Don't rename this method to canInteractWith due to conflicts with Container- Specified by:
stillValidin interfaceContainer
-
clearContent
public void clearContent()- Specified by:
clearContentin interfaceClearable
-
fillStackedContents
- Specified by:
fillStackedContentsin interfaceStackedContentsCompatible
-
toString
-
moveItemToEmptySlots
-
moveItemToOccupiedSlotsWithSameType
-
moveItemsBetweenStacks
-
fromItemList
-
storeAsItemList
-
getItems
-