3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-24 15:20:11 +01:00
Paper/nms-patches/ContainerBrewingStand.patch

58 Zeilen
1.9 KiB
Diff

2015-05-25 12:37:24 +02:00
--- a/net/minecraft/server/ContainerBrewingStand.java
+++ b/net/minecraft/server/ContainerBrewingStand.java
2019-04-23 04:00:00 +02:00
@@ -1,17 +1,28 @@
package net.minecraft.server;
+// CraftBukkit start
+import org.bukkit.craftbukkit.inventory.CraftInventoryBrewer;
+import org.bukkit.craftbukkit.inventory.CraftInventoryView;
+// CraftBukkit end
2016-11-17 02:41:03 +01:00
+
public class ContainerBrewingStand extends Container {
2016-11-17 02:41:03 +01:00
private final IInventory brewingStand;
2019-04-23 04:00:00 +02:00
private final IContainerProperties d;
private final Slot e;
2015-02-26 23:41:06 +01:00
+ // CraftBukkit start
+ private CraftInventoryView bukkitEntity = null;
+ private PlayerInventory player;
+ // CraftBukkit end
2015-02-26 23:41:06 +01:00
+
2019-04-23 04:00:00 +02:00
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
2019-04-23 04:00:00 +02:00
a(iinventory, 5);
a(icontainerproperties, 2);
this.brewingStand = iinventory;
2019-04-23 04:00:00 +02:00
@@ -39,6 +50,7 @@
2019-04-23 04:00:00 +02:00
@Override
2017-09-18 12:00:00 +02:00
public boolean canUse(EntityHuman entityhuman) {
+ if (!this.checkReachable) return true; // CraftBukkit
return this.brewingStand.a(entityhuman);
}
2019-04-23 04:00:00 +02:00
@@ -171,4 +183,17 @@
2016-11-17 02:41:03 +01:00
return item == Items.POTION || item == Items.SPLASH_POTION || item == Items.LINGERING_POTION || item == Items.GLASS_BOTTLE;
2015-02-26 23:41:06 +01:00
}
}
2015-02-26 23:41:06 +01:00
+
+ // 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
}