--- a/net/minecraft/world/inventory/CraftingContainer.java
+++ b/net/minecraft/world/inventory/CraftingContainer.java
@@ -1,18 +1,90 @@
 package net.minecraft.world.inventory;
 
+import java.util.Iterator;
 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;
+import net.minecraft.world.item.crafting.Recipe;
+// CraftBukkit start
+import java.util.List;
+import org.bukkit.Location;
+import org.bukkit.craftbukkit.v1_19_R1.entity.CraftHumanEntity;
+import org.bukkit.entity.HumanEntity;
+import org.bukkit.event.inventory.InventoryType;
+// CraftBukkit end
 
 public class CraftingContainer implements Container, StackedContentsCompatible {
+
     private final NonNullList<ItemStack> items;
     private final int width;
     private final int height;
     public final AbstractContainerMenu menu;
 
+    // CraftBukkit start - add fields
+    public List<HumanEntity> transaction = new java.util.ArrayList<HumanEntity>();
+    private Recipe 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 Recipe getCurrentRecipe() {
+        return this.currentRecipe;
+    }
+
+    @Override
+    public void setCurrentRecipe(Recipe currentRecipe) {
+        this.currentRecipe = currentRecipe;
+    }
+
+    public CraftingContainer(AbstractContainerMenu container, int i, int j, Player player) {
+        this(container, i, j);
+        this.owner = player;
+    }
+    // CraftBukkit end
+
     public CraftingContainer(AbstractContainerMenu handler, int width, int height) {
         this.items = NonNullList.withSize(width * height, ItemStack.EMPTY);
         this.menu = handler;
@@ -27,18 +99,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
@@ -48,12 +126,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
@@ -63,8 +142,7 @@
     }
 
     @Override
-    public void setChanged() {
-    }
+    public void setChanged() {}
 
     @Override
     public boolean stillValid(Player player) {
@@ -86,8 +164,12 @@
 
     @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);
         }
 
     }
