package iat.inventory;


import iat.entities.tile.TileEntityMatterConverter;
import iat.recipes.MatterConverterRecipes;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.ICrafting;
import net.minecraft.inventory.Slot;
import net.minecraft.inventory.SlotFurnace;
import net.minecraft.item.ItemStack;


import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

public class ContainerMatterConverter extends Container
{
    private TileEntityMatterConverter tileFurnace;
    private int lastCookTime;
    private int lastBurnTime;
    private int lastItemBurnTime;
    private static final String __OBFID = "CL_00001748";

    public ContainerMatterConverter(InventoryPlayer player, TileEntityMatterConverter tileEntity)
    {
        this.tileFurnace = tileEntity;
        this.addSlotToContainer(new Slot(tileEntity, 0, 56, 35));
        this.addSlotToContainer(new SlotFurnace(player.player, tileEntity, 2, 116, 35));
        int i;

        for (i = 0; i < 3; ++i)
        {
            for (int j = 0; j < 9; ++j)
            {
                this.addSlotToContainer(new Slot(player, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
            }
        }

        for (i = 0; i < 9; ++i)
        {
            this.addSlotToContainer(new Slot(player, i, 8 + i * 18, 142));
        }
    }

    public void addCraftingToCrafters(ICrafting crafter)
    {
        super.addCraftingToCrafters(crafter);
        crafter.sendProgressBarUpdate(this, 0, this.tileFurnace.furnaceCookTime);
        crafter.sendProgressBarUpdate(this, 1, this.tileFurnace.furnaceBurnTime);
        crafter.sendProgressBarUpdate(this, 2, this.tileFurnace.currentItemBurnTime);
    }

    /**
     * Looks for changes made in the container, sends them to every listener.
     */
    public void detectAndSendChanges()
    {
        super.detectAndSendChanges();

        for (int i = 0; i < this.crafters.size(); ++i)
        {
            ICrafting icrafting = (ICrafting)this.crafters.get(i);

            if (this.lastCookTime != this.tileFurnace.furnaceCookTime)
            {
                icrafting.sendProgressBarUpdate(this, 0, this.tileFurnace.furnaceCookTime);
            }

            if (this.lastBurnTime != this.tileFurnace.furnaceBurnTime)
            {
                icrafting.sendProgressBarUpdate(this, 1, this.tileFurnace.furnaceBurnTime);
            }

            if (this.lastItemBurnTime != this.tileFurnace.currentItemBurnTime)
            {
                icrafting.sendProgressBarUpdate(this, 2, this.tileFurnace.currentItemBurnTime);
            }
        }

        this.lastCookTime = this.tileFurnace.furnaceCookTime;
        this.lastBurnTime = this.tileFurnace.furnaceBurnTime;
        this.lastItemBurnTime = this.tileFurnace.currentItemBurnTime;
    }

    @SideOnly(Side.CLIENT)
    public void updateProgressBar(int var1, int var2)
    {
        if (var1 == 0)
        {
            this.tileFurnace.furnaceCookTime = var2;
        }

        if (var1 == 1)
        {
            this.tileFurnace.furnaceBurnTime = var2;
        }

        if (var1 == 2)
        {
            this.tileFurnace.currentItemBurnTime = var2;
        }
    }

    public boolean canInteractWith(EntityPlayer player)
    {
        return this.tileFurnace.isUseableByPlayer(player);
    }

    /**
     * Called when a player shift-clicks on a slot. You must override this or you will crash when someone does that.
     */
    public ItemStack transferStackInSlot(EntityPlayer player, int i)
    {
        ItemStack itemstack = null;
        Slot slot = (Slot)this.inventorySlots.get(i);

        if (slot != null && slot.getHasStack())
        {
            ItemStack itemstack1 = slot.getStack();
            itemstack = itemstack1.copy();

            if (i == 2)
            {
                if (!this.mergeItemStack(itemstack1, 3, 39, true))
                {
                    return null;
                }

                slot.onSlotChange(itemstack1, itemstack);
            }
            else if (i != 1)
            {
                if (MatterConverterRecipes.smelting().getSmeltingResult(itemstack1) != null)
                {
                    if (!this.mergeItemStack(itemstack1, 0, 1, false))
                    {
                        return null;
                    }
                }
                else if (TileEntityMatterConverter.isItemFuel(itemstack1))
                {
                    if (!this.mergeItemStack(itemstack1, 1, 2, false))
                    {
                        return null;
                    }
                }
                else if (i >= 3 && i < 30)
                {
                    if (!this.mergeItemStack(itemstack1, 30, 39, false))
                    {
                        return null;
                    }
                }
                else if (i >= 30 && i < 39 && !this.mergeItemStack(itemstack1, 3, 30, false))
                {
                    return null;
                }
            }
            else if (!this.mergeItemStack(itemstack1, 3, 39, false))
            {
                return null;
            }

            if (itemstack1.stackSize == 0)
            {
                slot.putStack((ItemStack)null);
            }
            else
            {
                slot.onSlotChanged();
            }

            if (itemstack1.stackSize == itemstack.stackSize)
            {
                return null;
            }

            slot.onPickupFromSlot(player, itemstack1);
        }

        return itemstack;
    }
}
@@ -3634,2037 +3634,37 @@
     
-    ItemStack itemstack = null;%0A        Slot slot = (Slot)this.inventorySlots.get(i);%0A%0A        if (slot != null && slot.getHasStack())%0A        %7B%0A            ItemStack itemstack1 = slot.getStack();%0A            itemstack = itemstack1.copy();%0A%0A            if (i == 2)%0A            %7B%0A                if (!this.mergeItemStack(itemstack1, 3, 39, true))%0A                %7B%0A                    return null;%0A                %7D%0A%0A                slot.onSlotChange(itemstack1, itemstack);%0A            %7D%0A            else if (i != 1)%0A            %7B%0A                if (MatterConverterRecipes.smelting().getSmeltingResult(itemstack1) != null)%0A                %7B%0A                    if (!this.mergeItemStack(itemstack1, 0, 1, false))%0A                    %7B%0A                        return null;%0A                    %7D%0A                %7D%0A                else if (TileEntityMatterConverter.isItemFuel(itemstack1))%0A                %7B%0A                    if (!this.mergeItemStack(itemstack1, 1, 2, false))%0A                    %7B%0A                        return null;%0A                    %7D%0A                %7D%0A                else if (i %3E= 3 && i %3C 30)%0A                %7B%0A                    if (!this.mergeItemStack(itemstack1, 30, 39, false))%0A                    %7B%0A                        return null;%0A                    %7D%0A                %7D%0A                else if (i %3E= 30 && i %3C 39 && !this.mergeItemStack(itemstack1, 3, 30, false))%0A                %7B%0A                    return null;%0A                %7D%0A            %7D%0A            else if (!this.mergeItemStack(itemstack1, 3, 39, false))%0A            %7B%0A                return null;%0A            %7D%0A%0A            if (itemstack1.stackSize == 0)%0A            %7B%0A                slot.putStack((ItemStack)null);%0A            %7D%0A            else%0A            %7B%0A                slot.onSlotChanged();%0A            %7D%0A%0A            if (itemstack1.stackSize == itemstack.stackSize)%0A            %7B%0A                return null;%0A            %7D%0A%0A            slot.onPickupFromSlot(player, itemstack1);%0A        %7D%0A%0A        return itemstack;%0A    %7D%0A%7D
+%09return (ItemStack)null;%0A    %7D%0A%7D%0A

Update ContainerMatterConverter.java