Class DefaultMenu

java.lang.Object
net.minecraft.world.inventory.AbstractContainerMenu
org.moddingx.libx.menu.MenuBase
org.moddingx.libx.menu.DefaultMenu
Direct Known Subclasses:
BlockMenu, EntityMenu

public abstract class DefaultMenu extends MenuBase
A base class for menus that handles basic menu logic such as shift-clicks, and laying out slots. There are some things you need to pay attention to if you want to use this: Call the super constructor with
  • firstOutputSlot = the number of input slot you have / the first output slot number
  • firstInventorySlot = the number of input slots and output slots you have / the first player inventory slot number
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    final int
     
    final int
     
    protected final net.minecraft.world.level.Level
     
    protected final net.minecraft.world.entity.player.Player
     

    Fields inherited from class org.moddingx.libx.menu.MenuBase

    playerInventory

    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
    DefaultMenu(net.minecraft.world.inventory.MenuType<?> type, int windowId, net.minecraft.world.level.Level level, net.minecraft.world.entity.player.Inventory inventory, net.minecraft.world.entity.player.Player player, int firstOutputSlot, int firstInventorySlot)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    net.minecraft.world.level.Level
     
    net.minecraft.world.item.ItemStack
    quickMoveStack(net.minecraft.world.entity.player.Player player, int index)
     

    Methods inherited from class org.moddingx.libx.menu.MenuBase

    addSlotBox, addSlotBox, addSlotRange, addSlotRange, layoutPlayerInventorySlots, moveItemStackTo

    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, 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

    • player

      protected final net.minecraft.world.entity.player.Player player
    • level

      protected final net.minecraft.world.level.Level level
    • firstOutputSlot

      public final int firstOutputSlot
    • firstInventorySlot

      public final int firstInventorySlot
  • Constructor Details

    • DefaultMenu

      protected DefaultMenu(@Nullable net.minecraft.world.inventory.MenuType<?> type, int windowId, net.minecraft.world.level.Level level, net.minecraft.world.entity.player.Inventory inventory, net.minecraft.world.entity.player.Player player, int firstOutputSlot, int firstInventorySlot)
  • Method Details

    • getLevel

      public net.minecraft.world.level.Level getLevel()
    • quickMoveStack

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