PaperMC/nms-patches/ItemMapEmpty.patch
2015-03-04 09:48:58 +00:00

25 lines
1.4 KiB
Diff

--- /home/matt/mc-dev-private//net/minecraft/server/ItemMapEmpty.java 2015-02-26 22:40:22.835608137 +0000
+++ src/main/java/net/minecraft/server/ItemMapEmpty.java 2015-02-26 22:40:22.835608137 +0000
@@ -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);
+ worldMain.a(s, (PersistentBase) worldmap); // CraftBukkit
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;