mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-09 19:49:35 +01:00
9d740b84b0
By: md_5 <git@md-5.net>
68 lines
2.3 KiB
Diff
68 lines
2.3 KiB
Diff
--- a/net/minecraft/world/inventory/ContainerStonecutter.java
|
|
+++ b/net/minecraft/world/inventory/ContainerStonecutter.java
|
|
@@ -15,6 +15,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;
|
|
@@ -34,6 +41,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);
|
|
@@ -53,6 +75,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;
|
|
@@ -104,6 +133,7 @@
|
|
}
|
|
|
|
this.addDataSlot(this.selectedRecipeIndex);
|
|
+ player = (Player) playerinventory.player.getBukkitEntity(); // CraftBukkit
|
|
}
|
|
|
|
public int getSelectedRecipeIndex() {
|
|
@@ -124,6 +154,7 @@
|
|
|
|
@Override
|
|
public boolean stillValid(EntityHuman entityhuman) {
|
|
+ if (!this.checkReachable) return true; // CraftBukkit
|
|
return stillValid(this.access, entityhuman, Blocks.STONECUTTER);
|
|
}
|
|
|