Interface ContainerItem


public interface ContainerItem
An item whose stacks carry an inventory (a backpack, a pouch), kept in the stack's minecraft:container component. ItemContainers.of(ItemStack) and HandlerTypes.CONTAINER.find(stack) open it.

 public class PouchItem extends Item implements ContainerItem {
     private static final ContainerLayout LAYOUT = ContainerLayout.builder(9)
             .filter(0, 9, stack -> !(stack.getItem() instanceof PouchItem)).build();

     public ContainerLayout containerLayout(ItemStack stack) { return LAYOUT; }
 }
 
  • Method Summary

    Modifier and Type
    Method
    Description
    containerLayout(net.minecraft.world.item.ItemStack stack)
    The stack's inventory layout, of at most 256 slots.
  • Method Details

    • containerLayout

      ContainerLayout containerLayout(net.minecraft.world.item.ItemStack stack)
      The stack's inventory layout, of at most 256 slots.