aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-spigotflower-stripped/net/minecraft/world/inventory/BrewingStandMenu.java.patch
blob: 4e23e36b65da8ebe5f961a3d308a67faa03303fd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
--- a/net/minecraft/world/inventory/BrewingStandMenu.java
+++ b/net/minecraft/world/inventory/BrewingStandMenu.java
@@ -12,6 +12,10 @@
 import net.minecraft.world.item.alchemy.Potion;
 import net.minecraft.world.item.alchemy.PotionBrewing;
 import net.minecraft.world.item.alchemy.PotionUtils;
+// CraftBukkit start
+import org.bukkit.craftbukkit.inventory.CraftInventoryBrewer;
+import org.bukkit.craftbukkit.inventory.CraftInventoryView;
+// CraftBukkit end
 
 public class BrewingStandMenu extends AbstractContainerMenu {
 
@@ -29,22 +33,28 @@
     private final ContainerData brewingStandData;
     private final Slot ingredientSlot;
 
-    public BrewingStandMenu(int i, Inventory inventory) {
-        this(i, inventory, new SimpleContainer(5), new SimpleContainerData(2));
+    // CraftBukkit start
+    private CraftInventoryView bukkitEntity = null;
+    private Inventory player;
+    // CraftBukkit end
+
+    public BrewingStandMenu(int containerId, Inventory playerInventory) {
+        this(containerId, playerInventory, new SimpleContainer(5), new SimpleContainerData(2));
     }
 
-    public BrewingStandMenu(int i, Inventory inventory, Container container, ContainerData containerdata) {
-        super(MenuType.BREWING_STAND, i);
-        checkContainerSize(container, 5);
-        checkContainerDataCount(containerdata, 2);
-        this.brewingStand = container;
-        this.brewingStandData = containerdata;
-        this.addSlot(new BrewingStandMenu.PotionSlot(container, 0, 56, 51));
-        this.addSlot(new BrewingStandMenu.PotionSlot(container, 1, 79, 58));
-        this.addSlot(new BrewingStandMenu.PotionSlot(container, 2, 102, 51));
-        this.ingredientSlot = this.addSlot(new BrewingStandMenu.IngredientsSlot(container, 3, 79, 17));
-        this.addSlot(new BrewingStandMenu.FuelSlot(container, 4, 17, 17));
-        this.addDataSlots(containerdata);
+    public BrewingStandMenu(int containerId, Inventory playerInventory, Container brewingStandContainer, ContainerData brewingStandData) {
+        super(MenuType.BREWING_STAND, containerId);
+        player = playerInventory; // CraftBukkit
+        checkContainerSize(brewingStandContainer, 5);
+        checkContainerDataCount(brewingStandData, 2);
+        this.brewingStand = brewingStandContainer;
+        this.brewingStandData = brewingStandData;
+        this.addSlot(new BrewingStandMenu.PotionSlot(brewingStandContainer, 0, 56, 51));
+        this.addSlot(new BrewingStandMenu.PotionSlot(brewingStandContainer, 1, 79, 58));
+        this.addSlot(new BrewingStandMenu.PotionSlot(brewingStandContainer, 2, 102, 51));
+        this.ingredientSlot = this.addSlot(new BrewingStandMenu.IngredientsSlot(brewingStandContainer, 3, 79, 17));
+        this.addSlot(new BrewingStandMenu.FuelSlot(brewingStandContainer, 4, 17, 17));
+        this.addDataSlots(brewingStandData);
 
         int j;
 
@@ -63,6 +72,7 @@
     @Override
     @Override
     public boolean stillValid(Player player) {
+        if (!this.checkReachable) return true; // CraftBukkit
         return this.brewingStand.stillValid(player);
     }
 
@@ -208,4 +210,17 @@
             return 64;
         }
     }
+
+    // CraftBukkit start
+    @Override
+    public CraftInventoryView getBukkitView() {
+        if (bukkitEntity != null) {
+            return bukkitEntity;
+        }
+
+        CraftInventoryBrewer inventory = new CraftInventoryBrewer(this.brewingStand);
+        bukkitEntity = new CraftInventoryView(this.player.player.getBukkitEntity(), inventory, this);
+        return bukkitEntity;
+    }
+    // CraftBukkit end
 }