Class SlotGroup
java.lang.Object
codechicken.lib.gui.modular.lib.container.SlotGroup
Used to configure slots a set of slots in a ContainerMenu.
The SlotGroup can then be passed to ModularGui elements such as
GuiSlots in order to give the gui control over slot positioning and rendering.
Ideally you should use a separate SlotGroup for each 'group' of slots, Meaning the players main inventory and hot bar should be separate ranges.
That said, if you have multiple slots spread out across something like a machine gui, You can add them all to one SlotGroup then
pass each individual slot from that range to a GuiSlots.singleSlot(GuiParent, ContainerScreenAccess, SlotGroup, int)
Created by brandon3055 on 08/09/2023
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionSlotGroup(ModularGuiContainerMenu containerMenu, int zone, int... quickMoveTo) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAllSlots(net.minecraft.world.Container container) voidaddAllSlots(net.minecraft.world.Container container, BiFunction<net.minecraft.world.Container, Integer, ModularSlot> makeSlot) voidaddPlayerArmor(net.minecraft.world.entity.player.Inventory inventory) voidaddPlayerBar(net.minecraft.world.entity.player.Inventory inventory) voidaddPlayerMain(net.minecraft.world.entity.player.Inventory inventory) voidaddPlayerOffhand(net.minecraft.world.entity.player.Inventory inventory) addSlot(ModularSlot slot) voidaddSlots(int slotCount, int startIndex, Function<Integer, ModularSlot> makeSlot) Convenient method for adding multiple slots.getSlot(int index) intindexOf(net.minecraft.world.inventory.Slot slot) intsize()slots()
-
Field Details
-
zone
public final int zone -
quickMoveTo
-
-
Constructor Details
-
SlotGroup
-
-
Method Details
-
addSlot
-
addSlots
Convenient method for adding multiple slots.- Parameters:
slotCount- The number of slots to be added.startIndex- Slot starting index.makeSlot- Builder used to create the slots, Input integer will start at startIndex and increment by one for each slot.
-
addAllSlots
public void addAllSlots(net.minecraft.world.Container container) -
addAllSlots
public void addAllSlots(net.minecraft.world.Container container, BiFunction<net.minecraft.world.Container, Integer, ModularSlot> makeSlot) -
addPlayerMain
public void addPlayerMain(net.minecraft.world.entity.player.Inventory inventory) -
addPlayerBar
public void addPlayerBar(net.minecraft.world.entity.player.Inventory inventory) -
addPlayerArmor
public void addPlayerArmor(net.minecraft.world.entity.player.Inventory inventory) -
addPlayerOffhand
public void addPlayerOffhand(net.minecraft.world.entity.player.Inventory inventory) -
size
public int size() -
getSlot
-
indexOf
public int indexOf(net.minecraft.world.inventory.Slot slot) -
slots
-