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

60 lines
2.1 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
2024-04-24 01:15:00 +10:00
@@ -15,6 +15,11 @@
import net.minecraft.world.item.alchemy.PotionContents;
2021-03-16 09:00:00 +11:00
import net.minecraft.world.item.alchemy.PotionRegistry;
+// CraftBukkit start
+import org.bukkit.craftbukkit.inventory.CraftInventoryBrewer;
+import org.bukkit.craftbukkit.inventory.view.CraftBrewingStandView;
+// 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;
2024-04-24 01:15:00 +10:00
@@ -31,12 +36,18 @@
2021-06-11 15:00:00 +10:00
private final IContainerProperties brewingStandData;
private final Slot ingredientSlot;
2015-02-26 22:41:06 +00:00
+ // CraftBukkit start
+ private CraftBrewingStandView 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
2021-11-22 09:00:00 +11:00
checkContainerSize(iinventory, 5);
checkContainerDataCount(icontainerproperties, 2);
this.brewingStand = iinventory;
2024-04-24 01:15:00 +10:00
@@ -66,6 +77,7 @@
2019-04-23 12:00:00 +10:00
@Override
2021-11-22 09:00:00 +11:00
public boolean stillValid(EntityHuman entityhuman) {
+ if (!this.checkReachable) return true; // CraftBukkit
2021-11-22 09:00:00 +11:00
return this.brewingStand.stillValid(entityhuman);
}
2024-04-24 01:15:00 +10:00
@@ -196,4 +208,17 @@
return itemstack.is(Items.BLAZE_POWDER);
2015-02-26 22:41:06 +00:00
}
}
2015-02-26 22:41:06 +00:00
+
+ // 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
}