Package top.girlkisser.lazuli.api.menu
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
Based on McJty's container guide.
AbstractContainerMenu providing
quickMoveStack and some helper functions.
Based on McJty's container guide.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceA factory to createSlots from. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected net.minecraft.world.entity.player.InventoryThe player's inventory.protected final intThe 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
ConstructorsModifierConstructorDescriptionprotectedAbstractLazuliContainer(net.minecraft.world.inventory.MenuType<?> menuType, int slotCount, int containerId, net.minecraft.world.entity.player.Inventory playerInventory) A basic implementation forAbstractContainerMenu. -
Method Summary
Modifier and TypeMethodDescriptionprotected intaddOutputSlotBox(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 intaddOutputSlotRange(net.minecraft.world.Container container, int index, int x, int y, int count, int dx) Add a range of output-only slots.protected voidaddPlayerInventorySlots(net.minecraft.world.Container playerInventory, int x, int y) Add slots for a player's inventory (9 slots by 4 slots).protected intaddSlotBox(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 intaddSlotBox(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 intaddSlotRange(net.minecraft.world.Container container, int index, int x, int y, int count, int dx) Add a range of slots.protected intaddSlotRange(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.InventoryGet the player's inventory.net.minecraft.world.item.ItemStackquickMoveStack(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
-
Field Details
-
slotCount
protected final int slotCountThe amount of slots in the container. -
playerInventory
protected net.minecraft.world.entity.player.Inventory playerInventoryThe 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 forAbstractContainerMenu.- 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:
quickMoveStackin classnet.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.
-
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.
-
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.
-