Search in sources :

Example 1 with ISlot

use of meteordevelopment.meteorclient.mixininterface.ISlot in project meteor-client by MeteorDevelopment.

the class InventorySorter method generateActions.

private void generateActions() {
    // Find all slots and sort them
    List<MySlot> slots = new ArrayList<>();
    for (Slot slot : screen.getScreenHandler().slots) {
        if (getInvPart(slot) == originInvPart)
            slots.add(new MySlot(((ISlot) slot).getId(), slot.getStack()));
    }
    slots.sort(Comparator.comparingInt(value -> value.id));
    // Generate actions
    generateStackingActions(slots);
    generateSortingActions(slots);
}
Also used : PlayerInventory(net.minecraft.entity.player.PlayerInventory) Pair(net.minecraft.util.Pair) ShulkerBoxScreen(net.minecraft.client.gui.screen.ingame.ShulkerBoxScreen) SimpleInventory(net.minecraft.inventory.SimpleInventory) Slot(net.minecraft.screen.slot.Slot) Registry(net.minecraft.util.registry.Registry) ArrayList(java.util.ArrayList) ItemStack(net.minecraft.item.ItemStack) ISlot(meteordevelopment.meteorclient.mixininterface.ISlot) List(java.util.List) GenericContainerScreen(net.minecraft.client.gui.screen.ingame.GenericContainerScreen) PeekScreen(meteordevelopment.meteorclient.utils.render.PeekScreen) CreativeInventoryScreen(net.minecraft.client.gui.screen.ingame.CreativeInventoryScreen) Comparator(java.util.Comparator) HandledScreen(net.minecraft.client.gui.screen.ingame.HandledScreen) ArrayList(java.util.ArrayList) Slot(net.minecraft.screen.slot.Slot) ISlot(meteordevelopment.meteorclient.mixininterface.ISlot)

Aggregations

ArrayList (java.util.ArrayList)1 Comparator (java.util.Comparator)1 List (java.util.List)1 ISlot (meteordevelopment.meteorclient.mixininterface.ISlot)1 PeekScreen (meteordevelopment.meteorclient.utils.render.PeekScreen)1 CreativeInventoryScreen (net.minecraft.client.gui.screen.ingame.CreativeInventoryScreen)1 GenericContainerScreen (net.minecraft.client.gui.screen.ingame.GenericContainerScreen)1 HandledScreen (net.minecraft.client.gui.screen.ingame.HandledScreen)1 ShulkerBoxScreen (net.minecraft.client.gui.screen.ingame.ShulkerBoxScreen)1 PlayerInventory (net.minecraft.entity.player.PlayerInventory)1 SimpleInventory (net.minecraft.inventory.SimpleInventory)1 ItemStack (net.minecraft.item.ItemStack)1 Slot (net.minecraft.screen.slot.Slot)1 Pair (net.minecraft.util.Pair)1 Registry (net.minecraft.util.registry.Registry)1