@Override
 public CraftItemStack getItem(int index) {
   if (index == 0) {
     if (this.result.getItem(index) != null) {
       return CraftItemStack.asCraftMirror(this.result.getItem(index));
     }
     return CraftItemStack.asCraftCopy(new ItemStack(0, 1, (short) 0));
   } else if (this.inventory.getItem(index - this.result.getSize()) != null) {
     return CraftItemStack.asCraftMirror(this.inventory.getItem(index - this.result.getSize()));
   }
   return CraftItemStack.asCraftCopy(new ItemStack(0, 1, (short) 0));
 }
 @Override
 public void setItem(int index, ItemStack item) {
   if (item != null && item.getTypeId() == 0) {
     item = null;
   }
   if (index == 0) {
     this.result.setItem(index, (item == null ? null : CraftItemStack.asNMSCopy(item)));
   } else {
     this.inventory.setItem(
         (index - this.result.getSize()), (item == null ? null : CraftItemStack.asNMSCopy(item)));
   }
 }
  @Override
  public CraftItemStack[] getContents() {
    CraftItemStack[] items = new CraftItemStack[getSize()];
    net.minecraft.server.v1_6_R3.ItemStack[] mcResultItems = this.result.getContents();

    int i = 0;
    for (i = 0; i < mcResultItems.length; i++) {
      items[i] = CraftItemStack.asCraftMirror(mcResultItems[i]);
    }

    net.minecraft.server.v1_6_R3.ItemStack[] mcItems = this.inventory.getContents();

    for (int j = 0; j < mcItems.length; j++) {
      items[i + j] = CraftItemStack.asCraftMirror(mcItems[j]);
    }

    return items;
  }
 @Override
 public void setResult(ItemStack item) {
   net.minecraft.server.v1_6_R3.ItemStack[] contents = this.result.getContents();
   if (item == null || item.getTypeId() <= 0) {
     contents[0] = null;
   } else {
     contents[0] = CraftItemStack.asNMSCopy(item);
   }
 }
  @Override
  public CraftItemStack[] getMatrix() {
    CraftItemStack[] items = new CraftItemStack[getSize()];
    // net.minecraft.server.ItemStack[] matrix = this.inventory.getContents();

    for (int i = 0; i < getSize(); i++) {
      items[i] = CraftItemStack.asCraftMirror(this.inventory.getItem(i));
    }

    return items;
  }
  @Override
  public void setMatrix(ItemStack[] contents) {
    if (this.inventory.getContents().length != contents.length) {
      throw new IllegalArgumentException(
          "Invalid inventory size; expected " + this.inventory.getContents().length);
    }

    net.minecraft.server.v1_6_R3.ItemStack[] mcItems = this.inventory.getContents();

    for (int i = 0; i < contents.length; i++) {
      ItemStack item = contents[i];
      if (item == null || item.getTypeId() <= 0) {
        mcItems[i] = null;
      } else {
        mcItems[i] = CraftItemStack.asNMSCopy(item);
      }
    }
  }
 @Override
 public CraftItemStack getResult() {
   net.minecraft.server.v1_6_R3.ItemStack item = this.result.getItem(0);
   return CraftItemStack.asCraftMirror(item);
 }