2021-03-16 09:00:00 +11:00
--- a/net/minecraft/world/item/ItemWorldMap.java
+++ b/net/minecraft/world/item/ItemWorldMap.java
2021-06-11 15:00:00 +10:00
@@ -34,6 +34,11 @@
2021-03-16 09:00:00 +11:00
import net.minecraft.world.level.material.MaterialMapColor;
import net.minecraft.world.level.saveddata.maps.WorldMap;
2014-11-26 08:32:16 +11:00
+// CraftBukkit start
+import org.bukkit.Bukkit;
+import org.bukkit.event.server.MapInitializeEvent;
+// CraftBukkit end
+
public class ItemWorldMap extends ItemWorldMapBase {
2021-06-11 15:00:00 +10:00
public static final int IMAGE_WIDTH = 128;
2021-06-12 08:25:43 +10:00
@@ -68,14 +73,18 @@
2021-06-11 15:00:00 +10:00
public static Integer d(ItemStack itemstack) {
2018-07-15 10:00:00 +10:00
NBTTagCompound nbttagcompound = itemstack.getTag();
2021-06-11 15:00:00 +10:00
- return nbttagcompound != null && nbttagcompound.hasKeyOfType("map", 99) ? nbttagcompound.getInt("map") : null;
2018-07-15 10:00:00 +10:00
+ return nbttagcompound != null && nbttagcompound.hasKeyOfType("map", 99) ? nbttagcompound.getInt("map") : -1; // CraftBukkit - make new maps for no tag
2016-11-17 12:41:03 +11:00
}
2021-06-12 08:25:43 +10:00
- private static int a(World world, int i, int j, int k, boolean flag, boolean flag1, ResourceKey<World> resourcekey) {
+ public static int a(World world, int i, int j, int k, boolean flag, boolean flag1, ResourceKey<World> resourcekey) { // PAIL private -> public
WorldMap worldmap = WorldMap.a((double) i, (double) j, (byte) k, flag, flag1, resourcekey);
2021-06-11 15:00:00 +10:00
int l = world.getWorldMapCount();
world.a(a(l), worldmap);
2018-07-15 10:00:00 +10:00
+ // CraftBukkit start
+ MapInitializeEvent event = new MapInitializeEvent(worldmap.mapView);
+ Bukkit.getServer().getPluginManager().callEvent(event);
+ // CraftBukkit end
2021-06-11 15:00:00 +10:00
return l;
2018-07-15 10:00:00 +10:00
}