3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-20 21:40:06 +01:00
Paper/nms-patches/ContainerBrewingStand.patch
2019-04-23 12:00:00 +10:00

58 Zeilen
1.9 KiB
Diff

--- a/net/minecraft/server/ContainerBrewingStand.java
+++ b/net/minecraft/server/ContainerBrewingStand.java
@@ -1,17 +1,28 @@
package net.minecraft.server;
+// CraftBukkit start
+import org.bukkit.craftbukkit.inventory.CraftInventoryBrewer;
+import org.bukkit.craftbukkit.inventory.CraftInventoryView;
+// CraftBukkit end
+
public class ContainerBrewingStand extends Container {
private final IInventory brewingStand;
private final IContainerProperties d;
private final Slot e;
+ // CraftBukkit start
+ private CraftInventoryView bukkitEntity = null;
+ private PlayerInventory player;
+ // CraftBukkit end
+
public ContainerBrewingStand(int i, PlayerInventory playerinventory) {
this(i, playerinventory, new InventorySubcontainer(5), new ContainerProperties(2));
}
public ContainerBrewingStand(int i, PlayerInventory playerinventory, IInventory iinventory, IContainerProperties icontainerproperties) {
super(Containers.BREWING_STAND, i);
+ player = playerinventory; // CraftBukkit
a(iinventory, 5);
a(icontainerproperties, 2);
this.brewingStand = iinventory;
@@ -39,6 +50,7 @@
@Override
public boolean canUse(EntityHuman entityhuman) {
+ if (!this.checkReachable) return true; // CraftBukkit
return this.brewingStand.a(entityhuman);
}
@@ -171,4 +183,17 @@
return item == Items.POTION || item == Items.SPLASH_POTION || item == Items.LINGERING_POTION || item == Items.GLASS_BOTTLE;
}
}
+
+ // 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
}