Search in sources :

Example 1 with InventorySlot

use of crazypants.enderio.machines.machine.tank.InventorySlot in project EnderIO by SleepyTrousers.

the class ContainerWiredCharger method addMachineSlots.

@Override
protected void addMachineSlots(@Nonnull InventoryPlayer playerInv) {
    addSlotToContainer(new InventorySlot(getInv(), 0, 75, 28));
    addSlotToContainer(new InventorySlot(getInv(), 1, 126, 28));
    baubles = BaublesUtil.instance().getBaubles(playerInv.player);
    if (baubles != null && BaublesUtil.WhoAmI.whoAmI(playerInv.player.world) == BaublesUtil.WhoAmI.SPCLIENT) {
        baubles = new ShadowInventory(baubles);
    }
    if (hasBaublesSlots() && (baubles == null)) {
        baubles = new ArrayInventory(getBaublesSize()) {

            @Override
            public boolean isItemValidForSlot(int i, @Nonnull ItemStack itemstack) {
                return false;
            }

            @Override
            @Nonnull
            public ItemStack getStackInSlot(int slot) {
                return new ItemStack(Blocks.BARRIER);
            }

            @Override
            @Nonnull
            public ItemStack decrStackSize(int slot, int amount) {
                return ItemStack.EMPTY;
            }

            @Override
            @Nonnull
            public ItemStack removeStackFromSlot(int index) {
                return ItemStack.EMPTY;
            }
        };
    }
    int baublesOffset = 196;
    for (final EntityEquipmentSlot slt : EntityEquipmentSlot.values()) {
        if (slt.getSlotType() == Type.ARMOR) {
            addSlotToContainer(new Slot(playerInv, 36 + slt.getIndex(), 6, 66 - slt.getIndex() * 18) {

                @Override
                public int getSlotStackLimit() {
                    return 1;
                }

                @Override
                public boolean isItemValid(@Nonnull ItemStack par1ItemStack) {
                    if (par1ItemStack.isEmpty()) {
                        return false;
                    }
                    return par1ItemStack.getItem().isValidArmor(par1ItemStack, slt, playerInv.player);
                }

                @Override
                @SideOnly(Side.CLIENT)
                public String getSlotTexture() {
                    return ItemArmor.EMPTY_SLOT_NAMES[slt.getIndex()];
                }
            });
        }
    }
    addSlotToContainer(new Slot(playerInv, 40, 6, 12 + 18 * 4) {

        @Override
        @Nullable
        @SideOnly(Side.CLIENT)
        public String getSlotTexture() {
            return "minecraft:items/empty_armor_slot_shield";
        }
    });
    if (hasBaublesSlots()) {
        for (int i = 0; i < baubles.getSizeInventory(); i++) {
            addSlotToContainer(new Slot(baubles, i, baublesOffset, 12 + i * 18) {

                @Override
                public boolean isItemValid(@Nonnull ItemStack par1ItemStack) {
                    return inventory.isItemValidForSlot(getSlotIndex(), par1ItemStack);
                }

                @Override
                public boolean canTakeStack(@Nonnull EntityPlayer playerIn) {
                    ItemStack stackInSlot = inventory.getStackInSlot(getSlotIndex());
                    if (stackInSlot.getItem() == Item.getItemFromBlock(Blocks.BARRIER)) {
                        return false;
                    }
                    return super.canTakeStack(playerIn);
                }
            });
        }
    }
}
Also used : EntityEquipmentSlot(net.minecraft.inventory.EntityEquipmentSlot) Nonnull(javax.annotation.Nonnull) ArrayInventory(com.enderio.core.common.util.ArrayInventory) InventorySlot(crazypants.enderio.machines.machine.tank.InventorySlot) ShadowInventory(crazypants.enderio.util.ShadowInventory) SideOnly(net.minecraftforge.fml.relauncher.SideOnly) Point(java.awt.Point) EntityEquipmentSlot(net.minecraft.inventory.EntityEquipmentSlot) GhostSlot(com.enderio.core.client.gui.widget.GhostSlot) InventorySlot(crazypants.enderio.machines.machine.tank.InventorySlot) GhostBackgroundItemSlot(com.enderio.core.client.gui.widget.GhostBackgroundItemSlot) Slot(net.minecraft.inventory.Slot) EntityPlayer(net.minecraft.entity.player.EntityPlayer) ItemStack(net.minecraft.item.ItemStack) Nullable(javax.annotation.Nullable)

Example 2 with InventorySlot

use of crazypants.enderio.machines.machine.tank.InventorySlot in project EnderIO by SleepyTrousers.

the class ContainerVat method addMachineSlots.

@Override
protected void addMachineSlots(@Nonnull InventoryPlayer playerInv) {
    addSlotToContainer(new InventorySlot(getInv(), 0, 56, 12));
    addSlotToContainer(new InventorySlot(getInv(), 1, 105, 12));
}
Also used : InventorySlot(crazypants.enderio.machines.machine.tank.InventorySlot)

Example 3 with InventorySlot

use of crazypants.enderio.machines.machine.tank.InventorySlot in project EnderIO by SleepyTrousers.

the class ContainerSagMill method addMachineSlots.

