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,ResultContainer,ShulkerBoxBlockEntity,SimpleContainer,SmokerBlockEntity,TransientCraftingContainer,TrappedChestBlockEntity
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptiondefault booleancanPlaceItem(int slot, ItemStack stack) Returnstrueif automation is allowed to insert the given stack (ignoring stack size) into the given slot.default booleancanTakeItem(Container target, int slot, ItemStack stack) Returnstrueif the given stack can be extracted into the target inventory.default intReturns the total amount of the specified item in this inventory.intgetItem(int slot) Returns the stack in the given slot.default intdefault intgetMaxStackSize(ItemStack stack) default booleanhasAnyMatching(Predicate<ItemStack> predicate) default booleanReturnstrueif any item from the passed set exists in this inventory.booleanisEmpty()removeItem(int slot, int amount) 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.voidvoidSets the given item stack to the specified slot in the inventory (can be crafting or armor sections).default voidbooleanstillValid(Player player) Don't rename this method to canInteractWith due to conflicts with Containerstatic booleanstillValidBlockEntity(BlockEntity blockEntity, Player player) static booleanstillValidBlockEntity(BlockEntity blockEntity, Player player, float distance) default voidMethods 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
Returnstrueif automation is allowed to insert the given stack (ignoring stack size) into the given slot. For guis use Slot.isItemValid -
canTakeItem
Returnstrueif the given stack can be extracted into the target inventory.- Parameters:
target- the container into which the item should be extractedslot- the slot from which to extract the itemstack- the item to extract- Returns:
trueif 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
Returnstrueif any item from the passed set exists in this inventory. -
hasAnyMatching
-
stillValidBlockEntity
-
stillValidBlockEntity
-