Search in sources :

Example 21 with Slot

use of net.minecraft.screen.slot.Slot in project Fabric-Course-118 by Kaupenjoe.

the class OrichalcumBlasterScreenHandler method transferSlot.

@Override
public ItemStack transferSlot(PlayerEntity player, int invSlot) {
    ItemStack newStack = ItemStack.EMPTY;
    Slot slot = this.slots.get(invSlot);
    if (slot != null && slot.hasStack()) {
        ItemStack originalStack = slot.getStack();
        newStack = originalStack.copy();
        if (invSlot < this.inventory.size()) {
            if (!this.insertItem(originalStack, this.inventory.size(), this.slots.size(), true)) {
                return ItemStack.EMPTY;
            }
        } else if (!this.insertItem(originalStack, 0, this.inventory.size(), false)) {
            return ItemStack.EMPTY;
        }
        if (originalStack.isEmpty()) {
            slot.setStack(ItemStack.EMPTY);
        } else {
            slot.markDirty();
        }
    }
    return newStack;
}
Also used : ModFuelSlot(net.kaupenjoe.mccourse.screen.slot.ModFuelSlot) ModResultSlot(net.kaupenjoe.mccourse.screen.slot.ModResultSlot) Slot(net.minecraft.screen.slot.Slot) ItemStack(net.minecraft.item.ItemStack)

Example 22 with Slot

use of net.minecraft.screen.slot.Slot in project Hypnotic-Client by Hypnotic-Development.

the class InventoryScreenMixin method dupe.

// Credits to Duper Trooper for publishing the dupe
// Original video https://www.youtube.com/watch?v=8Xd7DcApFbM
private void dupe() {
    Slot outputSlot = (Slot) ((PlayerScreenHandler) this.handler).slots.get(0);
    this.onMouseClick(outputSlot, outputSlot.id, 0, SlotActionType.THROW);
}
Also used : Slot(net.minecraft.screen.slot.Slot) PlayerScreenHandler(net.minecraft.screen.PlayerScreenHandler)

Example 23 with Slot

use of net.minecraft.screen.slot.Slot in project LittleMaidReBirth-Fabric by SistrScarlet.

the class LittleMaidScreenHandler method addSlotRange.

private int addSlotRange(Inventory inventory, int index, int x, int y, int amount, int dx) {
    for (int i = 0; i < amount; i++) {
        addSlot(new Slot(inventory, index, x, y));
        x += dx;
        index++;
    }
    return index;
}
Also used : EquipmentSlot(net.minecraft.entity.EquipmentSlot) Slot(net.minecraft.screen.slot.Slot)

Example 24 with Slot

use of net.minecraft.screen.slot.Slot in project LittleMaidReBirth-Fabric by SistrScarlet.

the class LittleMaidScreenHandler method layoutMaidInventorySlots.

private void layoutMaidInventorySlots() {
    // index 0~17
    addSlotBox(maidInventory, 1, 8, 76, 9, 18, 2, 18);
    // 18~19
    addSlot(new Slot(maidInventory, 0, 116, 44));
    addSlot(new Slot(maidInventory, 1 + 18 + 4, 152, 44));
    // 20~23
    addSlot(new Slot(maidInventory, 1 + 18 + EquipmentSlot.HEAD.getEntitySlotId(), 8, 8) {

        @Override
        public boolean canInsert(ItemStack stack) {
            return MobEntity.getPreferredEquipmentSlot(stack) == EquipmentSlot.HEAD;
        }
    });
    addSlot(new Slot(maidInventory, 1 + 18 + EquipmentSlot.CHEST.getEntitySlotId(), 8, 44) {

        @Override
        public boolean canInsert(ItemStack stack) {
            return MobEntity.getPreferredEquipmentSlot(stack) == EquipmentSlot.CHEST;
        }
    });
    addSlot(new Slot(maidInventory, 1 + 18 + EquipmentSlot.LEGS.getEntitySlotId(), 80, 8) {

        @Override
        public boolean canInsert(ItemStack stack) {
            return MobEntity.getPreferredEquipmentSlot(stack) == EquipmentSlot.LEGS;
        }
    });
    addSlot(new Slot(maidInventory, 1 + 18 + EquipmentSlot.FEET.getEntitySlotId(), 80, 44) {

        @Override
        public boolean canInsert(ItemStack stack) {
            return MobEntity.getPreferredEquipmentSlot(stack) == EquipmentSlot.FEET;
        }
    });
}
Also used : EquipmentSlot(net.minecraft.entity.EquipmentSlot) Slot(net.minecraft.screen.slot.Slot) ItemStack(net.minecraft.item.ItemStack)

Aggregations

Slot (net.minecraft.screen.slot.Slot)24 ItemStack (net.minecraft.item.ItemStack)14 EquipmentSlot (net.minecraft.entity.EquipmentSlot)5 ArrayList (java.util.ArrayList)4 List (java.util.List)4 ArmorStandPreset (eu.pb4.armorstandeditor.config.ArmorStandPreset)2 ConfigManager (eu.pb4.armorstandeditor.config.ConfigManager)2 ArmorStandData (eu.pb4.armorstandeditor.helpers.ArmorStandData)2 ArmorStandInventory (eu.pb4.armorstandeditor.helpers.ArmorStandInventory)2 ItemFrameInventory (eu.pb4.armorstandeditor.helpers.ItemFrameInventory)2 SPEInterface (eu.pb4.armorstandeditor.helpers.SPEInterface)2 ArmorStandEntityAccessor (eu.pb4.armorstandeditor.mixin.ArmorStandEntityAccessor)2 ItemFrameEntityAccessor (eu.pb4.armorstandeditor.mixin.ItemFrameEntityAccessor)2 ClickType (eu.pb4.sgui.api.ClickType)2 GuiElement (eu.pb4.sgui.api.elements.GuiElement)2 GuiElementBuilder (eu.pb4.sgui.api.elements.GuiElementBuilder)2 GuiElementInterface (eu.pb4.sgui.api.elements.GuiElementInterface)2 AnvilInputGui (eu.pb4.sgui.api.gui.AnvilInputGui)2 SimpleGui (eu.pb4.sgui.api.gui.SimpleGui)2 Collection (java.util.Collection)2