summaryrefslogtreecommitdiffstats
path: root/nms-patches/ItemMapEmpty.patch
diff options
context:
space:
mode:
Diffstat (limited to 'nms-patches/ItemMapEmpty.patch')
-rw-r--r--nms-patches/ItemMapEmpty.patch24
1 files changed, 24 insertions, 0 deletions
diff --git a/nms-patches/ItemMapEmpty.patch b/nms-patches/ItemMapEmpty.patch
new file mode 100644
index 00000000..9159a106
--- /dev/null
+++ b/nms-patches/ItemMapEmpty.patch
@@ -0,0 +1,24 @@
+--- ../work/decompile-bb26c12b/net/minecraft/server/ItemMapEmpty.java 2014-11-27 08:59:46.785421476 +1100
++++ src/main/java/net/minecraft/server/ItemMapEmpty.java 2014-11-27 08:42:10.164850887 +1100
+@@ -7,15 +7,19 @@
+ }
+
+ public ItemStack a(ItemStack itemstack, World world, EntityHuman entityhuman) {
+- ItemStack itemstack1 = new ItemStack(Items.FILLED_MAP, 1, world.b("map"));
++ World worldMain = world.getServer().getServer().worlds.get(0); // CraftBukkit - store reference to primary world
++ ItemStack itemstack1 = new ItemStack(Items.FILLED_MAP, 1, worldMain.b("map")); // CraftBukkit - use primary world for maps
+ String s = "map_" + itemstack1.getData();
+ WorldMap worldmap = new WorldMap(s);
+
+ world.a(s, (PersistentBase) worldmap);
+ worldmap.scale = 0;
+ worldmap.a(entityhuman.locX, entityhuman.locZ, worldmap.scale);
+- worldmap.map = (byte) world.worldProvider.getDimension();
++ worldmap.map = (byte) ((WorldServer) world).dimension; // CraftBukkit - use bukkit dimension
+ worldmap.c();
++
++ org.bukkit.craftbukkit.event.CraftEventFactory.callEvent(new org.bukkit.event.server.MapInitializeEvent(worldmap.mapView)); // CraftBukkit
++
+ --itemstack.count;
+ if (itemstack.count <= 0) {
+ return itemstack1;