craftbukkit/nms-patches/net/minecraft/world/inventory/ContainerBrewingStand.patch

60 lines
2 KiB
Diff
Raw Normal View History

2021-03-16 09:00:00 +11:00
--- a/net/minecraft/world/inventory/ContainerBrewingStand.java
+++ b/net/minecraft/world/inventory/ContainerBrewingStand.java
2021-06-11 15:00:00 +10:00
@@ -12,6 +12,11 @@
2021-03-16 09:00:00 +11:00
import net.minecraft.world.item.alchemy.PotionRegistry;
import net.minecraft.world.item.alchemy.PotionUtil;
+// CraftBukkit start
+import org.bukkit.craftbukkit.inventory.CraftInventoryBrewer;
+import org.bukkit.craftbukkit.inventory.CraftInventoryView;
+// CraftBukkit end
2016-11-17 12:41:03 +11:00
+
public class ContainerBrewingStand extends Container {
2021-06-11 15:00:00 +10:00
private static final int BOTTLE_SLOT_START = 0;
@@ -28,12 +33,18 @@
private final IContainerProperties brewingStandData;
private final Slot ingredientSlot;
2015-02-26 22:41:06 +00:00
+ // CraftBukkit start
+ private CraftInventoryView bukkitEntity = null;
+ private PlayerInventory player;
+ // CraftBukkit end
2015-02-26 22:41:06 +00:00
+
2019-04-23 12:00:00 +10: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 12:00:00 +10:00
a(iinventory, 5);
a(icontainerproperties, 2);
this.brewingStand = iinventory;
2021-06-11 15:00:00 +10:00
@@ -61,6 +72,7 @@
2019-04-23 12:00:00 +10:00
@Override
2017-09-18 20:00:00 +10:00
public boolean canUse(EntityHuman entityhuman) {
+ if (!this.checkReachable) return true; // CraftBukkit
return this.brewingStand.a(entityhuman);
}
2021-06-11 15:00:00 +10:00
@@ -198,4 +210,17 @@
return 64;
2015-02-26 22:41:06 +00:00
}
}
2015-02-26 22:41:06 +00: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
}