summaryrefslogtreecommitdiff
path: root/java/darkknight/jewelrycraft/container/ContainerJewelryTab.java
blob: e33976a76177bd04faafc3ab71c1873151182ad9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package darkknight.jewelrycraft.container;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import darkknight.jewelrycraft.JewelrycraftMod;

public class ContainerJewelryTab extends Container
{
    public ContainerJewelryTab(EntityPlayer player, InventoryPlayer inv)
    {
        int x, y;
        // Rings
        for (x = 0; x <= 9; x++)
            this.addSlotToContainer(new SlotRing(new JewelryInventory(), x, 8 + x * 18, 7));

        // Hotbar
        for (x = 0; x < 9; ++x)
            this.addSlotToContainer(new Slot(inv, x, 17 + x * 18, 142));
        
        // Inventory
        for (x = 0; x < 3; ++x)
            for (y = 0; y < 9; ++y)
                this.addSlotToContainer(new Slot(inv, 9 + y + x * 9, 17 + y * 18, 84 + x * 18));
        
    }
    
    @Override
    public boolean canInteractWith(EntityPlayer player)
    {
        return true;
    }
    
    @Override
    public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2)
    {
        ItemStack itemstack = null;
        Slot slot = (Slot) this.inventorySlots.get(par2);
        
//        if (slot != null && slot.getHasStack())
//        {
//            ItemStack itemstack1 = slot.getStack();
//            itemstack = itemstack1.copy();
//            
//            if (par2 < 27)
//            {
//                if (!this.mergeItemStack(itemstack1, 27, this.inventorySlots.size(), true)) { return null; }
//            }
//            else if (!this.mergeItemStack(itemstack1, 0, 27, false)) { return null; }
//            
//            if (itemstack1.stackSize == 0)
//            {
//                slot.putStack((ItemStack) null);
//            }
//            else
//            {
//                slot.onSlotChanged();
//            }
//        }
//        
        return itemstack;
    }
}