PaperMC/paper-server/nms-patches/net/minecraft/world/inventory/ContainerCartography.patch
CraftBukkit/Spigot b3a8254758 Update to Minecraft 1.17
By: md_5 <git@md-5.net>
2021-06-11 15:00:00 +10:00

74 lines
2.4 KiB
Diff

--- a/net/minecraft/world/inventory/ContainerCartography.java
+++ b/net/minecraft/world/inventory/ContainerCartography.java
@@ -12,8 +12,30 @@
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.saveddata.maps.WorldMap;
+// 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.container, this.resultContainer);
+ bukkitEntity = new CraftInventoryView(this.player, inventory, this);
+ return bukkitEntity;
+ }
+ // CraftBukkit end
public static final int MAP_SLOT = 0;
public static final int ADDITIONAL_SLOT = 1;
public static final int RESULT_SLOT = 2;
@@ -38,6 +60,13 @@
ContainerCartography.this.a((IInventory) this);
super.update();
}
+
+ // CraftBukkit start
+ @Override
+ public Location getLocation() {
+ return containeraccess.getLocation();
+ }
+ // CraftBukkit end
};
this.resultContainer = new InventoryCraftResult() {
@Override
@@ -45,6 +74,13 @@
ContainerCartography.this.a((IInventory) this);
super.update();
}
+
+ // CraftBukkit start
+ @Override
+ public Location getLocation() {
+ return containeraccess.getLocation();
+ }
+ // CraftBukkit end
};
this.access = containeraccess;
this.a(new Slot(this.container, 0, 15, 15) {
@@ -95,10 +131,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.access, entityhuman, Blocks.CARTOGRAPHY_TABLE);
}