3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-15 12:30:06 +01:00
Paper/nms-patches/ContainerCartography.patch
2020-08-12 07:00:00 +10:00

60 Zeilen
1.9 KiB
Diff

--- a/net/minecraft/server/ContainerCartography.java
+++ b/net/minecraft/server/ContainerCartography.java
@@ -1,7 +1,29 @@
package net.minecraft.server;
+// CraftBukkit start
+import org.bukkit.Location;
+import org.bukkit.craftbukkit.inventory.CraftInventoryCartography;
+import org.bukkit.craftbukkit.inventory.CraftInventoryView;
+import org.bukkit.entity.Player;
+// CraftBukkit end
+
public class ContainerCartography extends Container {
+ // CraftBukkit start
+ private CraftInventoryView bukkitEntity = null;
+ private Player player;
+
+ @Override
+ public CraftInventoryView getBukkitView() {
+ if (bukkitEntity != null) {
+ return bukkitEntity;
+ }
+
+ CraftInventoryCartography inventory = new CraftInventoryCartography(this.inventory, this.resultInventory);
+ bukkitEntity = new CraftInventoryView(this.player, inventory, this);
+ return bukkitEntity;
+ }
+ // CraftBukkit end
private final ContainerAccess containerAccess;
private long e;
public final IInventory inventory;
@@ -26,6 +48,13 @@
ContainerCartography.this.a((IInventory) this);
super.update();
}
+
+ // CraftBukkit start
+ @Override
+ public Location getLocation() {
+ return containeraccess.getLocation();
+ }
+ // CraftBukkit end
};
this.containerAccess = containeraccess;
this.a(new Slot(this.inventory, 0, 15, 15) {
@@ -78,10 +107,12 @@
this.a(new Slot(playerinventory, j, 8 + j * 18, 142));
}
+ player = (Player) playerinventory.player.getBukkitEntity(); // CraftBukkit
}
@Override
public boolean canUse(EntityHuman entityhuman) {
+ if (!this.checkReachable) return true; // CraftBukkit
return a(this.containerAccess, entityhuman, Blocks.CARTOGRAPHY_TABLE);
}