Class InventorySimple

java.lang.Object
codechicken.lib.inventory.InventorySimple
All Implemented Interfaces:
Iterable<net.minecraft.world.item.ItemStack>, net.minecraft.world.Clearable, net.minecraft.world.Container, net.minecraft.world.entity.SlotProvider, net.neoforged.neoforge.common.extensions.ContainerExtension

public class InventorySimple extends Object implements net.minecraft.world.Container
Simple IInventory implementation with an array of items, name and maximum stack size
  • Nested Class Summary

    Nested classes/interfaces inherited from interface net.minecraft.world.Container

    net.minecraft.world.Container.ContainerIterator
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    net.minecraft.world.item.ItemStack[]
     
    int
     
     

    Fields inherited from interface net.minecraft.world.Container

    DEFAULT_DISTANCE_BUFFER
  • Constructor Summary

    Constructors
    Constructor
    Description
    InventorySimple(int size)
     
    InventorySimple(int size, int limit)
     
    InventorySimple(int size, int limit, String name)
     
    InventorySimple(int size, String name)
     
    InventorySimple(net.minecraft.world.item.ItemStack[] items)
     
    InventorySimple(net.minecraft.world.item.ItemStack[] items, int limit)
     
    InventorySimple(net.minecraft.world.item.ItemStack[] items, int limit, String name)
     
    InventorySimple(net.minecraft.world.item.ItemStack[] items, String name)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    int
     
    net.minecraft.world.item.ItemStack
    getItem(int slot)
     
    int
     
    boolean
     
    net.minecraft.world.item.ItemStack
    removeItem(int slot, int amount)
     
    net.minecraft.world.item.ItemStack
     
    void
     
    void
    setItem(int slot, net.minecraft.world.item.ItemStack stack)
     
    boolean
    stillValid(net.minecraft.world.entity.player.Player player)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface net.minecraft.world.Container

    canPlaceItem, canTakeItem, countItem, getEntitiesWithContainerOpen, getMaxStackSize, getSlot, hasAnyMatching, hasAnyOf, iterator, startOpen, stopOpen

    Methods inherited from interface net.neoforged.neoforge.common.extensions.ContainerExtension

    onTransfer, setItem

    Methods inherited from interface java.lang.Iterable

    forEach, spliterator

    Methods inherited from interface net.minecraft.world.entity.SlotProvider

    getSlotsFromRange
  • Field Details

    • items

      public net.minecraft.world.item.ItemStack[] items
    • limit

      public int limit
    • name

      public String name
  • Constructor Details

    • InventorySimple

      public InventorySimple(net.minecraft.world.item.ItemStack[] items, int limit, String name)
    • InventorySimple

      public InventorySimple(net.minecraft.world.item.ItemStack[] items, String name)
    • InventorySimple

      public InventorySimple(net.minecraft.world.item.ItemStack[] items, int limit)
    • InventorySimple

      public InventorySimple(net.minecraft.world.item.ItemStack[] items)
    • InventorySimple

      public InventorySimple(int size, int limit, String name)
    • InventorySimple

      public InventorySimple(int size, int limit)
    • InventorySimple

      public InventorySimple(int size, String name)
    • InventorySimple

      public InventorySimple(int size)
  • Method Details

    • getContainerSize

      public int getContainerSize()
      Specified by:
      getContainerSize in interface net.minecraft.world.Container
    • isEmpty

      public boolean isEmpty()
      Specified by:
      isEmpty in interface net.minecraft.world.Container
    • getItem

      public net.minecraft.world.item.ItemStack getItem(int slot)
      Specified by:
      getItem in interface net.minecraft.world.Container
    • removeItem

      public net.minecraft.world.item.ItemStack removeItem(int slot, int amount)
      Specified by:
      removeItem in interface net.minecraft.world.Container
    • removeItemNoUpdate

      public net.minecraft.world.item.ItemStack removeItemNoUpdate(int slot)
      Specified by:
      removeItemNoUpdate in interface net.minecraft.world.Container
    • setItem

      public void setItem(int slot, net.minecraft.world.item.ItemStack stack)
      Specified by:
      setItem in interface net.minecraft.world.Container
    • getMaxStackSize

      public int getMaxStackSize()
      Specified by:
      getMaxStackSize in interface net.minecraft.world.Container
    • stillValid

      public boolean stillValid(net.minecraft.world.entity.player.Player player)
      Specified by:
      stillValid in interface net.minecraft.world.Container
    • setChanged

      public void setChanged()
      Specified by:
      setChanged in interface net.minecraft.world.Container
    • clearContent

      public void clearContent()
      Specified by:
      clearContent in interface net.minecraft.world.Clearable