package crazypants.util;

import codechicken.lib.inventory.InventoryUtils;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;

public class ShadowInventory implements IInventory {
  private final ItemStack[] items;
  private final IInventory master;

  public ShadowInventory(IInventory master) {
    this.master = master;
    items = new ItemStack[master.getSizeInventory()];
    for (int i = 0; i < master.getSizeInventory(); i++) {
      items[i] = master.getStackInSlot(i);
    }
  }

  @Override
  public int getSizeInventory() {
    return master.getSizeInventory();
  }

  @Override
  public ItemStack getStackInSlot(int p_70301_1_) {
    return items[p_70301_1_];
  }

  @Override
  public ItemStack decrStackSize(int p_70298_1_, int p_70298_2_) {
    return InventoryUtils.decrStackSize(this, p_70298_1_, p_70298_2_);
  }

  @Override
  public ItemStack getStackInSlotOnClosing(int p_70304_1_) {
    return InventoryUtils.getStackInSlotOnClosing(this, p_70304_1_);
  }

  @Override
  public void setInventorySlotContents(int p_70299_1_, ItemStack p_70299_2_) {
    items[p_70299_1_] = p_70299_2_;
  }

  @Override
  public String getInventoryName() {
    return master.getInventoryName();
  }

  @Override
  public boolean hasCustomInventoryName() {
    return master.hasCustomInventoryName();
  }

  @Override
  public int getInventoryStackLimit() {
    return master.getInventoryStackLimit();
  }

  @Override
  public void markDirty() {
  }

  @Override
  public boolean isUseableByPlayer(EntityPlayer p_70300_1_) {
    return master.isUseableByPlayer(p_70300_1_);
  }

  @Override
  public void openInventory() {
    master.openInventory();
  }

  @Override
  public void closeInventory() {
    master.closeInventory();
  }

  @Override
  public boolean isItemValidForSlot(int p_94041_1_, ItemStack p_94041_2_) {
    return master.isItemValidForSlot(p_94041_1_, p_94041_2_);
  }

}

@@ -32,47 +32,41 @@
 t co
-dechicken.lib.inventory.Inventory
+m.enderio.core.common.util.
 Util
-s
 ;
+%0A
 %0Aimp
@@ -832,30 +832,20 @@
  return 
-Inventory
 Util
-s
 .decrSta
@@ -968,71 +968,118 @@
     
-return InventoryUtils.getStackInSlotOnClosing(this, p_70304_1_)
+ItemStack stack = getStackInSlot(p_70304_1_);%0A    setInventorySlotContents(p_70304_1_, null);%0A    return stack
 ;%0A  

Use our Utils, not CCC's