--- a/net/minecraft/world/inventory/HopperMenu.java
+++ b/net/minecraft/world/inventory/HopperMenu.java
@@ -6,10 +6,32 @@
 import net.minecraft.world.entity.player.Player;
 import net.minecraft.world.item.ItemStack;
 
+// CraftBukkit start
+import org.bukkit.craftbukkit.v1_20_R2.inventory.CraftInventory;
+import org.bukkit.craftbukkit.v1_20_R2.inventory.CraftInventoryView;
+// CraftBukkit end
+
 public class HopperMenu extends AbstractContainerMenu {
+
     public static final int CONTAINER_SIZE = 5;
     private final Container hopper;
 
+    // CraftBukkit start
+    private CraftInventoryView bukkitEntity = null;
+    private Inventory player;
+
+    @Override
+    public CraftInventoryView getBukkitView() {
+        if (this.bukkitEntity != null) {
+            return this.bukkitEntity;
+        }
+
+        CraftInventory inventory = new CraftInventory(this.hopper);
+        this.bukkitEntity = new CraftInventoryView(this.player.player.getBukkitEntity(), inventory, this);
+        return this.bukkitEntity;
+    }
+    // CraftBukkit end
+
     public HopperMenu(int syncId, Inventory playerInventory) {
         this(syncId, playerInventory, new SimpleContainer(5));
     }
@@ -17,54 +39,60 @@
     public HopperMenu(int syncId, Inventory playerInventory, Container inventory) {
         super(MenuType.HOPPER, syncId);
         this.hopper = inventory;
+        this.player = playerInventory; // CraftBukkit - save player
         checkContainerSize(inventory, 5);
         inventory.startOpen(playerInventory.player);
-        int i = 51;
+        boolean flag = true;
 
-        for(int j = 0; j < 5; ++j) {
+        int j;
+
+        for (j = 0; j < 5; ++j) {
             this.addSlot(new Slot(inventory, j, 44 + j * 18, 20));
         }
 
-        for(int k = 0; k < 3; ++k) {
-            for(int l = 0; l < 9; ++l) {
-                this.addSlot(new Slot(playerInventory, l + k * 9 + 9, 8 + l * 18, k * 18 + 51));
+        for (j = 0; j < 3; ++j) {
+            for (int k = 0; k < 9; ++k) {
+                this.addSlot(new Slot(playerInventory, k + j * 9 + 9, 8 + k * 18, j * 18 + 51));
             }
         }
 
-        for(int m = 0; m < 9; ++m) {
-            this.addSlot(new Slot(playerInventory, m, 8 + m * 18, 109));
+        for (j = 0; j < 9; ++j) {
+            this.addSlot(new Slot(playerInventory, j, 8 + j * 18, 109));
         }
 
     }
 
     @Override
     public boolean stillValid(Player player) {
+        if (!this.checkReachable) return true; // CraftBukkit
         return this.hopper.stillValid(player);
     }
 
     @Override
     public ItemStack quickMoveStack(Player player, int slot) {
-        ItemStack itemStack = ItemStack.EMPTY;
-        Slot slot2 = this.slots.get(slot);
-        if (slot2 != null && slot2.hasItem()) {
-            ItemStack itemStack2 = slot2.getItem();
-            itemStack = itemStack2.copy();
+        ItemStack itemstack = ItemStack.EMPTY;
+        Slot slot1 = (Slot) this.slots.get(slot);
+
+        if (slot1 != null && slot1.hasItem()) {
+            ItemStack itemstack1 = slot1.getItem();
+
+            itemstack = itemstack1.copy();
             if (slot < this.hopper.getContainerSize()) {
-                if (!this.moveItemStackTo(itemStack2, this.hopper.getContainerSize(), this.slots.size(), true)) {
+                if (!this.moveItemStackTo(itemstack1, this.hopper.getContainerSize(), this.slots.size(), true)) {
                     return ItemStack.EMPTY;
                 }
-            } else if (!this.moveItemStackTo(itemStack2, 0, this.hopper.getContainerSize(), false)) {
+            } else if (!this.moveItemStackTo(itemstack1, 0, this.hopper.getContainerSize(), false)) {
                 return ItemStack.EMPTY;
             }
 
-            if (itemStack2.isEmpty()) {
-                slot2.setByPlayer(ItemStack.EMPTY);
+            if (itemstack1.isEmpty()) {
+                slot1.setByPlayer(ItemStack.EMPTY);
             } else {
-                slot2.setChanged();
+                slot1.setChanged();
             }
         }
 
-        return itemStack;
+        return itemstack;
     }
 
     @Override
