--- a/net/minecraft/world/inventory/ContainerStonecutter.java +++ b/net/minecraft/world/inventory/ContainerStonecutter.java @@ -17,6 +17,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; @@ -36,6 +43,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); @@ -55,6 +77,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; @@ -106,6 +135,7 @@ } this.addDataSlot(this.selectedRecipeIndex); + player = (Player) playerinventory.player.getBukkitEntity(); // CraftBukkit } public int getSelectedRecipeIndex() { @@ -126,6 +156,7 @@ @Override public boolean stillValid(EntityHuman entityhuman) { + if (!this.checkReachable) return true; // CraftBukkit return stillValid(this.access, entityhuman, Blocks.STONECUTTER); }