@Override
protected void addMachineSlots(@Nonnull InventoryPlayer playerInv) {
    addSlotToContainer(new InventorySlot(getInv(), 0, 80, 12));
    addSlotToContainer(new InventorySlot(getInv(), 1, 122, 23) {

        @Override
        @SideOnly(Side.CLIENT)
        public boolean isEnabled() {
            return getTe() instanceof TileSagMill.Normal;
        }
    });
    addSlotToContainer(new Slot(getInv(), 2, 49, 59) {

        @Override
        public boolean isItemValid(@Nonnull ItemStack par1ItemStack) {
            return false;
        }
    });
    addSlotToContainer(new Slot(getInv(), 3, 70, 59) {

        @Override
        public boolean isItemValid(@Nonnull ItemStack par1ItemStack) {
            return false;
        }
    });
    addSlotToContainer(new Slot(getInv(), 4, 91, 59) {

        @Override
        public boolean isItemValid(@Nonnull ItemStack par1ItemStack) {
            return false;
        }
    });
    addSlotToContainer(new Slot(getInv(), 5, 112, 59) {

        @Override
        public boolean isItemValid(@Nonnull ItemStack par1ItemStack) {
            return false;
        }
    });
}
Also used : InventorySlot(crazypants.enderio.machines.machine.tank.InventorySlot) Slot(net.minecraft.inventory.Slot) InventorySlot(crazypants.enderio.machines.machine.tank.InventorySlot) SideOnly(net.minecraftforge.fml.relauncher.SideOnly) ItemStack(net.minecraft.item.ItemStack)

Example 4 with InventorySlot

use of crazypants.enderio.machines.machine.tank.InventorySlot in project EnderIO by SleepyTrousers.

the class ContainerSliceAndSplice method addMachineSlots.

@Override
protected void addMachineSlots(@Nonnull InventoryPlayer playerInv) {
    for (int i = 0; i < INPUT_SLOTS.length; i++) {
        Point p = INPUT_SLOTS[i];
        addSlotToContainer(new InventorySlot(getInv(), i, p.x, p.y));
    }
    addSlotToContainer(new Slot(getInv(), 8, OUTPUT_SLOT.x, OUTPUT_SLOT.y) {

        @Override
        public boolean isItemValid(@Nullable ItemStack par1ItemStack) {
            return false;
        }

        @Override
        public int getSlotStackLimit() {
            return getTe().getInventoryStackLimit(getSlotIndex());
        }
    });
}
Also used : InventorySlot(crazypants.enderio.machines.machine.tank.InventorySlot) GhostSlot(com.enderio.core.client.gui.widget.GhostSlot) InventorySlot(crazypants.enderio.machines.machine.tank.InventorySlot) GhostBackgroundItemSlot(com.enderio.core.client.gui.widget.GhostBackgroundItemSlot) Slot(net.minecraft.inventory.Slot) Point(java.awt.Point) ItemStack(net.minecraft.item.ItemStack) Point(java.awt.Point)

Example 5 with InventorySlot

use of crazypants.enderio.machines.machine.tank.InventorySlot in project EnderIO by SleepyTrousers.

the class ContainerSoulBinder method addMachineSlots.

@Override
protected void addMachineSlots(@Nonnull InventoryPlayer playerInv) {
    addSlotToContainer(new InventorySlot(getInv(), 0, 38, 34));
    addSlotToContainer(new InventorySlot(getInv(), 1, 59, 34));
    addSlotToContainer(new Slot(getInv(), 2, 112, 34) {

        @Override
        public boolean isItemValid(@Nullable ItemStack par1ItemStack) {
            return false;
        }

        @Override
        public int getSlotStackLimit() {
            return getTe().getInventoryStackLimit(getSlotIndex());
        }
    });
    addSlotToContainer(new Slot(getInv(), 3, 134, 34) {

        @Override
        public boolean isItemValid(@Nullable ItemStack par1ItemStack) {
            return false;
        }

        @Override
        public int getSlotStackLimit() {
            return getTe().getInventoryStackLimit(getSlotIndex());
        }
    });
}
Also used : InventorySlot(crazypants.enderio.machines.machine.tank.InventorySlot) GhostSlot(com.enderio.core.client.gui.widget.GhostSlot) InventorySlot(crazypants.enderio.machines.machine.tank.InventorySlot) GhostBackgroundItemSlot(com.enderio.core.client.gui.widget.GhostBackgroundItemSlot) Slot(net.minecraft.inventory.Slot) ItemStack(net.minecraft.item.ItemStack)

Aggregations

InventorySlot (crazypants.enderio.machines.machine.tank.InventorySlot)6 Slot (net.minecraft.inventory.Slot)4 ItemStack (net.minecraft.item.ItemStack)4 GhostBackgroundItemSlot (com.enderio.core.client.gui.widget.GhostBackgroundItemSlot)3 GhostSlot (com.enderio.core.client.gui.widget.GhostSlot)3 Point (java.awt.Point)2 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)2 ArrayInventory (com.enderio.core.common.util.ArrayInventory)1 ShadowInventory (crazypants.enderio.util.ShadowInventory)1 Nonnull (javax.annotation.Nonnull)1 Nullable (javax.annotation.Nullable)1 EntityPlayer (net.minecraft.entity.player.EntityPlayer)1 EntityEquipmentSlot (net.minecraft.inventory.EntityEquipmentSlot)1