Does anybody want to contribute to this plugin? Cartographer.

Discussion in 'Plugin Development' started by Courier, Sep 10, 2012.

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

    Courier

    Hey! I am just about ready to release a plugin, and I was wondering if anybody wants to contribute before I release the first version.

    This plugin is called Cartographer, and it is for generating images from a birds-eye view of a Minecraft world. It is meant to be used by server admins, not by regular players.

    When you generate a large map, it totally lags your server, so it is meant to be used when no players are online, or only for small maps. I left room for me to implement an async option based on ChunkSnapshots that won't lag the server too much... but it would take much longer to generate maps, so it is not a high priority. The main reason I am making this plugin is for devs who are working on World Gen. This plugin enables us to easily analyze worlds.

    Cartographer uses the Bukkit Services Manager to load map types specified by other plugins, so anybody can make a plugin that talks to Cartographer and provides new map types. I am also including several map types built in to Cartographer. I would be very happy to include map types you make in my first release. Of course, you will get the credit for that map type.

    Click here to see sample maps generated by Cartographer. All from the same Default Minecraft world (open)
    SurfaceColor
    [​IMG]

    Original
    [​IMG]

    Density
    [​IMG]

    Biome
    [​IMG]

    Cave
    [​IMG]

    Height
    [​IMG]

    SurfaceType
    [​IMG]
    Cartographer handles all the hard work, so writing new map types is easy and fun.
    Here is an example of a new map type that creates a cross-section of a world at a user specified y value.
    Click here to see example map type source code (open)
    Code:java
    1. package net.terriblysimple.bukkit.cartographer.example;
    2.  
    3. import org.bukkit.plugin.ServicePriority;
    4. import org.bukkit.plugin.java.JavaPlugin;
    5.  
    6. import com.terriblysimple.bukkit.cartographer.Mapper;
    7. import com.terriblysimple.bukkit.cartographer.MapperProvider;
    8. import com.terriblysimple.bukkit.cartographer.ScaledMapper;
    9. import com.terriblysimple.bukkit.cartographer.SingleColumn;
    10. import com.terriblysimple.bukkit.cartographer.util.BlockTopColor;
    11. import com.terriblysimple.bukkit.cartographer.util.ColorUtil;
    12.  
    13. public class CrossSectionPlugin extends JavaPlugin
    14. {
    15. @Override
    16. public void onEnable()
    17. {
    18. getServer().getServicesManager().register(MapperProvider.class, new MapperProvider()
    19. {
    20. /**
    21.   * Case insensitive.
    22.   * @return The name a user will use to reference this Mapper
    23.   */
    24. public String getName()
    25. {
    26. return "cross-section";
    27. }
    28.  
    29. /**
    30.   * Returns a Mapper that maps the color of a cross section of the map.
    31.   * The y value of this constructor is the first argument.
    32.   */
    33. public Mapper getMapper(String[] args)
    34. {
    35. int y;
    36. if(args.length == 0)
    37. return null; //this will print an error to the user
    38.  
    39. try
    40. {
    41. y = Integer.parseInt(args[0]);
    42. }
    43. {
    44. return null;
    45. }
    46.  
    47. final int parsedY = y;
    48. return new ScaledMapper()
    49. {
    50. @Override
    51. public int getColor(SingleColumn column)
    52. {
    53. return ColorUtil.setA(BlockTopColor.getColor(column, parsedY), 255);
    54. }
    55. };
    56. }
    57. }, this, ServicePriority.Normal);
    58. }
    59. }
    That's it -- the entire plugin. All in one source file which is 60 lines, including comments and import statements. It generates maps that look like this:
    Click here to see a map from above example (open)
    Cross-Section
    [​IMG]
    I think it is okay to post this here. I am not trying to advertise my plugin; I am just describing it because I want you guys to add to it.

    If anybody wants to make a new map type, post here or send me a message. I'll send you the .jar to compile against and test with. I'm not quite ready to release it to the public just yet. I will gladly answer any questions you have. With your permission, I would love to include your map type in my release version and give you credit for it!

    Thanks :)

    This is especially geared toward people from here:
    jtjj222
    codename_b
    escortkeel
    sd5
    thumbz
    kodfod
    nsarray
    calebbfmv
    I hope it's okay I just tagged all of you :p

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

    Widawizz22

    Wait you generate your own map, THAT FRICKEN AWESOME. I really did not follow the text, but if you can, can I generate a cool mountain/plains biome, (ofc I can). That would help. Yes send me the .jar file please :)
     
  3. Offline

    Courier

    This doesn't generate custom maps... although that is what we are working on here.

    This looks at a Minecraft world, and saves an image file based on it.

    All the pictures in my first spoiler are images it created from the same default world. Each pixel in the image represents a one-block column, 256 tall.

    Still want the .jar?
     
  4. Offline

    Widawizz22

    Yes, but yes, that would be cool to make a MineCraft world:p
     
Thread Status:
Not open for further replies.

Share This Page