--- a/net/minecraft/world/inventory/HorseInventoryMenu.java
+++ b/net/minecraft/world/inventory/HorseInventoryMenu.java
@@ -8,17 +8,40 @@
 import net.minecraft.world.item.ItemStack;
 import net.minecraft.world.item.Items;
 
+// CraftBukkit start
+import org.bukkit.craftbukkit.v1_20_R2.inventory.CraftInventoryView;
+import org.bukkit.inventory.InventoryView;
+// CraftBukkit end
+
 public class HorseInventoryMenu extends AbstractContainerMenu {
+
     private final Container horseContainer;
     private final AbstractHorse horse;
 
+    // CraftBukkit start
+    org.bukkit.craftbukkit.v1_20_R2.inventory.CraftInventoryView bukkitEntity;
+    Inventory player;
+
+    @Override
+    public InventoryView getBukkitView() {
+        if (this.bukkitEntity != null) {
+            return this.bukkitEntity;
+        }
+
+        return this.bukkitEntity = new CraftInventoryView(this.player.player.getBukkitEntity(), this.horseContainer.getOwner().getInventory(), this);
+    }
+
     public HorseInventoryMenu(int syncId, Inventory playerInventory, Container inventory, final AbstractHorse entity) {
-        super((MenuType<?>)null, syncId);
+        super((MenuType) null, syncId);
+        this.player = playerInventory;
+        // CraftBukkit end
         this.horseContainer = inventory;
         this.horse = entity;
-        int i = 3;
+        boolean flag = true;
+
         inventory.startOpen(playerInventory.player);
-        int j = -18;
+        boolean flag1 = true;
+
         this.addSlot(new Slot(inventory, 0, 8, 18) {
             @Override
             public boolean mayPlace(ItemStack stack) {
@@ -46,22 +69,25 @@
                 return 1;
             }
         });
+        int j;
+        int k;
+
         if (this.hasChest(entity)) {
-            for(int k = 0; k < 3; ++k) {
-                for(int l = 0; l < ((AbstractChestedHorse)entity).getInventoryColumns(); ++l) {
-                    this.addSlot(new Slot(inventory, 2 + l + k * ((AbstractChestedHorse)entity).getInventoryColumns(), 80 + l * 18, 18 + k * 18));
+            for (j = 0; j < 3; ++j) {
+                for (k = 0; k < ((AbstractChestedHorse) entity).getInventoryColumns(); ++k) {
+                    this.addSlot(new Slot(inventory, 2 + k + j * ((AbstractChestedHorse) entity).getInventoryColumns(), 80 + k * 18, 18 + j * 18));
                 }
             }
         }
 
-        for(int m = 0; m < 3; ++m) {
-            for(int n = 0; n < 9; ++n) {
-                this.addSlot(new Slot(playerInventory, n + m * 9 + 9, 8 + n * 18, 102 + m * 18 + -18));
+        for (j = 0; j < 3; ++j) {
+            for (k = 0; k < 9; ++k) {
+                this.addSlot(new Slot(playerInventory, k + j * 9 + 9, 8 + k * 18, 102 + j * 18 + -18));
             }
         }
 
-        for(int o = 0; o < 9; ++o) {
-            this.addSlot(new Slot(playerInventory, o, 8 + o * 18, 142));
+        for (j = 0; j < 9; ++j) {
+            this.addSlot(new Slot(playerInventory, j, 8 + j * 18, 142));
         }
 
     }
@@ -72,55 +98,59 @@
     }
 
     private boolean hasChest(AbstractHorse horse) {
-        return horse instanceof AbstractChestedHorse && ((AbstractChestedHorse)horse).hasChest();
+        return horse instanceof AbstractChestedHorse && ((AbstractChestedHorse) horse).hasChest();
     }
 
     @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();
-            int i = this.horseContainer.getContainerSize();
-            if (slot < i) {
-                if (!this.moveItemStackTo(itemStack2, i, this.slots.size(), true)) {
+        ItemStack itemstack = ItemStack.EMPTY;
+        Slot slot1 = (Slot) this.slots.get(slot);
+
+        if (slot1 != null && slot1.hasItem()) {
+            ItemStack itemstack1 = slot1.getItem();
+
+            itemstack = itemstack1.copy();
+            int j = this.horseContainer.getContainerSize();
+
+            if (slot < j) {
+                if (!this.moveItemStackTo(itemstack1, j, this.slots.size(), true)) {
                     return ItemStack.EMPTY;
                 }
-            } else if (this.getSlot(1).mayPlace(itemStack2) && !this.getSlot(1).hasItem()) {
-                if (!this.moveItemStackTo(itemStack2, 1, 2, false)) {
+            } else if (this.getSlot(1).mayPlace(itemstack1) && !this.getSlot(1).hasItem()) {
+                if (!this.moveItemStackTo(itemstack1, 1, 2, false)) {
                     return ItemStack.EMPTY;
                 }
-            } else if (this.getSlot(0).mayPlace(itemStack2)) {
-                if (!this.moveItemStackTo(itemStack2, 0, 1, false)) {
+            } else if (this.getSlot(0).mayPlace(itemstack1)) {
+                if (!this.moveItemStackTo(itemstack1, 0, 1, false)) {
                     return ItemStack.EMPTY;
                 }
-            } else if (i <= 2 || !this.moveItemStackTo(itemStack2, 2, i, false)) {
-                int k = i + 27;
-                int m = k + 9;
-                if (slot >= k && slot < m) {
-                    if (!this.moveItemStackTo(itemStack2, i, k, false)) {
+            } else if (j <= 2 || !this.moveItemStackTo(itemstack1, 2, j, false)) {
+                int k = j + 27;
+                int l = k + 9;
+
+                if (slot >= k && slot < l) {
+                    if (!this.moveItemStackTo(itemstack1, j, k, false)) {
                         return ItemStack.EMPTY;
                     }
-                } else if (slot >= i && slot < k) {
-                    if (!this.moveItemStackTo(itemStack2, k, m, false)) {
+                } else if (slot >= j && slot < k) {
+                    if (!this.moveItemStackTo(itemstack1, k, l, false)) {
                         return ItemStack.EMPTY;
                     }
-                } else if (!this.moveItemStackTo(itemStack2, k, k, false)) {
+                } else if (!this.moveItemStackTo(itemstack1, k, k, false)) {
                     return ItemStack.EMPTY;
                 }
 
                 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
