how to add text to a map (Item)

Discussion in 'Plugin Development' started by LunaTiX_, Sep 13, 2012.

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

    LunaTiX_

    Hi,
    Does anybody know how to add a text to a map ? When you hold a map in your hand there is a text instead of the map.
    Is it an API ? If so, where do i find this API ..

    Thanks in advance,
    Best regards
     
  2. Offline

    Sabersamus

    You have to get the MapCanvas of the map, and use setPixel(int x, int y, byte color); to change do that :)

    MapCanvas
     
    LunaTiX_ likes this.
  3. Offline

    stelar7

    drawText(int x, int y, MapFont font, String text) would be easier if its text...
     
    LunaTiX_ likes this.
  4. Offline

    Sabersamus

    I did not even see that method, thank you :)
     
  5. Offline

    LunaTiX_

    Thanks for your answers. But how to do this ? I dont want every map to have a text. Is this possible or does everymap has the text ?
    How to call this "method" ? It's not an event or something ..

    Maybe just a simple Code snippet ?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 28, 2016
  6. Offline

    stelar7

    Code:
    MapView map = Bukkit.getServer().getMap(<iteminhand>.getDurability());
    for (MapRenderer mr : map.getRenderers()){
        map.removeRenderer(mr);
    }
    map.addRenderer(yourCustomRenderer);
     
Thread Status:
Not open for further replies.

Share This Page