PaperMC/paper-server/nms-patches/net/minecraft/world/inventory/ContainerStonecutter.patch
CraftBukkit/Spigot 8a3c8cfcd4 Update to Minecraft 1.20.2
By: md_5 <git@md-5.net>
2023-09-22 02:40:00 +10:00

68 lines
2.3 KiB
Diff

--- a/net/minecraft/world/inventory/ContainerStonecutter.java
+++ b/net/minecraft/world/inventory/ContainerStonecutter.java
@@ -16,6 +16,13 @@
import net.minecraft.world.level.World;
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 ContainerStonecutter extends Container {
public static final int INPUT_SLOT = 0;
@@ -35,6 +42,21 @@
Runnable slotUpdateListener;
public final IInventory container;
final InventoryCraftResult resultContainer;
+ // CraftBukkit start
+ private CraftInventoryView bukkitEntity = null;
+ private Player player;
+
+ @Override
+ public CraftInventoryView getBukkitView() {
+ if (bukkitEntity != null) {
+ return bukkitEntity;
+ }
+
+ CraftInventoryStonecutter inventory = new CraftInventoryStonecutter(this.container, this.resultContainer);
+ bukkitEntity = new CraftInventoryView(this.player, inventory, this);
+ return bukkitEntity;
+ }
+ // CraftBukkit end
public ContainerStonecutter(int i, PlayerInventory playerinventory) {
this(i, playerinventory, ContainerAccess.NULL);
@@ -54,6 +76,13 @@
ContainerStonecutter.this.slotsChanged(this);
ContainerStonecutter.this.slotUpdateListener.run();
}
+
+ // CraftBukkit start
+ @Override
+ public Location getLocation() {
+ return containeraccess.getLocation();
+ }
+ // CraftBukkit end
};
this.resultContainer = new InventoryCraftResult();
this.access = containeraccess;
@@ -105,6 +134,7 @@
}
this.addDataSlot(this.selectedRecipeIndex);
+ player = (Player) playerinventory.player.getBukkitEntity(); // CraftBukkit
}
public int getSelectedRecipeIndex() {
@@ -125,6 +155,7 @@
@Override
public boolean stillValid(EntityHuman entityhuman) {
+ if (!this.checkReachable) return true; // CraftBukkit
return stillValid(this.access, entityhuman, Blocks.STONECUTTER);
}