--- a/net/minecraft/world/inventory/TransientCraftingContainer.java
+++ b/net/minecraft/world/inventory/TransientCraftingContainer.java
@@ -1,18 +1,92 @@
 package net.minecraft.world.inventory;
 
+import java.util.Iterator;
 import java.util.List;
 import net.minecraft.core.NonNullList;
+import net.minecraft.world.Container;
 import net.minecraft.world.ContainerHelper;
 import net.minecraft.world.entity.player.Player;
 import net.minecraft.world.entity.player.StackedContents;
 import net.minecraft.world.item.ItemStack;
 
+// CraftBukkit start
+import java.util.List;
+import net.minecraft.world.item.crafting.RecipeHolder;
+import org.bukkit.Location;
+import org.bukkit.craftbukkit.entity.CraftHumanEntity;
+import org.bukkit.entity.HumanEntity;
+import org.bukkit.event.inventory.InventoryType;
+// CraftBukkit end
+
 public class TransientCraftingContainer implements CraftingContainer {
+
     private final NonNullList<ItemStack> items;
     private final int width;
     private final int height;
     private final AbstractContainerMenu menu;
 
+    // CraftBukkit start - add fields
+    public List<HumanEntity> transaction = new java.util.ArrayList<HumanEntity>();
+    private RecipeHolder<?> currentRecipe;
+    public Container resultInventory;
+    private Player owner;
+    private int maxStack = MAX_STACK;
+
+    public List<ItemStack> getContents() {
+        return this.items;
+    }
+
+    public void onOpen(CraftHumanEntity who) {
+        this.transaction.add(who);
+    }
+
+    public InventoryType getInvType() {
+        return this.items.size() == 4 ? InventoryType.CRAFTING : InventoryType.WORKBENCH;
+    }
+
+    public void onClose(CraftHumanEntity who) {
+        this.transaction.remove(who);
+    }
+
+    public List<HumanEntity> getViewers() {
+        return this.transaction;
+    }
+
+    public org.bukkit.inventory.InventoryHolder getOwner() {
+        return (this.owner == null) ? null : this.owner.getBukkitEntity();
+    }
+
+    @Override
+    public int getMaxStackSize() {
+        return this.maxStack;
+    }
+
+    public void setMaxStackSize(int size) {
+        this.maxStack = size;
+        this.resultInventory.setMaxStackSize(size);
+    }
+
+    @Override
+    public Location getLocation() {
+        return this.menu instanceof CraftingMenu ? ((CraftingMenu) this.menu).access.getLocation() : this.owner.getBukkitEntity().getLocation();
+    }
+
+    @Override
+    public RecipeHolder<?> getCurrentRecipe() {
+        return this.currentRecipe;
+    }
+
+    @Override
+    public void setCurrentRecipe(RecipeHolder<?> currentRecipe) {
+        this.currentRecipe = currentRecipe;
+    }
+
+    public TransientCraftingContainer(AbstractContainerMenu container, int i, int j, Player player) {
+        this(container, i, j);
+        this.owner = player;
+    }
+    // CraftBukkit end
+
     public TransientCraftingContainer(AbstractContainerMenu handler, int width, int height) {
         this(handler, width, height, NonNullList.withSize(width * height, ItemStack.EMPTY));
     }
@@ -31,18 +105,24 @@
 
     @Override
     public boolean isEmpty() {
-        for (ItemStack itemStack : this.items) {
-            if (!itemStack.isEmpty()) {
-                return false;
+        Iterator iterator = this.items.iterator();
+
+        ItemStack itemstack;
+
+        do {
+            if (!iterator.hasNext()) {
+                return true;
             }
-        }
 
-        return true;
+            itemstack = (ItemStack) iterator.next();
+        } while (itemstack.isEmpty());
+
+        return false;
     }
 
     @Override
     public ItemStack getItem(int slot) {
-        return slot >= this.getContainerSize() ? ItemStack.EMPTY : this.items.get(slot);
+        return slot >= this.getContainerSize() ? ItemStack.EMPTY : (ItemStack) this.items.get(slot);
     }
 
     @Override
@@ -52,12 +132,13 @@
 
     @Override
     public ItemStack removeItem(int slot, int amount) {
-        ItemStack itemStack = ContainerHelper.removeItem(this.items, slot, amount);
-        if (!itemStack.isEmpty()) {
+        ItemStack itemstack = ContainerHelper.removeItem(this.items, slot, amount);
+
+        if (!itemstack.isEmpty()) {
             this.menu.slotsChanged(this);
         }
 
-        return itemStack;
+        return itemstack;
     }
 
     @Override
@@ -67,8 +148,7 @@
     }
 
     @Override
-    public void setChanged() {
-    }
+    public void setChanged() {}
 
     @Override
     public boolean stillValid(Player player) {
@@ -97,8 +177,13 @@
 
     @Override
     public void fillStackedContents(StackedContents finder) {
-        for (ItemStack itemStack : this.items) {
-            finder.accountSimpleStack(itemStack);
+        Iterator iterator = this.items.iterator();
+
+        while (iterator.hasNext()) {
+            ItemStack itemstack = (ItemStack) iterator.next();
+
+            finder.accountSimpleStack(itemstack);
         }
+
     }
 }
