Maps

Discussion in 'Plugin Development' started by ewrs, Oct 4, 2018.

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

    ewrs

    Hey. I have such a question, how can I render a map and stick it in an ItemFrame?

    I need to make it so that in this ItemFrame was placed a picture from the folder, which I will indicate. Could you tell me how to do this?

    I use it
    final ItemFrame iFrame = (ItemFrame) e.getPlayer (). getWorld (). spawnEntity (loc, EntityType.ITEM_FRAME);
     
  2. Offline

    Zombie_Striker

    @ewrs
    Well, you would need to create your own MapRenderer to render the image, and then add that renderer to the maps that need that image.

    This was something I already did for my one of my plugins. I'd recommend you look at the util below to see how it is done, and then either copy and paste the utils into your own project, or just download that plugin and use it as an API.

    The MapRenderer:
    https://github.com/ZombieStriker/Pl...er/pluginconstructor/CustomImageRenderer.java

    The util for creating an setting the maps:
    https://github.com/ZombieStriker/Pl...ie_striker/pluginconstructor/MapWallUtil.java
     
  3. Offline

    ewrs

    I decided with the rendering, but didn’t understand how I can upload a picture from the FOLDER and insert it into ItemFrame through the ItemStack
     
  4. Offline

    timtower Administrator Administrator Moderator

    Find a file in the folder, turn it into a BufferedImage, then you should be able to use the util class that Zombie_Striker provided.
     
  5. Offline

    ewrs

    CustomImageRenderer? That is error. I'm used 1.12.2
     
  6. Offline

    timtower Administrator Administrator Moderator

    Did you download that class from the links above?
     
  7. Offline

    ewrs

  8. Offline

    timtower Administrator Administrator Moderator

    @ewrs Then what error do you get? Because "That is error" is not enough to tell what is wrong so we can fix it.
     
  9. Offline

    ewrs

    CustomImageRenderer cannot be resolved to a variable

    Where should I get it?
     
  10. Offline

    timtower Administrator Administrator Moderator

    @ewrs Please post your code.
     
  11. Offline

    ewrs

  12. Offline

    timtower Administrator Administrator Moderator

    @ewrs And if you hover your mouse over the error, does it give quick fix suggestions?
    Are the classes in the same package?
     
  13. Offline

    ewrs

    Create a class, interface, etc.
    Yes

    UDP: Everything, I understood a mistake and solved it. But I still have a couple of questions. I will write them later.

    UPD2: Hi again. I did it, thank you. But now there is a question. Can I update the map and write on it online of another server on the bungee? Or will I need to create my own pictures from 1/100, 2/100, etc.?
     
    Last edited: Oct 5, 2018
  14. Offline

    timtower Administrator Administrator Moderator

    Locked
    Bungeecord requires offline mode.
    Offline mode is not supported by Bukkit.
     
Thread Status:
Not open for further replies.

Share This Page