13
0
geforkt von Mirrors/Paper
Paper/nms-patches/ContainerStonecutter.patch

65 Zeilen
2.1 KiB
Diff

2019-04-23 04:00:00 +02:00
--- a/net/minecraft/server/ContainerStonecutter.java
+++ b/net/minecraft/server/ContainerStonecutter.java
@@ -2,6 +2,12 @@
2019-12-10 23:00:00 +01:00
2019-04-23 04:00:00 +02:00
import com.google.common.collect.Lists;
import java.util.List;
+// CraftBukkit start
+import org.bukkit.Location;
2019-04-23 04:00:00 +02:00
+import org.bukkit.craftbukkit.inventory.CraftInventoryStonecutter;
+import org.bukkit.craftbukkit.inventory.CraftInventoryView;
+import org.bukkit.entity.Player;
+// CraftBukkit end
public class ContainerStonecutter extends Container {
@@ -16,6 +22,21 @@
2019-12-10 23:00:00 +01:00
private Runnable l;
2019-04-23 04:00:00 +02:00
public final IInventory inventory;
2019-06-21 12:00:00 +02:00
private final InventoryCraftResult resultInventory;
2019-04-23 04:00:00 +02:00
+ // CraftBukkit start
+ private CraftInventoryView bukkitEntity = null;
+ private Player player;
+
+ @Override
+ public CraftInventoryView getBukkitView() {
+ if (bukkitEntity != null) {
+ return bukkitEntity;
+ }
+
2019-06-21 12:00:00 +02:00
+ CraftInventoryStonecutter inventory = new CraftInventoryStonecutter(this.inventory, this.resultInventory);
2019-04-23 04:00:00 +02:00
+ bukkitEntity = new CraftInventoryView(this.player, inventory, this);
+ return bukkitEntity;
+ }
+ // CraftBukkit end
public ContainerStonecutter(int i, PlayerInventory playerinventory) {
this(i, playerinventory, ContainerAccess.a);
@@ -35,6 +56,13 @@
ContainerStonecutter.this.a((IInventory) this);
ContainerStonecutter.this.l.run();
}
+
+ // CraftBukkit start
+ @Override
+ public Location getLocation() {
+ return containeraccess.getLocation();
+ }
+ // CraftBukkit end
};
this.resultInventory = new InventoryCraftResult();
this.containerAccess = containeraccess;
@@ -82,10 +110,12 @@
2019-04-23 04:00:00 +02:00
}
this.a(this.containerProperty);
+ player = (Player) playerinventory.player.getBukkitEntity(); // CraftBukkit
}
@Override
public boolean canUse(EntityHuman entityhuman) {
+ if (!this.checkReachable) return true; // CraftBukkit
return a(this.containerAccess, entityhuman, Blocks.STONECUTTER);
}