aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-spigotflower/net/minecraft/world/inventory/BrewingStandMenu.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-spigotflower/net/minecraft/world/inventory/BrewingStandMenu.java.patch')
-rw-r--r--patch-remap/mache-spigotflower/net/minecraft/world/inventory/BrewingStandMenu.java.patch220
1 files changed, 220 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower/net/minecraft/world/inventory/BrewingStandMenu.java.patch b/patch-remap/mache-spigotflower/net/minecraft/world/inventory/BrewingStandMenu.java.patch
new file mode 100644
index 0000000000..9f079153d1
--- /dev/null
+++ b/patch-remap/mache-spigotflower/net/minecraft/world/inventory/BrewingStandMenu.java.patch
@@ -0,0 +1,220 @@
+--- 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,54 +33,59 @@
+ 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;
+
+ for (j = 0; j < 3; ++j) {
+ for (int k = 0; k < 9; ++k) {
+- this.addSlot(new Slot(inventory, k + j * 9 + 9, 8 + k * 18, 84 + j * 18));
++ this.addSlot(new Slot(playerInventory, k + j * 9 + 9, 8 + k * 18, 84 + j * 18));
+ }
+ }
+
+ for (j = 0; j < 9; ++j) {
+- this.addSlot(new Slot(inventory, j, 8 + j * 18, 142));
++ this.addSlot(new Slot(playerInventory, j, 8 + j * 18, 142));
+ }
+
+ }
+
+ @Override
+- @Override
+ public boolean stillValid(Player player) {
++ if (!this.checkReachable) return true; // CraftBukkit
+ return this.brewingStand.stillValid(player);
+ }
+
+ @Override
+- @Override
+- public ItemStack quickMoveStack(Player player, int i) {
++ public ItemStack quickMoveStack(Player player, int index) {
+ ItemStack itemstack = ItemStack.EMPTY;
+- Slot slot = (Slot) this.slots.get(i);
++ Slot slot = (Slot) this.slots.get(index);
+
+ if (slot != null && slot.hasItem()) {
+ ItemStack itemstack1 = slot.getItem();
+
+ itemstack = itemstack1.copy();
+- if ((i < 0 || i > 2) && i != 3 && i != 4) {
++ if ((index < 0 || index > 2) && index != 3 && index != 4) {
+ if (BrewingStandMenu.FuelSlot.mayPlaceItem(itemstack)) {
+ if (this.moveItemStackTo(itemstack1, 4, 5, false) || this.ingredientSlot.mayPlace(itemstack1) && !this.moveItemStackTo(itemstack1, 3, 4, false)) {
+ return ItemStack.EMPTY;
+@@ -89,11 +98,11 @@
+ if (!this.moveItemStackTo(itemstack1, 0, 3, false)) {
+ return ItemStack.EMPTY;
+ }
+- } else if (i >= 5 && i < 32) {
++ } else if (index >= 5 && index < 32) {
+ if (!this.moveItemStackTo(itemstack1, 32, 41, false)) {
+ return ItemStack.EMPTY;
+ }
+- } else if (i >= 32 && i < 41) {
++ } else if (index >= 32 && index < 41) {
+ if (!this.moveItemStackTo(itemstack1, 5, 32, false)) {
+ return ItemStack.EMPTY;
+ }
+@@ -134,53 +143,48 @@
+
+ private static class PotionSlot extends Slot {
+
+- public PotionSlot(Container container, int i, int j, int k) {
+- super(container, i, j, k);
++ public PotionSlot(Container container, int slot, int x, int y) {
++ super(container, slot, x, y);
+ }
+
+ @Override
+- @Override
+- public boolean mayPlace(ItemStack itemstack) {
+- return mayPlaceItem(itemstack);
++ public boolean mayPlace(ItemStack stack) {
++ return mayPlaceItem(stack);
+ }
+
+ @Override
+- @Override
+ public int getMaxStackSize() {
+ return 1;
+ }
+
+ @Override
+- @Override
+- public void onTake(Player player, ItemStack itemstack) {
+- Potion potion = PotionUtils.getPotion(itemstack);
++ public void onTake(Player player, ItemStack stack) {
++ Potion potionregistry = PotionUtils.getPotion(stack);
+
+ if (player instanceof ServerPlayer) {
+- CriteriaTriggers.BREWED_POTION.trigger((ServerPlayer) player, (Holder) potion.builtInRegistryHolder());
++ CriteriaTriggers.BREWED_POTION.trigger((ServerPlayer) player, (Holder) potionregistry.builtInRegistryHolder());
+ }
+
+- super.onTake(player, itemstack);
++ super.onTake(player, stack);
+ }
+
+- public static boolean mayPlaceItem(ItemStack itemstack) {
+- return itemstack.is(Items.POTION) || itemstack.is(Items.SPLASH_POTION) || itemstack.is(Items.LINGERING_POTION) || itemstack.is(Items.GLASS_BOTTLE);
++ public static boolean mayPlaceItem(ItemStack stack) {
++ return stack.is(Items.POTION) || stack.is(Items.SPLASH_POTION) || stack.is(Items.LINGERING_POTION) || stack.is(Items.GLASS_BOTTLE);
+ }
+ }
+
+ private static class IngredientsSlot extends Slot {
+
+- public IngredientsSlot(Container container, int i, int j, int k) {
+- super(container, i, j, k);
++ public IngredientsSlot(Container container, int slot, int x, int y) {
++ super(container, slot, x, y);
+ }
+
+ @Override
+- @Override
+- public boolean mayPlace(ItemStack itemstack) {
+- return PotionBrewing.isIngredient(itemstack);
++ public boolean mayPlace(ItemStack stack) {
++ return PotionBrewing.isIngredient(stack);
+ }
+
+ @Override
+- @Override
+ public int getMaxStackSize() {
+ return 64;
+ }
+@@ -188,24 +192,35 @@
+
+ private static class FuelSlot extends Slot {
+
+- public FuelSlot(Container container, int i, int j, int k) {
+- super(container, i, j, k);
++ public FuelSlot(Container container, int slot, int x, int y) {
++ super(container, slot, x, y);
+ }
+
+ @Override
+- @Override
+- public boolean mayPlace(ItemStack itemstack) {
+- return mayPlaceItem(itemstack);
++ public boolean mayPlace(ItemStack stack) {
++ return mayPlaceItem(stack);
+ }
+
+- public static boolean mayPlaceItem(ItemStack itemstack) {
+- return itemstack.is(Items.BLAZE_POWDER);
++ public static boolean mayPlaceItem(ItemStack itemStack) {
++ return itemStack.is(Items.BLAZE_POWDER);
+ }
+
+ @Override
+- @Override
+ public int getMaxStackSize() {
+ 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
+ }