Class AbstractLazuliContainer

java.lang.Object
net.minecraft.world.inventory.AbstractContainerMenu
top.girlkisser.lazuli.api.menu.AbstractLazuliContainer
Direct Known Subclasses:
AbstractBlockEntityContainer

public abstract class AbstractLazuliContainer extends net.minecraft.world.inventory.AbstractContainerMenu
A basic implementation for AbstractContainerMenu providing quickMoveStack and some helper functions.
Based on McJty's container guide.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static interface 
    A factory to create Slots from.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected net.minecraft.world.entity.player.Inventory
    The player's inventory.
    protected final int
    The amount of slots in the container.

    Fields inherited from class net.minecraft.world.inventory.AbstractContainerMenu

    CARRIED_SLOT_SIZE, containerId, QUICKCRAFT_HEADER_CONTINUE, QUICKCRAFT_HEADER_END, QUICKCRAFT_HEADER_START, QUICKCRAFT_TYPE_CHARITABLE, QUICKCRAFT_TYPE_CLONE, QUICKCRAFT_TYPE_GREEDY, SLOT_CLICKED_OUTSIDE, slots
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    AbstractLazuliContainer(net.minecraft.world.inventory.MenuType<?> menuType, int slotCount, int containerId, net.minecraft.world.entity.player.Inventory playerInventory)
    A basic implementation for AbstractContainerMenu.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected int
    addOutputSlotBox(net.minecraft.world.Container container, int index, int x, int y, int horizontalCount, int verticalCount, int dx, int dy)
    Add a 2D range of output slots.
    protected int
    addOutputSlotRange(net.minecraft.world.Container container, int index, int x, int y, int count, int dx)
    Add a range of output-only slots.
    protected void
    addPlayerInventorySlots(net.minecraft.world.Container playerInventory, int x, int y)
    Add slots for a player's inventory (9 slots by 4 slots).
    protected int
    addSlotBox(net.minecraft.world.Container container, int index, int x, int y, int horizontalCount, int verticalCount, int dx, int dy)
    Add a 2D range of slots.
    protected int
    addSlotBox(net.minecraft.world.Container container, int index, int x, int y, int horizontalCount, int verticalCount, int dx, int dy, AbstractLazuliContainer.SlotFactory factory)
    Add a 2D range of slots using the provided factory.
    protected int
    addSlotRange(net.minecraft.world.Container container, int index, int x, int y, int count, int dx)
    Add a range of slots.
    protected int
    addSlotRange(net.minecraft.world.Container container, int index, int x, int y, int count, int dx, AbstractLazuliContainer.SlotFactory factory)
    Add a range of slots using the provided slot factory to create slots with.
    net.minecraft.world.entity.player.Inventory
    Get the player's inventory.
    net.minecraft.world.item.ItemStack
    quickMoveStack(net.minecraft.world.entity.player.Player player, int index)
     

    Methods inherited from class net.minecraft.world.inventory.AbstractContainerMenu

    addDataSlot, addDataSlots, addSlot, addSlotListener, broadcastChanges, broadcastFullState, canDragTo, canItemQuickReplace, canTakeItemForPickAll, checkContainerDataCount, checkContainerSize, clearContainer, clicked, clickMenuButton, findSlot, getCarried, getItems, getQuickcraftHeader, getQuickcraftMask, getQuickCraftPlaceCount, getQuickcraftType, getRedstoneSignalFromBlockEntity, getRedstoneSignalFromContainer, getSlot, getStateId, getType, incrementStateId, initializeContents, isValidQuickcraftType, isValidSlotIndex, moveItemStackTo, removed, removeSlotListener, resetQuickCraft, resumeRemoteUpdates, sendAllDataToRemote, setCarried, setData, setItem, setRemoteCarried, setRemoteSlot, setRemoteSlotNoCopy, setSynchronizer, slotsChanged, stillValid, stillValid, suppressRemoteUpdates, transferState

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • slotCount

      protected final int slotCount
      The amount of slots in the container.
    • playerInventory

      protected net.minecraft.world.entity.player.Inventory playerInventory
      The player's inventory.
  • Constructor Details

    • AbstractLazuliContainer

      protected AbstractLazuliContainer(net.minecraft.world.inventory.MenuType<?> menuType, int slotCount, int containerId, net.minecraft.world.entity.player.Inventory playerInventory)
      A basic implementation for AbstractContainerMenu.
      Parameters:
      menuType - The menu type.
      slotCount - The amount of slots in the menu.
      containerId - The container ID.
      playerInventory - The player's inventory.
  • Method Details

    • quickMoveStack

      public net.minecraft.world.item.ItemStack quickMoveStack(net.minecraft.world.entity.player.Player player, int index)
      Specified by:
      quickMoveStack in class net.minecraft.world.inventory.AbstractContainerMenu
    • addSlotRange

      protected int addSlotRange(net.minecraft.world.Container container, int index, int x, int y, int count, int dx)
      Add a range of slots.
      Parameters:
      container - The inventory that the slots are for.
      index - The slot index that the first created slot should access.
      x - The X position of the first slot.
      y - The Y position of the first slot.
      count - How many slots to create.
      dx - The width/gap of each slot, usually 18.
      Returns:
      The slot index of the last slot + 1.
    • addSlotRange

      protected int addSlotRange(net.minecraft.world.Container container, int index, int x, int y, int count, int dx, AbstractLazuliContainer.SlotFactory factory)
      Add a range of slots using the provided slot factory to create slots with.
      Parameters:
      container - The inventory that the slots are for.
      index - The slot index that the first created slot should access.
      x - The X position of the first slot.
      y - The Y position of the first slot.
      count - How many slots to create.
      dx - The width/gap of each slot, usually 18.
      factory - The slot factory to use.
      Returns:
      The slot index of the last slot + 1.
    • addSlotBox

      protected int addSlotBox(net.minecraft.world.Container container, int index, int x, int y, int horizontalCount, int verticalCount, int dx, int dy)
      Add a 2D range of slots.
      Parameters:
      container - The inventory that the slots are for.
      index - The slot index that the first created slot should access.
      x - The X position of the first slot.
      y - The Y position of the first slot.
      horizontalCount - How many slots to create on the horizontal axis.
      verticalCount - How many slots to create on the vertical axis.
      dx - The width/gap of each slot, usually 18.
      dy - The height/gap of each slot, usually 18.
      Returns:
      The slot index of the last slot + 1.
    • addSlotBox

      protected int addSlotBox(net.minecraft.world.Container container, int index, int x, int y, int horizontalCount, int verticalCount, int dx, int dy, AbstractLazuliContainer.SlotFactory factory)
      Add a 2D range of slots using the provided factory.
      Parameters:
      container - The inventory that the slots are for.
      index - The slot index that the first created slot should access.
      x - The X position of the first slot.
      y - The Y position of the first slot.
      horizontalCount - How many slots to create on the horizontal axis.
      verticalCount - How many slots to create on the vertical axis.
      dx - The width/gap of each slot, usually 18.
      dy - The height/gap of each slot, usually 18.
      factory - The slot factory to use.
      Returns:
      The slot index of the last slot + 1.
    • addOutputSlotRange

      protected int addOutputSlotRange(net.minecraft.world.Container container, int index, int x, int y, int count, int dx)
      Add a range of output-only slots.
      Parameters:
      container - The inventory that the slots are for.
      index - The slot index that the first created slot should access.
      x - The X position of the first slot.
      y - The Y position of the first slot.
      count - How many slots to create.
      dx - The width/gap of each slot, usually 18.
      Returns:
      The slot index of the last slot + 1.
    • addOutputSlotBox

      protected int addOutputSlotBox(net.minecraft.world.Container container, int index, int x, int y, int horizontalCount, int verticalCount, int dx, int dy)
      Add a 2D range of output slots.
      Parameters:
      container - The inventory that the slots are for.
      index - The slot index that the first created slot should access.
      x - The X position of the first slot.
      y - The Y position of the first slot.
      horizontalCount - How many slots to create on the horizontal axis.
      verticalCount - How many slots to create on the vertical axis.
      dx - The width/gap of each slot, usually 18.
      dy - The height/gap of each slot, usually 18.
      Returns:
      The slot index of the last slot + 1.
    • addPlayerInventorySlots

      protected void addPlayerInventorySlots(net.minecraft.world.Container playerInventory, int x, int y)
      Add slots for a player's inventory (9 slots by 4 slots).
      Parameters:
      playerInventory - The player's inventory.
      x - The X position for the slots.
      y - The Y position for the slots.
    • getPlayerInventory

      public net.minecraft.world.entity.player.Inventory getPlayerInventory()
      Get the player's inventory.
      Returns:
      The player's inventory.