PaperMC/paper-server/nms-patches/net/minecraft/world/inventory/ContainerBrewingStand.patch
CraftBukkit/Spigot 8398e12b34 Update to Minecraft 1.20.3
By: md_5 <git@md-5.net>
2023-12-06 03:40:00 +11:00

59 lines
2 KiB
Diff

--- a/net/minecraft/world/inventory/ContainerBrewingStand.java
+++ b/net/minecraft/world/inventory/ContainerBrewingStand.java
@@ -13,6 +13,11 @@
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
+
public class ContainerBrewingStand extends Container {
private static final int BOTTLE_SLOT_START = 0;
@@ -29,12 +34,18 @@
private final IContainerProperties brewingStandData;
private final Slot ingredientSlot;
+ // 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
checkContainerSize(iinventory, 5);
checkContainerDataCount(icontainerproperties, 2);
this.brewingStand = iinventory;
@@ -62,6 +73,7 @@
@Override
public boolean stillValid(EntityHuman entityhuman) {
+ if (!this.checkReachable) return true; // CraftBukkit
return this.brewingStand.stillValid(entityhuman);
}
@@ -199,4 +211,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
}