mirror of
https://hub.spigotmc.org/stash/scm/spigot/craftbukkit.git
synced 2024-11-25 03:26:14 +00:00
86 lines
3.1 KiB
Diff
86 lines
3.1 KiB
Diff
--- a/net/minecraft/world/inventory/ContainerCartography.java
|
|
+++ b/net/minecraft/world/inventory/ContainerCartography.java
|
|
@@ -14,8 +14,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;
|
|
@@ -40,6 +62,13 @@
|
|
ContainerCartography.this.slotsChanged(this);
|
|
super.setChanged();
|
|
}
|
|
+
|
|
+ // CraftBukkit start
|
|
+ @Override
|
|
+ public Location getLocation() {
|
|
+ return containeraccess.getLocation();
|
|
+ }
|
|
+ // CraftBukkit end
|
|
};
|
|
this.resultContainer = new InventoryCraftResult() {
|
|
@Override
|
|
@@ -47,15 +76,22 @@
|
|
ContainerCartography.this.slotsChanged(this);
|
|
super.setChanged();
|
|
}
|
|
+
|
|
+ // CraftBukkit start
|
|
+ @Override
|
|
+ public Location getLocation() {
|
|
+ return containeraccess.getLocation();
|
|
+ }
|
|
+ // CraftBukkit end
|
|
};
|
|
this.access = containeraccess;
|
|
- this.addSlot(new Slot(this, this.container, 0, 15, 15) {
|
|
+ this.addSlot(new Slot(this.container, 0, 15, 15) { // CraftBukkit - decompile error
|
|
@Override
|
|
public boolean mayPlace(ItemStack itemstack) {
|
|
return itemstack.has(DataComponents.MAP_ID);
|
|
}
|
|
});
|
|
- this.addSlot(new Slot(this, this.container, 1, 15, 52) {
|
|
+ this.addSlot(new Slot(this.container, 1, 15, 52) { // CraftBukkit - decompile error
|
|
@Override
|
|
public boolean mayPlace(ItemStack itemstack) {
|
|
return itemstack.is(Items.PAPER) || itemstack.is(Items.MAP) || itemstack.is(Items.GLASS_PANE);
|
|
@@ -85,10 +121,12 @@
|
|
}
|
|
});
|
|
this.addStandardInventorySlots(playerinventory, 8, 84);
|
|
+ player = (Player) playerinventory.player.getBukkitEntity(); // CraftBukkit
|
|
}
|
|
|
|
@Override
|
|
public boolean stillValid(EntityHuman entityhuman) {
|
|
+ if (!this.checkReachable) return true; // CraftBukkit
|
|
return stillValid(this.access, entityhuman, Blocks.CARTOGRAPHY_TABLE);
|
|
}
|
|
|