@Override public void d(ItemStack itemstack, World world, EntityHuman entityhuman) { if (itemstack.hasTag() && itemstack.getTag().getBoolean("map_is_scaling")) { WorldMap worldmap = Items.MAP.getSavedMap(itemstack, world); world = world.getServer().getServer().worlds.get(0); // CraftBukkit - use primary world for maps itemstack.setData(world.b("map")); WorldMap worldmap1 = new WorldMap("map_" + itemstack.getData()); worldmap1.scale = (byte) (worldmap.scale + 1); if (worldmap1.scale > 4) { worldmap1.scale = 4; } worldmap1.centerX = worldmap.centerX; worldmap1.centerZ = worldmap.centerZ; worldmap1.map = worldmap.map; worldmap1.c(); world.a("map_" + itemstack.getData(), worldmap1); // CraftBukkit start MapInitializeEvent event = new MapInitializeEvent(worldmap1.mapView); Bukkit.getServer().getPluginManager().callEvent(event); // CraftBukkit end } }
public WorldMap getSavedMap(ItemStack itemstack, World world) { World worldMain = world .getServer() .getServer() .worlds .get(0); // CraftBukkit - store reference to primary world String s = "map_" + itemstack.getData(); WorldMap worldmap = (WorldMap) worldMain.a(WorldMap.class, s); // CraftBukkit - use primary world for maps if (worldmap == null && !world.isStatic) { itemstack.setData(worldMain.b("map")); // CraftBukkit - use primary world for maps s = "map_" + itemstack.getData(); worldmap = new WorldMap(s); worldmap.scale = 3; int i = 128 * (1 << worldmap.scale); worldmap.centerX = Math.round((float) world.getWorldData().c() / (float) i) * i; worldmap.centerZ = Math.round(world.getWorldData().e() / i) * i; worldmap.map = (byte) ((WorldServer) world).dimension; // CraftBukkit - fixes Bukkit multiworld maps worldmap.c(); worldMain.a(s, worldmap); // CraftBukkit - use primary world for maps // CraftBukkit start MapInitializeEvent event = new MapInitializeEvent(worldmap.mapView); Bukkit.getServer().getPluginManager().callEvent(event); // CraftBukkit end } return worldmap; }
public void d(ItemStack itemstack, World world, EntityHuman entityhuman) { itemstack.b(world.b("map")); String s = "map_" + itemstack.getData(); WorldMap worldmap = new WorldMap(s); world.a(s, (WorldMapBase) worldmap); worldmap.b = MathHelper.floor(entityhuman.locX); worldmap.c = MathHelper.floor(entityhuman.locZ); worldmap.e = 3; worldmap.map = (byte) world.worldProvider.dimension; worldmap.a(); }
public WorldMap a(ItemStack itemstack, World world) { WorldMap worldmap = (WorldMap) world.a(WorldMap.class, "map_" + itemstack.getData()); if (worldmap == null) { itemstack.b(world.b("map")); String s = "map_" + itemstack.getData(); worldmap = new WorldMap(s); worldmap.b = world.r().c(); worldmap.c = world.r().e(); worldmap.e = 3; worldmap.map = (byte) world.worldProvider.dimension; worldmap.a(); world.a(s, (WorldMapBase) worldmap); } return worldmap; }