Package net.minecraft.world
Interface Container
- All Superinterfaces:
Clearable
- All Known Subinterfaces:
ContainerEntity
,ContainerSingleItem
,ContainerSingleItem.BlockContainerSingleItem
,CraftingContainer
,Hopper
,RandomizableContainer
,WorldlyContainer
- All Known Implementing Classes:
AbstractFurnaceBlockEntity
,AbstractMinecartContainer
,BarrelBlockEntity
,BaseContainerBlockEntity
,BlastFurnaceBlockEntity
,BrewingStandBlockEntity
,ChestBlockEntity
,ChestBoat
,ChiseledBookShelfBlockEntity
,ComposterBlock.EmptyContainer
,ComposterBlock.InputContainer
,ComposterBlock.OutputContainer
,CompoundContainer
,CrafterBlockEntity
,DecoratedPotBlockEntity
,DispenserBlockEntity
,DropperBlockEntity
,FurnaceBlockEntity
,HopperBlockEntity
,Inventory
,JukeboxBlockEntity
,MerchantContainer
,MinecartChest
,MinecartHopper
,PlayerEnderChestContainer
,RandomizableContainerBlockEntity
,RecipeBookExtensionTest.RecipeBookTestContainer
,ResultContainer
,ShulkerBoxBlockEntity
,SimpleContainer
,SmokerBlockEntity
,TransientCraftingContainer
,TrappedChestBlockEntity
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptiondefault boolean
canPlaceItem
(int pSlot, ItemStack pStack) Returnstrue
if automation is allowed to insert the given stack (ignoring stack size) into the given slot.default boolean
canTakeItem
(Container pTarget, int pSlot, ItemStack pStack) Returnstrue
if the given stack can be extracted into the target inventory.default int
Returns the total amount of the specified item in this inventory.int
getItem
(int pSlot) Returns the stack in the given slot.default int
default int
getMaxStackSize
(ItemStack pStack) default boolean
hasAnyMatching
(Predicate<ItemStack> pPredicate) default boolean
Returnstrue
if any item from the passed set exists in this inventory.boolean
isEmpty()
removeItem
(int pSlot, int pAmount) Removes up to a specified number of items from an inventory slot and returns them in a new stack.removeItemNoUpdate
(int pSlot) Removes a stack from the given slot and returns it.void
void
Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections).default void
boolean
stillValid
(Player pPlayer) Don't rename this method to canInteractWith due to conflicts with Containerstatic boolean
stillValidBlockEntity
(BlockEntity pBlockEntity, Player pPlayer) static boolean
stillValidBlockEntity
(BlockEntity pBlockEntity, Player pPlayer, float pDistance) default void
Methods inherited from interface net.minecraft.world.Clearable
clearContent
-
Field Details
-
DEFAULT_DISTANCE_BUFFER
static final float DEFAULT_DISTANCE_BUFFER- See Also:
-
-
Method Details
-
getContainerSize
int getContainerSize() -
isEmpty
boolean isEmpty() -
getItem
Returns the stack in the given slot. -
removeItem
Removes up to a specified number of items from an inventory slot and returns them in a new stack. -
removeItemNoUpdate
Removes a stack from the given slot and returns it. -
setItem
Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections). -
getMaxStackSize
default int getMaxStackSize() -
getMaxStackSize
-
setChanged
void setChanged() -
stillValid
Don't rename this method to canInteractWith due to conflicts with Container -
startOpen
-
stopOpen
-
canPlaceItem
Returnstrue
if automation is allowed to insert the given stack (ignoring stack size) into the given slot. For guis use Slot.isItemValid -
canTakeItem
Returnstrue
if the given stack can be extracted into the target inventory.- Parameters:
pTarget
- the container into which the item should be extractedpSlot
- the slot from which to extract the itempStack
- the item to extract- Returns:
true
if the given stack can be extracted into the target inventory
-
countItem
Returns the total amount of the specified item in this inventory. This method does not check for nbt. -
hasAnyOf
Returnstrue
if any item from the passed set exists in this inventory. -
hasAnyMatching
-
stillValidBlockEntity
-
stillValidBlockEntity
-