Paper/nms-patches/ContainerGrindstone.patch

64 lines
2.0 KiB
Diff
Raw Normal View History

2019-04-23 04:00:00 +02:00
--- a/net/minecraft/server/ContainerGrindstone.java
+++ b/net/minecraft/server/ContainerGrindstone.java
@@ -4,9 +4,30 @@
import java.util.Map;
import java.util.Map.Entry;
import java.util.stream.Collectors;
+// 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 ContainerGrindstone extends Container {
+ // CraftBukkit start
+ private CraftInventoryView bukkitEntity = null;
+ private Player player;
+
+ @Override
+ public CraftInventoryView getBukkitView() {
+ if (bukkitEntity != null) {
+ return bukkitEntity;
+ }
+
+ CraftInventoryGrindstone inventory = new CraftInventoryGrindstone(this.craftInventory, this.resultInventory);
+ bukkitEntity = new CraftInventoryView(this.player, inventory, this);
+ return bukkitEntity;
+ }
+ // CraftBukkit end
private final IInventory resultInventory;
private final IInventory craftInventory;
private final ContainerAccess containerAccess;
@@ -24,6 +45,13 @@
super.update();
ContainerGrindstone.this.a((IInventory) this);
}
+
+ // CraftBukkit start
+ @Override
+ public Location getLocation() {
+ return containeraccess.getLocation();
+ }
+ // CraftBukkit end
};
this.containerAccess = containeraccess;
this.a(new Slot(this.craftInventory, 0, 49, 19) {
@@ -108,6 +136,7 @@
this.a(new Slot(playerinventory, j, 8 + j * 18, 142));
}
+ player = (Player) playerinventory.player.getBukkitEntity(); // CraftBukkit
}
@Override
2019-05-27 22:30:00 +02:00
@@ -235,6 +264,7 @@
2019-04-23 04:00:00 +02:00
@Override
public boolean canUse(EntityHuman entityhuman) {
+ if (!this.checkReachable) return true; // CraftBukkit
return a(this.containerAccess, entityhuman, Blocks.GRINDSTONE);
}