Solved Fixing custom maps for 1.13

Discussion in 'Plugin Development' started by The_Spaceman, Aug 6, 2018.

Thread Status:
Not open for further replies.
  1. Offline


    When I try my for 1.12 working custom map code in minecraft 1.13 this doesn't work.

    I get something like white squares and it gets instantly updated to a normal map. In a ItemFrame it gets updated when I lose my sight of the map

    And when I relogged on my server the white squares doesn't appear anymore, but it is staying blank for 1 second and then I see just regulair world...

    public void render(MapView mapView, MapCanvas mapCanvas, Player player) {
        MapRenderer renderer = mapCanvas.getMapView().getRenderers().get(0);
        if (renderer instanceof ImageMapRenderer) {
            ImageMapRenderer mapRenderer = (ImageMapRenderer) renderer;
            mapCanvas.drawImage(xOffset, yOffset, image);
    This is some of my code that represents the working principle of the custom map.
  2. @The_Spaceman
    Have you reported this bug to spigot yet? This is most likely a bug on their end.
  3. I didn't encounter any renderer related problems when updating my map-based plugins to 1.13, so this seems odd.

    Something I noticed in your code is, that you're checking in the renderer whether the primary renderer of the rendered map is a certain type of renderer. That seems like it's most likely redundant (unless you have a reason for it).

    Are you removing the vanilla renderer when creating the map?
  4. Offline


    1: I check if its is my custom renderer for when other people are using my code in their plugin and use their own renderes as well, so thats why I check (not really necessary, I know).

    2: yes
    ItemStack is = new ItemStack(Material.FILLED_MAP);
    MapView view = Bukkit.getMap(is.getDurability());
    for (MapRenderer m : view.getRenderers()) {
    try {
        view.addRenderer(new ImageMapRenderer( File("D:\\Users\\jphbo\\Minecraft servers\\test server\\plugins\\maps\\water.jpg"))));
    } catch (IOException e) {
    this is some code I wrote because my main code didn't work. So I wanted to check that out, this is the code that is the important piece thats adds the custom image to the map.
    It has worked before
  5. Code:
    MapView view = Bukkit.getMap(is.getDurability());
    I think here could be a problem. Using damage values/durability to get the MapID is not valid in 1.13 anymore.

    You have to use
    ((MapMeta) is.getItemMeta()).getMapId()
    to get a map item's ID. But since you never set a map ID it should be 0 anyways...

    You probably should try to create a map server-side first, instead of just creating an item. Use the Bukkit.createMap(World) for that. It will return a MapView that you can get it's MapId from to create an item like this
    ItemStack item = new ItemStack(Material.FILLED_MAP);
    MapMeta meta = (MapMeta) item.getItemMeta();
  6. Offline


    My org.bukkit.inventory.meta.MapMeta doesn't have the .setMapID method...
    And getID is deprecated.
  7. Offline


Thread Status:
Not open for further replies.

Share This Page