package net.blay09.mods.craftingcraft.container;

import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.ItemStack;

public class InventoryIntegratedCrafting extends InventoryCrafting {

    private final InventoryPlayer inventoryPlayer;

    public InventoryIntegratedCrafting(Container container, InventoryPlayer inventoryPlayer) {
        super(container, 3, 3);
        this.inventoryPlayer = inventoryPlayer;
    }

    @Override
    public ItemStack getStackInSlot(int i) {
        return inventoryPlayer.getStackInSlot(getInventorySlot(i));
    }

    @Override
    public ItemStack getStackInSlotOnClosing(int i) {
        return getStackInSlot(i);
    }

    @Override
    public ItemStack decrStackSize(int i, int count) {
        ItemStack oldStack = inventoryPlayer.getStackInSlot(getInventorySlot(i));
        ItemStack itemStack = oldStack;
        if (itemStack != null) {
            if (itemStack.stackSize <= count) {
                inventoryPlayer.setInventorySlotContents(getInventorySlot(i), null);
                return itemStack;
            } else {
                itemStack = itemStack.splitStack(count);
                if (oldStack.stackSize == 0) {
                    inventoryPlayer.setInventorySlotContents(getInventorySlot(i), null);
                }
                return itemStack;
            }
        } else {
            return null;
        }
    }

    @Override
    public void setInventorySlotContents(int i, ItemStack itemStack) {
        inventoryPlayer.setInventorySlotContents(getInventorySlot(i), itemStack);
    }

    public int getInventorySlot(int i) {
        if (i < 3) {
            return 6 + i + 9;
        } else if (i < 6) {
            return 15 + i - 3 + 9;
        } else if (i < 9) {
            return 24 + i - 6 + 9;
        }
        return 0;
    }
}

@@ -295,16 +295,58 @@
 ting %7B%0A%0A
+    private final Container eventHandler;%0A
     priv
@@ -438,23 +438,26 @@
 ntainer 
-contain
+eventHandl
 er, Inve
@@ -505,24 +505,69 @@
 per(
-container, 3, 3)
+eventHandler, 3, 3);%0A        this.eventHandler = eventHandler
 ;%0A  
@@ -1211,32 +1211,89 @@
 Slot(i), null);%0A
+                eventHandler.onCraftMatrixChanged(this);%0A
                 
@@ -1534,32 +1534,89 @@
               %7D%0A
+                eventHandler.onCraftMatrixChanged(this);%0A
                 
@@ -1873,16 +1873,65 @@
 Stack);%0A
+        eventHandler.onCraftMatrixChanged(this);%0A
     %7D%0A%0A 

Fix Inventory Crafting Table