Understanding maps

Discussion in 'Spigot Plugin Development' started by abandoncaptian, Mar 7, 2018.

  1. I've been working on a system to the player on their map their location and other details, I have an image I want to put on a map that I can then move around according to the player's location possibly, the map image size is 640 by 640, if that can't be done maybe I could just put a picture of the entire map on the map the players are looking at, I would also would like some players to have the same map as others but not EVERYONE have the same map.

    I have tried many different methods, so any insight would help.
  2. You can make your own MapRenderer. Extend it and explore/google what you can do with it. Get the maps you want to edit/use MapInitialiseEvent and clear the renders to add your custom one.
  3. I've got that far but I'm needing to get the item of that map to then give it to the players on the same team.

    I have it putting the image on the map but it's very laggy, it stutters because I added the render and its constantly putting the image on the map. I want to just put it once
    #3 abandoncaptian, Mar 8, 2018
    Last edited: Mar 8, 2018
  4. I solved performance issues by minimizing things done in the Map update method. Try to save your changes and then just commit them every time the method is called.
  5. ok, now I'm trying to draw a cursor at the player's location, the example map size is 640 x 640 and the map item is only 128 x 128, I'm needing a mathematical way to convert the player's location within the space to a position on the map.
  6. Maps are 128x128. If you hang multiple next to each other in a picture frame, you get something that looks like a big map, isn't that what you want?

    So, an example: Say the map covers the coordinates from (0,0) to (640,640). Now, the player is at (say) (352, 174).

    Now think about what submap that will land on and what subcoordinates it has.

    After you figured that out, think about what you just computed how you could generalize it for generic argument, generic map sizes at generic positions.

    Hint: the modulo operator is a thing, use it.

Share This Page