Inactive [INACTIVE][WGEN] BananaImageToMap v3.1 - now with proper ores! [1000]

Discussion in 'Inactive/Unsupported Plugins' started by codename_B, Jun 22, 2011.

  1. Offline


    turn any image into a world!

    Version 3.1
    Download Here

    Configuration options:
    • image to use
    This plugin allows you to turn any image into a world - this means it can be generated with, for example, BananaMapRender, and do stuff like this!

    That's right, heightmaps translated to maps in-game, for zero effort, just configure the worldname and the image and you're away!

    You need to configure your bukkit.yml correctly and start with a fresh world before using this or it will not work.
                 generator: BananaImageToMap
    • CavePopulator
    • DesertPopulator
    • DungeonPopulator
    • FlowerPopulator
    • LakePopulator
    • Mushroom Populator
    • QuarryPopulator
    • Ruins Populator - thanks @Nightgunner5
    • Snow Populator
    • SpookyRoomPopulator
    • TorchPopulator - thanks @Nightgunner5
    • Tree Populator - thanks @heldplayer and @SpaceManiac
    • Ores! - thanks @Notch
    Fun extras:
    • Will generate a heightmap image if you don't specify any!


    • v1 - released awesome plugins
    • v2 - added block populator for ores, thanks @Pandarr also added awesome cavegen, thanks me!
    • v3 - added fixed populators and cleaned up code, thanks @SpaceManiac (no extra configuration options this time - sorry) :p
    • v3.1 - re-added caves (minus the memory leak) - added proper ore population :D
    glen3b, hammale, TAT and 9 others like this.
  2. Offline


    Just input an image of a single grey.
  3. Offline


    if someone makes a map out of pron i will love you forever
  4. Offline


    Does this have to be generated using a single world server only?
  5. Offline


    No, it just adds another world to a single world/multiworld server.
  6. Offline


    @codename_B : HOLY SHI-

    Title CB# is wrong though. Must be latest RB. :)
  7. Offline


    Getting ahead of myself is all :p changed back
  8. Offline


    What happens to chunks outside of the imported image's area? Are they just generated normally?

  9. Offline


    No, they're water 5 levels deep with stone to bedrock after that.
  10. Offline



    umadbro? Just kidding, I love this plugin. :)

    Terrain kept generating because I renamed noisy to world, as MultiVerse threw me an error on world teleport.
  11. Offline


    That's.... disturbing.... :eek:
    rockxz2135 likes this.
  12. Offline


    Both hilarious and genius - but yes if you change the world name, you lose the custom generator.
  13. Offline


  14. Offline


    Nice one!
    Can you also add support for a color.jpg where we can store the colors that the most top block of the world should have?
  15. Offline



    Some screenshots of how the dungeon generator is looking

    If you write me a function to convert RGB into block values, I will add this.

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


    I've got some code lying around in my dev-folder, which can convert an image to woolcolors. But this isn't finished yet, and it's not java, but C++ ;)
  17. Offline



    Some screenshots of the cave generation system.

    Hey, it's just integers to integers.

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


    Yeah for some reason, i'm unable to create the image/find it.
    Here's my config:
    worldname: rook
    directory: C:\Documents and Settings\Steven\Desktop\Minecraft server\plugins\rook.jpg

    I'll generate the map in the server, once it's complete i'll stick in into SSP and use /fly to try to find out where it's at. But it just seems to generate a new notch world.
  19. Offline


    It generates a completely different world, with the name of "rook".
    It will only generate the chunks that are loaded while the worldgenerator is active, so if you use, for example, SSP to play on the map, of course it will generate a notchWorld!
  20. Offline


    Yeah, but when I put an image of the earth in there, it should see which is grass and which is water and which is stone at least
  21. Offline


    I'm doing the heightmap from shading, so it would have to be black for water and white for land (standard heightmap format really)

    Have a play around

    ps. version 2 will be out as soon as @Pandarr is done his populator :D
  22. Offline


    So outside of the image the world generates normally?
    How much area does the picture generate?
    I'm assuming 1 block per pixel?
  23. Offline

    Jeff Miller

    Pure. Gene. E. Us. Seriously. Look at my face: :eek: does it not look serious? Of course it does.

    I am going to use Tektonic to make 2D map jpgs of my current worlds and then import them with this. It will be like bizarro world except all made out of dirt. All my houses and trees will be height mapped dirt piles.

    Ooh! Then I could repeat the process on that output for even more bizarre images of images of worlds made into a map. I should probably put a limit on my recursion before I run out of heap space.
  24. Offline


    Any chance you could add support for a color map too? :D
  25. Offline


    outside the image generates simply flat water with stone.

    That would look absolutely terrible in-game.

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


    @codename_B no it would not, in fact it's been suggested like 8 times, to make a map that has different color values to define the top block type. If he's talking about a color map like using colors to define the heights and stuff just the lighter the color the higher and vis-versa
  27. Offline


    Are you still interested in something like that?
  28. Offline


    Oh, if he means a color map - then that is already supported. Why not try it out first before judging? Just because other people haven't used a color map doesn't mean that this doesn't support it.

    @Everyone - v2 is out

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


    If you wanted to allow any arbitrary block type, you could do something super simple like this:

    Block getBlockFromColor(int color) {
      Block b = new Block();
      b.setType(color & 0xFFFF);
      b.setData((color >> 16) & 0xFF);
      return b;
    Then the block type ID is specified by the green & blue components of the color, and block data is specified by the red component.

    If you actually want to match the block's appearance to be as close to the color of the pixel, then it's a little more complex. Check out this code for an example method (from the mxImgImport plugin)
  30. Offline


    Unless someone actually writes me a function that I can plug in a color and get out a blockID I'm not actually going to add it XD

    Those are my terms :p
  31. Offline


    I wrote you one function already, the simple method. Here's the code copied & pasted out of the other plugin into a function for you as well. Note you cannot just use block ID, you need both ID and Data...since Data is what specifies the color for wool.

    This code only uses a limited set of materials, if people want more, you just need to add it to the list (the long lines of pBlockMap.put... etc)

    class MatM
        MatM(Material m, int s)
            mat = m;
            ss = s;
        Material mat;
        int ss;
    class RGB
        RGB(Color a)
            r = a.getRed();
            g = a.getGreen();
            b = a.getBlue();
        public RGB(int red, int green, int blue) {
            // TODO Auto-generated constructor stub
            r = red;
            g = green;
            b = blue;
        int getRed(){
            return r;
        int getGreen(){
            return g;
        int getBlue(){
            return b;
        int r;
        int g;
        int b;
    float ColorDistance(RGB a, RGB b)
        int most = 0;
        if (a.getRed() > a.getGreen() && a.getRed()>a.getBlue())
            most = 1;
        else if (a.getGreen() > a.getRed() && a.getGreen()>a.getBlue())
            most = 2;
        else    most = 3;
        RGB c = new RGB(b.getRed()-a.getRed(),b.getGreen()-a.getGreen(), b.getBlue()-a.getBlue());
        float clen = c.getRed()*c.getRed()*(most ==1?1:2)+c.getGreen()*c.getGreen()*(most ==2?1:2)+c.getBlue()*c.getBlue()*(most ==3?1:2);
        return clen;
    public Block getBlockFromColor(int pixel) {
        HashMap<RGB, MatM> pBlockMap = new HashMap<RGB, MatM>();
        pBlockMap.put(new RGB(160,160,160), new MatM(Material.STONE, 0));
        pBlockMap.put(new RGB(188,152,98), new MatM(Material.WOOD, 0));
        pBlockMap.put(new RGB(255,255,255), new MatM(Material.WOOL, 0));
        pBlockMap.put(new RGB(214,207,154),new MatM( Material.SANDSTONE, 0));
        pBlockMap.put(new RGB(196,86,205), new MatM(Material.WOOL,1));
        pBlockMap.put(new RGB(114,147,215), new MatM(Material.WOOL, 2));
        pBlockMap.put(new RGB(33,200,214), new MatM(Material.WOOL, 3));
        pBlockMap.put(new RGB(210,210,14),new MatM( Material.WOOL, 4));
        pBlockMap.put(new RGB(100,230,0),new MatM( Material.WOOL, 5));
        pBlockMap.put(new RGB(224,155,173),new MatM( Material.WOOL, 6));
        pBlockMap.put(new RGB(71,71,71),new MatM( Material.WOOL, 7));
        pBlockMap.put(new RGB(173,180,180),new MatM( Material.WOOL, 8));
        pBlockMap.put(new RGB(43,129,166),new MatM( Material.WOOL, 9));
        pBlockMap.put(new RGB(90,0,90),new MatM( Material.WOOL, 10));
        pBlockMap.put(new RGB(40,53,161),new MatM( Material.WOOL, 11));
        pBlockMap.put(new RGB(93,56,30),new MatM( Material.WOOL, 12));
        pBlockMap.put(new RGB(57,78,25),new MatM( Material.WOOL, 13));
        pBlockMap.put(new RGB(250,0,0),new MatM( Material.WOOL, 14));
        pBlockMap.put(new RGB(0,0,0),new MatM( Material.WOOL, 15));
        pBlockMap.put(new RGB(150,125,70),new MatM( Material.LOG, 0));
        pBlockMap.put(new RGB(57,46,28),new MatM( Material.LOG, 1));
        pBlockMap.put(new RGB(255,251,93),new MatM( Material.GOLD_BLOCK, 0));
        pBlockMap.put(new RGB(213,213,213),new MatM( Material.IRON_BLOCK, 0));
        pBlockMap.put(new RGB(176,176,176),new MatM( Material.DOUBLE_STEP, 0));
        pBlockMap.put(new RGB(46,46,61),new MatM( Material.OBSIDIAN, 0));
        pBlockMap.put(new RGB(120,108,30), new MatM(Material.CHEST, 0));
        //pBlockMap.put(new RGB(35,80,35),new MatM( Material.MOSSY_COBBLESTONE, 0));
        pBlockMap.put(new RGB(160,240,240),new MatM( Material.DIAMOND_BLOCK, 0));
    //        pBlockMap.put(new RGB(100,56,56),new MatM( Material.NETHERRACK, 0));
    //    pBlockMap.put(new RGB(200,0,200),new MatM( Material.GLOWSTONE, 0));
        int alpha = (pixel >> 24) & 0xff;
        int red = (pixel >> 16) & 0xff;
        int green = (pixel >> 8) & 0xff;
        int blue = (pixel) & 0xff;
        Block b = new Block();
        RGB c = new RGB(red, green, blue);
        Set<Entry<RGB, MatM>> pSet = pBlockMap.entrySet();
        Iterator<Entry<RGB, MatM>> It = pSet.iterator();
        float bestDist = 100000000;
        RGB col = null;
            Entry<RGB, MatM> Current =;
            float dist = ColorDistance(c,(Current.getKey()));
            if (dist < bestDist)
                bestDist = dist;
                col = Current.getKey();
        m_pUndoMap.put(curpos,new MatM(curpos.getBlock().getType(), curpos.getBlock().getData()));
        return b;

Share This Page