aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-spigotflower-stripped/net/minecraft/world/inventory/GrindstoneMenu.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-spigotflower-stripped/net/minecraft/world/inventory/GrindstoneMenu.java.patch')
-rw-r--r--patch-remap/mache-spigotflower-stripped/net/minecraft/world/inventory/GrindstoneMenu.java.patch109
1 files changed, 109 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower-stripped/net/minecraft/world/inventory/GrindstoneMenu.java.patch b/patch-remap/mache-spigotflower-stripped/net/minecraft/world/inventory/GrindstoneMenu.java.patch
new file mode 100644
index 0000000000..9729875c6d
--- /dev/null
+++ b/patch-remap/mache-spigotflower-stripped/net/minecraft/world/inventory/GrindstoneMenu.java.patch
@@ -0,0 +1,109 @@
+--- a/net/minecraft/world/inventory/GrindstoneMenu.java
++++ b/net/minecraft/world/inventory/GrindstoneMenu.java
+@@ -18,9 +17,30 @@
+ import net.minecraft.world.level.Level;
+ import net.minecraft.world.level.block.Blocks;
+ import net.minecraft.world.phys.Vec3;
++// CraftBukkit start
++import org.bukkit.Location;
++import org.bukkit.craftbukkit.inventory.CraftInventoryGrindstone;
++import org.bukkit.craftbukkit.inventory.CraftInventoryView;
++import org.bukkit.entity.Player;
++// CraftBukkit end
+
+ public class GrindstoneMenu extends AbstractContainerMenu {
+
++ // CraftBukkit start
++ private CraftInventoryView bukkitEntity = null;
++ private Player player;
++
++ @Override
++ public CraftInventoryView getBukkitView() {
++ if (bukkitEntity != null) {
++ return bukkitEntity;
++ }
++
++ CraftInventoryGrindstone inventory = new CraftInventoryGrindstone(this.repairSlots, this.resultSlots);
++ bukkitEntity = new CraftInventoryView(this.player, inventory, this);
++ return bukkitEntity;
++ }
++ // CraftBukkit end
+ public static final int MAX_NAME_LENGTH = 35;
+ public static final int INPUT_SLOT = 0;
+ public static final int ADDITIONAL_SLOT = 1;
+@@ -47,6 +66,13 @@
+ super.setChanged();
+ GrindstoneMenu.this.slotsChanged(this);
+ }
++
++ // CraftBukkit start
++ @Override
++ public Location getLocation() {
++ return access.getLocation();
++ }
++ // CraftBukkit end
+ };
+ this.access = containerlevelaccess;
+ this.addSlot(new Slot(this.repairSlots, 0, 49, 19) {
+@@ -129,6 +151,7 @@
+ this.addSlot(new Slot(inventory, j, 8 + j * 18, 142));
+ }
+
++ player = (Player) playerInventory.player.getBukkitEntity(); // CraftBukkit
+ }
+
+ @Override
+@@ -151,7 +173,7 @@
+ boolean flag2 = !itemstack.isEmpty() && !itemstack.is(Items.ENCHANTED_BOOK) && !itemstack.isEnchanted() || !itemstack1.isEmpty() && !itemstack1.is(Items.ENCHANTED_BOOK) && !itemstack1.isEnchanted();
+
+ if (itemstack.getCount() > 1 || itemstack1.getCount() > 1 || !flag1 && flag2) {
+- this.resultSlots.setItem(0, ItemStack.EMPTY);
++ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareGrindstoneEvent(getBukkitView(), ItemStack.EMPTY); // CraftBukkit
+ this.broadcastChanges();
+ return;
+ }
+@@ -162,7 +184,7 @@
+
+ if (flag1) {
+ if (!itemstack.is(itemstack1.getItem())) {
+- this.resultSlots.setItem(0, ItemStack.EMPTY);
++ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareGrindstoneEvent(getBukkitView(), ItemStack.EMPTY); // CraftBukkit
+ this.broadcastChanges();
+ return;
+ }
+@@ -176,7 +198,7 @@
+ itemstack2 = this.mergeEnchants(itemstack, itemstack1);
+ if (!itemstack2.isDamageableItem()) {
+ if (!ItemStack.matches(itemstack, itemstack1)) {
+- this.resultSlots.setItem(0, ItemStack.EMPTY);
++ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareGrindstoneEvent(getBukkitView(), ItemStack.EMPTY); // CraftBukkit
+ this.broadcastChanges();
+ return;
+ }
+@@ -189,12 +211,12 @@
+ i = flag3 ? itemstack.getDamageValue() : itemstack1.getDamageValue();
+ itemstack2 = flag3 ? itemstack : itemstack1;
+ }
+-
+- this.resultSlots.setItem(0, this.removeNonCurses(itemstack2, i, b0));
++ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareGrindstoneEvent(getBukkitView(), this.removeNonCurses(itemstack2, i, b0)); // CraftBukkit
+ } else {
+- this.resultSlots.setItem(0, ItemStack.EMPTY);
++ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareGrindstoneEvent(getBukkitView(), ItemStack.EMPTY); // CraftBukkit
+ }
+
++ sendAllDataToRemote(); // CraftBukkit - SPIGOT-6686: Always send completed inventory to stay in sync with client
+ this.broadcastChanges();
+ }
+
+@@ -256,8 +277,8 @@
+ }
+
+ @Override
+- @Override
+- public boolean stillValid(Player player) {
++ public boolean stillValid(net.minecraft.world.entity.player.Player player) {
++ if (!this.checkReachable) return true; // CraftBukkit
+ return stillValid(this.access, player, Blocks.GRINDSTONE);
+ }
+