Package net.minecraft.world
Interface Container
- All Superinterfaces:
Clearable,ContainerExtension,Iterable<ItemStack>
- All Known Subinterfaces:
ContainerEntity,ContainerSingleItem,ContainerSingleItem.BlockContainerSingleItem,CraftingContainer,Hopper,ListBackedContainer,RandomizableContainer,WorldlyContainer
- All Known Implementing Classes:
AbstractChestBoat,AbstractFurnaceBlockEntity,AbstractMinecartContainer,BarrelBlockEntity,BaseContainerBlockEntity,BlastFurnaceBlockEntity,BrewingStandBlockEntity,ChestBlockEntity,ChestBoat,ChestRaft,ChiseledBookShelfBlockEntity,ComposterBlock.EmptyContainer,ComposterBlock.InputContainer,ComposterBlock.OutputContainer,CompoundContainer,CrafterBlockEntity,DecoratedPotBlockEntity,DispenserBlockEntity,DropperBlockEntity,FurnaceBlockEntity,HopperBlockEntity,Inventory,JukeboxBlockEntity,MerchantContainer,MinecartChest,MinecartHopper,PlayerEnderChestContainer,RandomizableContainerBlockEntity,ResultContainer,ShelfBlockEntity,ShulkerBoxBlockEntity,SimpleContainer,SmokerBlockEntity,TransientCraftingContainer,TrappedChestBlockEntity
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptiondefault booleancanPlaceItem(int pSlot, ItemStack pStack) Returnstrueif automation is allowed to insert the given stack (ignoring stack size) into the given slot.default booleancanTakeItem(Container pTarget, int pSlot, ItemStack pStack) Returnstrueif the given stack can be extracted into the target inventory.default intReturns the total amount of the specified item in this inventory.intdefault List<ContainerUser> getItem(int pSlot) Returns the stack in the given slot.default intdefault intgetMaxStackSize(ItemStack pStack) default booleanhasAnyMatching(Predicate<ItemStack> pPredicate) default booleanReturnstrueif any item from the passed set exists in this inventory.booleanisEmpty()iterator()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.voidvoidSets the given item stack to the specified slot in the inventory (can be crafting or armor sections).default voidstartOpen(ContainerUser pUser) booleanstillValid(Player pPlayer) Don't rename this method to canInteractWith due to conflicts with Containerstatic booleanstillValidBlockEntity(BlockEntity pBlockEntity, Player pPlayer) static booleanstillValidBlockEntity(BlockEntity pBlockEntity, Player pPlayer, float pDistance) default voidstopOpen(ContainerUser pUser) Methods inherited from interface net.minecraft.world.Clearable
clearContentMethods inherited from interface net.neoforged.neoforge.common.extensions.ContainerExtension
onTransfer, setItemMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
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
-
getEntitiesWithContainerOpen
-
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:
pTarget- the container into which the item should be extractedpSlot- the slot from which to extract the itempStack- 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
-
iterator
-