--- a/net/minecraft/world/inventory/BrewingStandMenu.java +++ b/net/minecraft/world/inventory/BrewingStandMenu.java @@ -12,6 +12,10 @@ import net.minecraft.world.item.alchemy.Potion; import net.minecraft.world.item.alchemy.PotionBrewing; import net.minecraft.world.item.alchemy.PotionUtils; +// CraftBukkit start +import org.bukkit.craftbukkit.inventory.CraftInventoryBrewer; +import org.bukkit.craftbukkit.inventory.CraftInventoryView; +// CraftBukkit end public class BrewingStandMenu extends AbstractContainerMenu { @@ -29,22 +33,28 @@ private final ContainerData brewingStandData; private final Slot ingredientSlot; - public BrewingStandMenu(int i, Inventory inventory) { - this(i, inventory, new SimpleContainer(5), new SimpleContainerData(2)); + // CraftBukkit start + private CraftInventoryView bukkitEntity = null; + private Inventory player; + // CraftBukkit end + + public BrewingStandMenu(int containerId, Inventory playerInventory) { + this(containerId, playerInventory, new SimpleContainer(5), new SimpleContainerData(2)); } - public BrewingStandMenu(int i, Inventory inventory, Container container, ContainerData containerdata) { - super(MenuType.BREWING_STAND, i); - checkContainerSize(container, 5); - checkContainerDataCount(containerdata, 2); - this.brewingStand = container; - this.brewingStandData = containerdata; - this.addSlot(new BrewingStandMenu.PotionSlot(container, 0, 56, 51)); - this.addSlot(new BrewingStandMenu.PotionSlot(container, 1, 79, 58)); - this.addSlot(new BrewingStandMenu.PotionSlot(container, 2, 102, 51)); - this.ingredientSlot = this.addSlot(new BrewingStandMenu.IngredientsSlot(container, 3, 79, 17)); - this.addSlot(new BrewingStandMenu.FuelSlot(container, 4, 17, 17)); - this.addDataSlots(containerdata); + public BrewingStandMenu(int containerId, Inventory playerInventory, Container brewingStandContainer, ContainerData brewingStandData) { + super(MenuType.BREWING_STAND, containerId); + player = playerInventory; // CraftBukkit + checkContainerSize(brewingStandContainer, 5); + checkContainerDataCount(brewingStandData, 2); + this.brewingStand = brewingStandContainer; + this.brewingStandData = brewingStandData; + this.addSlot(new BrewingStandMenu.PotionSlot(brewingStandContainer, 0, 56, 51)); + this.addSlot(new BrewingStandMenu.PotionSlot(brewingStandContainer, 1, 79, 58)); + this.addSlot(new BrewingStandMenu.PotionSlot(brewingStandContainer, 2, 102, 51)); + this.ingredientSlot = this.addSlot(new BrewingStandMenu.IngredientsSlot(brewingStandContainer, 3, 79, 17)); + this.addSlot(new BrewingStandMenu.FuelSlot(brewingStandContainer, 4, 17, 17)); + this.addDataSlots(brewingStandData); int j; @@ -63,6 +72,7 @@ @Override @Override public boolean stillValid(Player player) { + if (!this.checkReachable) return true; // CraftBukkit return this.brewingStand.stillValid(player); } @@ -208,4 +210,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 }