4

I'm currently developing a plugin which only renders an image to a map like this:

public class MapRendererTest extends MapRenderer {

    private Image image;

    public MapRendererTest(File file) {
        try {
            this.image = ImageIO.read(file);
        }
        catch (IOException e) {
            e.printStackTrace();
        }
    }

    @Override
    public void render(MapView mapView, MapCanvas mapCanvas, Player player) {
        mapCanvas.drawImage(0, 0, image);
    }
}

everything works fine, but there is this little thing in the red circle that I want to remove but I don't know how.

T

Things I already tried

  • Setting an emtpy MapCursorCollection
  • MapView.setWorld to a world where no-one is playing.
  • Creating MapCursorCollection with a invisible cursor

It would be amazing if someone could help me with that.

Thanks in advance

freggy
  • 67
  • 9

1 Answers1

2

To get rid of the cursor, you have to remove all the other map renderers or at least the CraftMapRanderer.

In order to do this, you have to do the following:

@EventHandler
public void onMapInitialized(MapInitializeEvent e) {
    e.getMap().removeRenderer(e.getMap().getRenderers().get(0));
    e.getMap().addRenderer(new MapRendererTest(new File(Main.getInstance().getDataFolder() + "/image.png")));
}

This only works of course if there is no other custom map renderer assigned to this map, so the only registered is the CraftMapRenderer.

If you have multiple MapRenderers you could loop through the list and remove them.

freggy
  • 67
  • 9