Search in sources :

Example 1 with SlotBlocked

use of pl.asie.charset.lib.ui.SlotBlocked in project Charset by CharsetMC.

the class ContainerPocketTable method addSlotToContainer.

@Override
protected Slot addSlotToContainer(Slot slot) {
    if (slot.inventory instanceof InventoryPlayer) {
        if (slot.isHere(slot.inventory, heldPos)) {
            slot = new SlotBlocked(slot.inventory, slot.getSlotIndex(), slot.xPos, slot.yPos);
        }
        if (slot.getSlotIndex() >= 9 && (slot.getSlotIndex() % 9) >= 6) {
            slot = new Slot(slot.inventory, slot.getSlotIndex(), slot.xPos, slot.yPos) {

                @Override
                public void onSlotChanged() {
                    super.onSlotChanged();
                    updateCraft();
                }
            };
            craftingSlots.add(slot);
        } else {
            nonCraftingInventorySlots.add(slot);
            if (slot.getSlotIndex() < 9) {
                hotbarSlots.add(slot);
            } else {
                mainInvSlots.add(slot);
            }
            if (slot.getSlotIndex() < 9 && slot.getHasStack() && slot.getStack().getItem() == CharsetCraftingPocket.pocketTable) {
                slot = new Slot(slot.inventory, slot.getSlotIndex(), slot.xPos, slot.yPos) {

                    @Override
                    public boolean canTakeStack(EntityPlayer playerIn) {
                        return false;
                    }
                };
            }
        }
    }
    return super.addSlotToContainer(slot);
}
Also used : InventoryPlayer(net.minecraft.entity.player.InventoryPlayer) SlotBlocked(pl.asie.charset.lib.ui.SlotBlocked) EntityPlayer(net.minecraft.entity.player.EntityPlayer)

Aggregations

EntityPlayer (net.minecraft.entity.player.EntityPlayer)1 InventoryPlayer (net.minecraft.entity.player.InventoryPlayer)1 SlotBlocked (pl.asie.charset.lib.ui.SlotBlocked)1