aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-vineflower-stripped/net/minecraft/world/inventory/StonecutterMenu.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-vineflower-stripped/net/minecraft/world/inventory/StonecutterMenu.java.patch')
-rw-r--r--patch-remap/mache-vineflower-stripped/net/minecraft/world/inventory/StonecutterMenu.java.patch97
1 files changed, 97 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower-stripped/net/minecraft/world/inventory/StonecutterMenu.java.patch b/patch-remap/mache-vineflower-stripped/net/minecraft/world/inventory/StonecutterMenu.java.patch
new file mode 100644
index 0000000000..8e7c6ff799
--- /dev/null
+++ b/patch-remap/mache-vineflower-stripped/net/minecraft/world/inventory/StonecutterMenu.java.patch
@@ -0,0 +1,97 @@
+--- a/net/minecraft/world/inventory/StonecutterMenu.java
++++ b/net/minecraft/world/inventory/StonecutterMenu.java
+@@ -17,6 +15,13 @@
+ import net.minecraft.world.level.Level;
+ import net.minecraft.world.level.block.Blocks;
+
++// CraftBukkit start
++import org.bukkit.Location;
++import org.bukkit.craftbukkit.inventory.CraftInventoryStonecutter;
++import org.bukkit.craftbukkit.inventory.CraftInventoryView;
++import org.bukkit.entity.Player;
++// CraftBukkit end
++
+ public class StonecutterMenu extends AbstractContainerMenu {
+ public static final int INPUT_SLOT = 0;
+ public static final int RESULT_SLOT = 1;
+@@ -32,24 +38,54 @@
+ long lastSoundTime;
+ final Slot inputSlot;
+ final Slot resultSlot;
+- Runnable slotUpdateListener = () -> {
+- };
+- public final Container container = new SimpleContainer(1) {
+- @Override
+- public void setChanged() {
+- super.setChanged();
+- StonecutterMenu.this.slotsChanged(this);
+- StonecutterMenu.this.slotUpdateListener.run();
++ Runnable slotUpdateListener;
++ public final Container container;
++ final ResultContainer resultContainer;
++ // CraftBukkit start
++ private CraftInventoryView bukkitEntity = null;
++ private Player player;
++
++ @Override
++ public CraftInventoryView getBukkitView() {
++ if (bukkitEntity != null) {
++ return bukkitEntity;
+ }
+ };
+ final ResultContainer resultContainer = new ResultContainer();
+
++ CraftInventoryStonecutter inventory = new CraftInventoryStonecutter(this.container, this.resultContainer);
++ bukkitEntity = new CraftInventoryView(this.player, inventory, this);
++ return bukkitEntity;
++ }
++ // CraftBukkit end
++
+ public StonecutterMenu(int containerId, Inventory playerInventory) {
+ this(containerId, playerInventory, ContainerLevelAccess.NULL);
+ }
+
+ public StonecutterMenu(int containerId, Inventory playerInventory, final ContainerLevelAccess access) {
+ super(MenuType.STONECUTTER, containerId);
++ this.selectedRecipeIndex = DataSlot.standalone();
++ this.recipes = Lists.newArrayList();
++ this.input = ItemStack.EMPTY;
++ this.slotUpdateListener = () -> {
++ };
++ this.container = new SimpleContainer(1) {
++ @Override
++ public void setChanged() {
++ super.setChanged();
++ StonecutterMenu.this.slotsChanged(this);
++ StonecutterMenu.this.slotUpdateListener.run();
++ }
++
++ // CraftBukkit start
++ @Override
++ public Location getLocation() {
++ return access.getLocation();
++ }
++ // CraftBukkit end
++ };
++ this.resultContainer = new ResultContainer();
+ this.access = access;
+ this.level = playerInventory.player.level();
+ this.inputSlot = this.addSlot(new Slot(this.container, 0, 20, 33));
+@@ -94,6 +133,7 @@
+ }
+
+ this.addDataSlot(this.selectedRecipeIndex);
++ player = (Player) playerInventory.player.getBukkitEntity(); // CraftBukkit
+ }
+
+ public int getSelectedRecipeIndex() {
+@@ -113,7 +153,8 @@
+ }
+
+ @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.STONECUTTER);
+ }
+