0
0
mirror of https://hub.spigotmc.org/stash/scm/spigot/craftbukkit.git synced 2024-11-25 04:36:13 +00:00
craftbukkit/nms-patches/net/minecraft/world/inventory/ContainerBrewingStand.patch
2024-10-23 02:15:00 +11:00

60 lines
2.1 KiB
Diff

--- a/net/minecraft/world/inventory/ContainerBrewingStand.java
+++ b/net/minecraft/world/inventory/ContainerBrewingStand.java
@@ -16,6 +16,11 @@
import net.minecraft.world.item.alchemy.PotionContents;
import net.minecraft.world.item.alchemy.PotionRegistry;
+// CraftBukkit start
+import org.bukkit.craftbukkit.inventory.CraftInventoryBrewer;
+import org.bukkit.craftbukkit.inventory.view.CraftBrewingStandView;
+// CraftBukkit end
+
public class ContainerBrewingStand extends Container {
private static final int BOTTLE_SLOT_START = 0;
@@ -32,12 +37,18 @@
private final IContainerProperties brewingStandData;
private final Slot ingredientSlot;
+ // CraftBukkit start
+ private CraftBrewingStandView 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;
@@ -55,6 +66,7 @@
@Override
public boolean stillValid(EntityHuman entityhuman) {
+ if (!this.checkReachable) return true; // CraftBukkit
return this.brewingStand.stillValid(entityhuman);
}
@@ -185,4 +197,17 @@
return itemstack.is(TagsItem.BREWING_FUEL);
}
}
+
+ // CraftBukkit start
+ @Override
+ public CraftBrewingStandView getBukkitView() {
+ if (bukkitEntity != null) {
+ return bukkitEntity;
+ }
+
+ CraftInventoryBrewer inventory = new CraftInventoryBrewer(this.brewingStand);
+ bukkitEntity = new CraftBrewingStandView(this.player.player.getBukkitEntity(), inventory, this);
+ return bukkitEntity;
+ }
+ // CraftBukkit end
}