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

    codename_B

    BananaImageToMap
    turn any image into a world!

    Version 3.1
    Download Here
    Github


    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!

    Remember:
    You need to configure your bukkit.yml correctly and start with a fresh world before using this or it will not work.
    Code:
    worlds:
          worldname:
                 generator: BananaImageToMap
    
    Includes:
    • 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!
    Screenshots:
    [​IMG]

    [​IMG]

    Changelog:
    • 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

    IncendiaDrakon

    As far as I can tell, the heightmap is for controlling how the SURFACE looks. Anything below sea level is unaffected. The dev's custom populators aren't customizable currently.
     
  3. Offline

    V10lator

  4. Offline

    TAT

  5. Offline

    V10lator

    server is offline right now because of other problems. Give me a few minutes. :)

    //EDIT: Online again.
     
  6. Offline

    codename_B

    That "freaky border" is trees and stuff... it's called population lol

    I love that heightmap btw - I can haz? :D
     
  7. Offline

    V10lator

    Freaky population... But if you say it's okay it has to. :D

    Of course you can have the heightmap. :)
     
  8. Offline

    codename_B

    Well that's why forcing a render isn't advised :p the chunks don't get populated!

    Ideally you should let the world gen naturally as players explore.
     
  9. Offline

    V10lator

    Ah okay, good to know. :)
    BTW, I'm testing a few hightmaps and for see how thry look I always force a rendering.
    But:
    Code:
    2011-08-06 05:09:00 [WARNING] Failed to handle packet: java.lang.ClassCastException: org.bukkit.craftbukkit.block.CraftBlockState cannot be cast to org.bukkit.block.CreatureSpawner
    java.lang.ClassCastException: org.bukkit.craftbukkit.block.CraftBlockState cannot be cast to org.bukkit.block.CreatureSpawner
    	at com.ubempire.map.SpookyRoomPopulator.populate(SpookyRoomPopulator.java:94)
    	at com.ubempire.map.MetaPopulator.populate(MetaPopulator.java:31)
    	at net.minecraft.server.ChunkProviderServer.getChunkAt(ChunkProviderServer.java:190)
    	at net.minecraft.server.ChunkProviderServer.getChunkAt(ChunkProviderServer.java:107)
    	at net.minecraft.server.PlayerInstance.<init>(PlayerInstance.java:31)
    	at net.minecraft.server.PlayerManager.a(PlayerManager.java:45)
    	at net.minecraft.server.PlayerManager.movePlayer(PlayerManager.java:141)
    	at net.minecraft.server.ServerConfigurationManager.d(ServerConfigurationManager.java:138)
    	at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:363)
    	at net.minecraft.server.Packet10Flying.a(SourceFile:126)
    	at net.minecraft.server.NetworkManager.b(NetworkManager.java:226)
    	at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:85)
    	at net.minecraft.server.NetworkListenThread.a(SourceFile:105)
    	at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:451)
    	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:361)
    	at net.minecraft.server.ThreadServerApplication.run(SourceFile:422)
    Which had the effect to kick me out (Internal server error) but the renderer finished it's job and I could log on again, so no big thing. :)
     
  10. Offline

    V10lator

    I walked over a map and was somewhere on "creeper island":
    [​IMG]
    I walked on it because I wanted to have it rendered from BMR. Anyway, I get kicked from the server:
    Code:
    2011-08-07 09:42:47 [WARNING] Failed to handle packet: java.lang.ArrayIndexOutOfBoundsException: 4194304
    java.lang.ArrayIndexOutOfBoundsException: 4194304
    	at com.ubempire.map.HeightMap.get(HeightMap.java:64)
    	at com.ubempire.map.HeightMapGenerator.generate(HeightMapGenerator.java:92)
    	at org.bukkit.craftbukkit.generator.CustomChunkGenerator.getOrCreateChunk(CustomChunkGenerator.java:31)
    	at net.minecraft.server.ChunkProviderServer.getChunkAt(ChunkProviderServer.java:70)
    	at net.minecraft.server.PlayerInstance.<init>(PlayerInstance.java:31)
    	at net.minecraft.server.PlayerManager.a(PlayerManager.java:45)
    	at net.minecraft.server.PlayerManager.movePlayer(PlayerManager.java:141)
    	at net.minecraft.server.ServerConfigurationManager.d(ServerConfigurationManager.java:138)
    	at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:363)
    	at net.minecraft.server.Packet10Flying.a(SourceFile:126)
    	at net.minecraft.server.NetworkManager.b(NetworkManager.java:226)
    	at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:85)
    	at net.minecraft.server.NetworkListenThread.a(SourceFile:105)
    	at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:451)
    	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:361)
    	at net.minecraft.server.ThreadServerApplication.run(SourceFile:422)
    And now I can't logon again:
    Code:
    2011-08-07 09:43:26 [INFO] andysteph [/127.0.0.1:57366] logged in with entity id 559712 at ([world_wonder] 958.5, 63.0, -791.5)
    2011-08-07 09:43:28 [INFO] Disconnecting andysteph [/127.0.0.1:57366]: Internal server error
    2011-08-07 09:43:28 [WARNING] Failed to handle packet: java.lang.ArrayIndexOutOfBoundsException
    java.lang.ArrayIndexOutOfBoundsException
    :(

    Oh, and even if this is the wrong topic:
    Code:
    2011-08-07 09:46:26 [WARNING] Task of 'BMR' generated an exception
    java.lang.ArrayIndexOutOfBoundsException
    I think BMR can't render because BITM can't build the world?

    I hope you can fix this fast because I want to be able to login again before moving the player with some out-of-game editor first.

    //EDIT: P.S. Server restart doesn't help.
     
  11. Offline

    codename_B

    Hi - there's issues with non-square heightmaps and this plugin at the minute - your best bet is to make a considerable black border around the image.
     
  12. Offline

    V10lator

    A 1 px border is enough? Do I have to remove the world after that so it get's completly rebuildet?

    //EDIT: Instead of fixing the image, I fixed the code: http://paste.pocoo.org/show/454094/
    Please note that I didn't read into your codes for that so maybe this is a evil workaround. Also it's not tested very much (I was able to log on the server again, more isn't tested).
    Also I replaced every getFace() with getRelative() because getFace() will be deprecated soon. :)

    //EDIT²: Bugs or features:
    Defective shroom:
    [​IMG]
    Lava tree:
    [​IMG]

    //EDIT³: The workaround is evil! http://minecraft.trihs.de:8107/world_wonder
     
  13. Offline

    codename_B

    The lava tree shouldn't be happening - but the defective shroom is intentional :)
     
  14. Offline

    Monarkos

    Try Do World Of Warcraft Full map to see how looks like! ;D
     
  15. Offline

    Lithium2142

    I was about to start developing my own plugin for something very similar :p... Almost the same... I'm glad I searched first. I wanted to create a map of earth from satellite and elevation maps :p. I decided to just do Italy for now... I thought it would be easier. Here is the elevation data image for Italy, the second pic is the color to elevation data (I haven't made a composite of the satellite images yet though...)

    Italy elevation map (caution 17 mb): http://dl.dropbox.com/u/30017271/Italy.png
    ^ Made from 30 screenshots -_- took FOREVER
    Color to elevation pic: http://dl.dropbox.com/u/30017271/elevationdata.png

    The way I was going to do it was use 1 block per pixel. One image for the height map, one for block type. (I might just use the elevation map for block type too...) Anyways, if it is possible for this map to be created from your plug in, I would be delighted :D (Its not a black and white height map though and I think there are shadows :confused: -any way to remove those?).

    If you need any help generating maps/images to go along with your plugin I could do that... I want to help anyway I can.

    I'm pretty much a beginner programmer and the most I have done is a 3D pool game in Java and I'm only 17. I'm new to contributing any programming skills I have to society and Bukkit :p.

    Ok well I'm going to try messing with your plugin and my map... if you have any luck just send me a message.
    Oh btw anyone is free to use that map image as much as they want.

    -Lith

    EDIT: The links were changing for some reason to some google links (That didn't work) so I kept editing until somehow they didn't change...
     
  16. Offline

    HateMeh

    codename are you still going to add the option for a color to block conversion ?

    if so a tiny snippet of code that takes rgb values and convert them to blocks.

    its a bit old so it doesnt support wool colors

    just use convert(r,g,b) and it returns a block int

    Code:
    public class RGBtoBlock
    {
        /* Colors */
        static java.awt.Color Color[] =
        {
            new java.awt.Color(123,123,123),
            new java.awt.Color(124,177,74),
            new java.awt.Color(130,86,53),
            new java.awt.Color(77,77,77),
            new java.awt.Color(164,124,68),
            new java.awt.Color(204,196,132),
            new java.awt.Color(164,148,147),
            new java.awt.Color(163,123,67),
            new java.awt.Color(26,122,26),
            new java.awt.Color(149,149,18),
            new java.awt.Color(193,193,193),
            new java.awt.Color(255,248,73),
            new java.awt.Color(243,243,243),
            new java.awt.Color(145,145,145),
            new java.awt.Color(142,58,37),
            new java.awt.Color(7,7,11),
            new java.awt.Color(110,224,219),
            new java.awt.Color(105,63,34),
            new java.awt.Color(97,152,255),
            new java.awt.Color(255,255,255),
            new java.awt.Color(135,139,157),
            new java.awt.Color(255,166,75),
            new java.awt.Color(124,12,12)
        };
    
        /* Block IDs */
        static int Block[] =
        {
            1,
            2,
            3,
            4,
            5,
            12,
            13,
            17,
            18,
            19,
            35,
            41,
            42,
            43,
            45,
            49,
            57,
            60,
            79,
            35,
            82,
            86,
            87
        };
    
        /* Store the Differences temporary */
        static double Difference[] = new double[Color.length];
    
        public static int convert(int r, int g, int b)
        {
    
            /* Calculate all Differences */
            for(int i = 0; i < Color.length; i++)
            {
                /* Use Math.abs because sqrt wont work with negatives */
                Difference[i] = Math.sqrt(Math.abs((r-Color[i].getRed())^2) + Math.abs((g-Color[i].getGreen())^2) + Math.abs((b-Color[i].getBlue())^2));
            }
    
            /* Initialite it with MAX_VALUE to make sure,
             * that the first Difference is smaller
             */
            double minDifference = Double.MAX_VALUE;
    
            /* Store the Block with the lowest Difference */
            int minBlock = 0;
    
            for(int i = 0; i < Difference.length; i++)
            {
                /* Block with lower Difference found */
                if(Difference[i] < minDifference)
                {
                    minBlock = Block[i];
                    minDifference = Difference[i];
                }
            }
            return minBlock;
        }
    } 
     
    codename_B likes this.
  17. Offline

    codename_B

    I might add that now yep :p
     
  18. Offline

    Marcos Cosmos

    I was wondering, could a similar method be used from this for populators rather than generators? Like, take an images, (or more likely set of images) and use that to represent objects (like trees) for populating within configured patterns? :3 coz that would be amazingly helpful... :p
     
  19. Offline

    Theiket

    @codename_B This is the error I'm getting on the current version of this: 174 recipes
    27 achievements
    19:14:45 [INFO] Starting minecraft server version 1.0.1
    19:14:45 [WARNING] **** NOT ENOUGH RAM!
    19:14:45 [WARNING] To start the server with more ram, launch it as "java -Xmx102
    4M -Xms1024M -jar minecraft_server.jar"
    19:14:45 [INFO] Loading properties
    19:14:45 [INFO] Starting Minecraft server on 5.35.95.45:25565
    19:14:45 [INFO] This server is running Craftbukkit version git-Bukkit-1.0.1-R1-b
    1597jnks (MC: 1.0.1) (Implementing API version 1.0.1-R1)
    19:14:45 [SEVERE] mapping values are not allowed here
    in "<string>", line 34, column 23:
    generator: BananaImageToMap
    ^

    19:14:45 [SEVERE] at org.yaml.snakeyaml.scanner.ScannerImpl.fetchValue(Sca
    nnerImpl.java:733)
    19:14:45 [SEVERE] at org.yaml.snakeyaml.scanner.ScannerImpl.fetchMoreToken
    s(ScannerImpl.java:305)
    19:14:45 [SEVERE] at org.yaml.snakeyaml.scanner.ScannerImpl.checkToken(Sca
    nnerImpl.java:179)
    19:14:45 [SEVERE] at org.yaml.snakeyaml.parser.ParserImpl$ParseBlockMappin
    gKey.produce(ParserImpl.java:563)
    19:14:45 [SEVERE] at org.yaml.snakeyaml.parser.ParserImpl.peekEvent(Parser
    Impl.java:161)
    19:14:45 [SEVERE] at org.yaml.snakeyaml.parser.ParserImpl.checkEvent(Parse
    rImpl.java:146)
    19:14:45 [SEVERE] at org.yaml.snakeyaml.composer.Composer.composeMappingNo
    de(Composer.java:230)
    19:14:45 [SEVERE] at org.yaml.snakeyaml.composer.Composer.composeNode(Comp
    oser.java:160)
    19:14:45 [SEVERE] at org.yaml.snakeyaml.composer.Composer.composeMappingNo
    de(Composer.java:237)
    19:14:45 [SEVERE] at org.yaml.snakeyaml.composer.Composer.composeNode(Comp
    oser.java:160)
    19:14:45 [SEVERE] at org.yaml.snakeyaml.composer.Composer.composeDocument(
    Composer.java:123)
    19:14:45 [SEVERE] at org.yaml.snakeyaml.composer.Composer.getSingleNode(Co
    mposer.java:106)
    19:14:45 [SEVERE] at org.yaml.snakeyaml.constructor.BaseConstructor.getSin
    gleData(BaseConstructor.java:121)
    19:14:45 [SEVERE] at org.yaml.snakeyaml.Yaml.loadFromReader(Yaml.java:480)

    19:14:45 [SEVERE] at org.yaml.snakeyaml.Yaml.load(Yaml.java:399)
    19:14:45 [SEVERE] at org.bukkit.configuration.file.YamlConfiguration.loadF
    romString(YamlConfiguration.java:59)
    19:14:45 [SEVERE] at org.bukkit.configuration.file.FileConfiguration.load(
    FileConfiguration.java:143)
    19:14:45 [SEVERE] at org.bukkit.configuration.file.FileConfiguration.load(
    FileConfiguration.java:109)
    19:14:45 [SEVERE] at org.bukkit.configuration.file.YamlConfiguration.loadC
    onfiguration(YamlConfiguration.java:235)
    19:14:45 [SEVERE] at org.bukkit.craftbukkit.CraftServer.<init>(CraftServer
    .java:122)
    19:14:45 [SEVERE] at net.minecraft.server.ServerConfigurationManager.<init
    >(ServerConfigurationManager.java:52)
    19:14:45 [SEVERE] at net.minecraft.server.MinecraftServer.init(MinecraftSe
    rver.java:145)
    19:14:45 [SEVERE] at net.minecraft.server.MinecraftServer.run(MinecraftSer
    ver.java:399)
    19:14:45 [SEVERE] at net.minecraft.server.ThreadServerApplication.run(Sour
    ceFile:457)
    19:14:45 [SEVERE] Unexpected exception
    mapping values are not allowed here
    in "<string>", line 34, column 23:
    generator: BananaImageToMap
    ^

    at org.yaml.snakeyaml.scanner.ScannerImpl.fetchValue(ScannerImpl.java:73
    3)
    at org.yaml.snakeyaml.scanner.ScannerImpl.fetchMoreTokens(ScannerImpl.ja
    va:305)
    at org.yaml.snakeyaml.scanner.ScannerImpl.checkToken(ScannerImpl.java:17
    9)
    at org.yaml.snakeyaml.parser.ParserImpl$ParseBlockMappingKey.produce(Par
    serImpl.java:563)
    at org.yaml.snakeyaml.parser.ParserImpl.peekEvent(ParserImpl.java:161)
    at org.yaml.snakeyaml.parser.ParserImpl.checkEvent(ParserImpl.java:146)
    at org.yaml.snakeyaml.composer.Composer.composeMappingNode(Composer.java
    :230)
    at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:160)
    at org.yaml.snakeyaml.composer.Composer.composeMappingNode(Composer.java
    :237)
    at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:160)
    at org.yaml.snakeyaml.composer.Composer.composeDocument(Composer.java:12
    3)
    at org.yaml.snakeyaml.composer.Composer.getSingleNode(Composer.java:106)

    at org.yaml.snakeyaml.constructor.BaseConstructor.getSingleData(BaseCons
    tructor.java:121)
    at org.yaml.snakeyaml.Yaml.loadFromReader(Yaml.java:480)
    at org.yaml.snakeyaml.Yaml.load(Yaml.java:399)
    at org.bukkit.configuration.file.YamlConfiguration.loadFromString(YamlCo
    nfiguration.java:59)
    at org.bukkit.configuration.file.FileConfiguration.load(FileConfiguratio
    n.java:143)
    at org.bukkit.configuration.file.FileConfiguration.load(FileConfiguratio
    n.java:109)
    at org.bukkit.configuration.file.YamlConfiguration.loadConfiguration(Yam
    lConfiguration.java:235)
    at org.bukkit.craftbukkit.CraftServer.<init>(CraftServer.java:122)
    at net.minecraft.server.ServerConfigurationManager.<init>(ServerConfigur
    ationManager.java:52)
    at net.minecraft.server.MinecraftServer.init(MinecraftServer.java:145)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:399)
    at net.minecraft.server.ThreadServerApplication.run(SourceFile:457)
    >
     
  20. Offline

    nightpool

    You screwed up your bukkit.yml, either with tabs or by just putting the generator declaration in the wrong place. Try resetting your bukkit.yml to what it was before and use Multiverse to handle the custom generator instead. It's a lot easier from my point of view.

    Multiverse can be found on bukkit dev: http://dev.bukkit.org/server-mods/multiverse-core/

    You can find documentation on how to use BananaImageToMap with MV on Github:
    https://github.com/codename-B/BananaImageToMap

    EDIT: It appears that the version in the OP isn't the newest, and doesn't have the features that the newest one does (config-less setup and the like) Maybe @codename_B could fix that?
     
  21. Offline

    md_5

    @codename_B
    As you know this is now inactive due to not being maintained if it is on Bukkitdev or you wish to revive it tag me.
     
  22. Offline

    Qweas

    This is amazing :') TOO AMAZING HOW IS THIS POSSIBLE /me kicks seat [cake]
     
  23. Offline

    Spiritwind

    Does this still work?
     
  24. Offline

    nightpool

    IIRC, this version is not up-to-date, if you're feeling adventurous, the codes on github at https://github.com/codename-B/BananaImageToMap or you could bug codename b for a compiled copy.

    it hasn't been updated in a while, but should still work. I'm not positive if it handles the new world hight gracefully...
     
  25. Offline

    brord

    Can anyone upload the .jar? the download link doesnt work anymore :(
    Doesnt matter that its outdated
     
  26. Offline

    olha2

    how do the mean turn a image into a world?
     
  27. Offline

    V10lator

    brord olha2
    Have a look at Dynmap instead.
     
  28. Offline

    nightpool

    Dynmap is like the inverse of what this plugin does...
     
  29. Offline

    V10lator

    [quote uid=82967 name="nightpool" post=1136623]Dynmap is like the inverse of what this plugin does...[/quote]
    Sorry, In my mind I mixed up BananaImageToMap and BananaMapRenderer. ;)

    Anyway, as codename_B provided a link to github I updated it to the newest CB version. Binary + Source: <Edit by Moderator: Redacted mediafire url>
    Diff:

    Show Spoiler
    Code:
    diff -Nru src/com/ubempire/map/DesertPopulator.java src.new/com/ubempire/map/DesertPopulator.java
    --- src/com/ubempire/map/DesertPopulator.java2012-05-27 09:51:02.413845060 +0200
    +++ src.new/com/ubempire/map/DesertPopulator.java2012-05-27 09:54:08.544466511 +0200
    @@ -22,12 +22,12 @@
                     int tz = (chunk.getZ() << 4) + z;
                     int y = world.getHighestBlockYAt(tx, tz);
                     
    -                Block block = chunk.getBlock(x, y, z).getFace(BlockFace.DOWN);
    +                Block block = chunk.getBlock(x, y, z).getRelative(BlockFace.DOWN);
                     if (block.getBiome() != Biome.DESERT) continue;
                     
                     // Set top few layers of grass/dirt to sand
                     for (int i = 0; i < 5; ++i) {
    -                    Block b2 = block.getFace(BlockFace.DOWN, i);
    +                    Block b2 = block.getRelative(BlockFace.DOWN, i);
                         if (b2.getType() == Material.GRASS || b2.getType() == Material.DIRT) {
                             b2.setType(Material.SAND);
                         }
    @@ -37,8 +37,8 @@
                     if (block.getType() == Material.SAND) {
                         if (random.nextInt(20) == 0) {
                             // Make sure it's surrounded by air
    -                        Block base = block.getFace(BlockFace.UP);
    -                        if (base.getTypeId() == 0 && base.getFace(BlockFace.NORTH).getTypeId() == 0 && base.getFace(BlockFace.EAST).getTypeId() == 0 && base.getFace(BlockFace.SOUTH).getTypeId() == 0 & base.getFace(BlockFace.WEST).getTypeId() == 0) {
    +                        Block base = block.getRelative(BlockFace.UP);
    +                        if (base.getTypeId() == 0 && base.getRelative(BlockFace.NORTH).getTypeId() == 0 && base.getRelative(BlockFace.EAST).getTypeId() == 0 && base.getRelative(BlockFace.SOUTH).getTypeId() == 0 & base.getRelative(BlockFace.WEST).getTypeId() == 0) {
                                 generateCactus(base, random.nextInt(4));
                             }
                         }
    @@ -49,7 +49,7 @@
     
         private void generateCactus(Block block, int height) {
             for (int i = 0; i < height; ++i) {
    -            block.getFace(BlockFace.UP, i).setType(Material.CACTUS);
    +            block.getRelative(BlockFace.UP, i).setType(Material.CACTUS);
             }
         }
         
    diff -Nru src/com/ubempire/map/DungeonPopulator.java src.new/com/ubempire/map/DungeonPopulator.java
    --- src/com/ubempire/map/DungeonPopulator.java2012-05-27 09:51:02.413845060 +0200
    +++ src.new/com/ubempire/map/DungeonPopulator.java2012-05-27 09:55:14.824838739 +0200
    @@ -7,10 +7,10 @@
     import org.bukkit.World;
     import org.bukkit.block.Block;
     import org.bukkit.block.Chest;
    +import org.bukkit.entity.EntityType;
     import org.bukkit.generator.BlockPopulator;
     import org.bukkit.inventory.ItemStack;
     import org.bukkit.block.CreatureSpawner;
    -import org.bukkit.entity.CreatureType;
     import org.bukkit.inventory.Inventory;
     import org.bukkit.util.noise.SimplexNoiseGenerator;
     
    @@ -121,12 +121,12 @@
         }
     
         private void placeSpawner(Block block) {
    -        CreatureType[] types = new CreatureType[]{
    -            CreatureType.SKELETON, CreatureType.ZOMBIE, CreatureType.CREEPER, CreatureType.SPIDER
    +        EntityType[] types = new EntityType[]{
    +        EntityType.SKELETON, EntityType.ZOMBIE, EntityType.CREEPER, EntityType.SPIDER
             };
             
             block.setType(Material.MOB_SPAWNER);
    -        ((CreatureSpawner) block.getState()).setCreatureType(types[random.nextInt(types.length)]);
    +        ((CreatureSpawner) block.getState()).setSpawnedType(types[random.nextInt(types.length)]);
         }
         
         private void placeChest(Block block) {
    diff -Nru src/com/ubempire/map/FlowerPopulator.java src.new/com/ubempire/map/FlowerPopulator.java
    --- src/com/ubempire/map/FlowerPopulator.java2012-05-27 09:51:02.413845060 +0200
    +++ src.new/com/ubempire/map/FlowerPopulator.java2012-05-27 09:55:38.866885521 +0200
    @@ -23,7 +23,7 @@
                     int y = world.getHighestBlockYAt(cx, cz);
     
                     Block block = chunk.getBlock(x, y, z);
    -                if (block.getType() == Material.AIR && block.getFace(BlockFace.DOWN).getType() == Material.GRASS) {
    +                if (block.getType() == Material.AIR && block.getRelative(BlockFace.DOWN).getType() == Material.GRASS) {
                         if (block.getBiome() == Biome.PLAINS) {
                             int n = random.nextInt(64);
                             if (n < 1) {
    diff -Nru src/com/ubempire/map/MushroomPopulator.java src.new/com/ubempire/map/MushroomPopulator.java
    --- src/com/ubempire/map/MushroomPopulator.java2012-05-27 09:51:02.413845060 +0200
    +++ src.new/com/ubempire/map/MushroomPopulator.java2012-05-27 09:55:58.075123941 +0200
    @@ -26,13 +26,13 @@
             if (block.getBiome() != Biome.TAIGA && block.getBiome() != Biome.TUNDRA) {
                 return;
             }
    -        if (block.getFace(BlockFace.DOWN).getType() != Material.GRASS) {
    +        if (block.getRelative(BlockFace.DOWN).getType() != Material.GRASS) {
                 return;
             }
             
             int size = 2 + random.nextInt(4);
             for (int i = 0; i <= size + 1; i++) {
    -            Block mushroom = block.getFace(BlockFace.UP, i);
    +            Block mushroom = block.getRelative(BlockFace.UP, i);
                 mushroom.setType(Material.LOG);
                 mushroom.setData((byte) 2);
                 
    diff -Nru src/com/ubempire/map/SnowPopulator.java src.new/com/ubempire/map/SnowPopulator.java
    --- src/com/ubempire/map/SnowPopulator.java2012-05-27 09:51:02.413845060 +0200
    +++ src.new/com/ubempire/map/SnowPopulator.java2012-05-27 09:56:08.998690831 +0200
    @@ -33,7 +33,7 @@
                         } else if (block.getType() == Material.LAVA || block.getType() == Material.STATIONARY_LAVA) {
                             break;
                         } else if (block.getType() != Material.AIR) {
    -                        block.getFace(BlockFace.UP).setType(Material.SNOW);
    +                        block.getRelative(BlockFace.UP).setType(Material.SNOW);
                             if (block.getType() == Material.DIRT)
                             block.setType(Material.GRASS);
                             break;
    diff -Nru src/com/ubempire/map/SpookyRoomPopulator.java src.new/com/ubempire/map/SpookyRoomPopulator.java
    --- src/com/ubempire/map/SpookyRoomPopulator.java2012-05-27 09:51:02.413845060 +0200
    +++ src.new/com/ubempire/map/SpookyRoomPopulator.java2012-05-27 09:57:14.251103540 +0200
    @@ -7,7 +7,7 @@
     import org.bukkit.block.Block;
     import org.bukkit.block.BlockFace;
     import org.bukkit.block.CreatureSpawner;
    -import org.bukkit.entity.CreatureType;
    +import org.bukkit.entity.EntityType;
     import org.bukkit.generator.BlockPopulator;
     
     /**
    @@ -93,13 +93,13 @@
                         block.setType(Material.MOB_SPAWNER);
                         CreatureSpawner spawner = (CreatureSpawner) block.getState();
                         if (floor <= 2) {
    -                        spawner.setCreatureType(CreatureType.ZOMBIE);
    +                        spawner.setSpawnedType(EntityType.ZOMBIE);
                         } else if (floor >= 3 && floor <= 7) {
    -                        spawner.setCreatureType(CreatureType.SPIDER);
    +                        spawner.setSpawnedType(EntityType.SPIDER);
                         } else if (floor >= 8 && floor <= 10) {
    -                        spawner.setCreatureType(CreatureType.SKELETON);
    +                        spawner.setSpawnedType(EntityType.SKELETON);
                         } else {
    -                        spawner.setCreatureType(CreatureType.GHAST);
    +                        spawner.setSpawnedType(EntityType.GHAST);
                         }
                     } else {
                         block.setType(matFloor);
    @@ -117,7 +117,7 @@
                 for (int x = minX; x <= maxX; x++) {
                     for (int y = minY; y <= maxY; y++) {
                         Block block = world.getBlockAt(x, y, z);
    -                    if (block.getFace(BlockFace.DOWN).getType() != Material.AIR && block.getFace(BlockFace.DOWN).getType() != matDecor) {
    +                    if (block.getRelative(BlockFace.DOWN).getType() != Material.AIR && block.getRelative(BlockFace.DOWN).getType() != matDecor) {
                             int rand = random.nextInt(10);
                             if (rand <= 6) {
                                 world.getBlockAt(x, y, z).setType(matFloor);
    diff -Nru src/plugin.yml src.new/plugin.yml
    --- src/plugin.yml2012-05-27 09:51:02.414845021 +0200
    +++ src.new/plugin.yml2012-05-27 09:53:10.545765818 +0200
    @@ -1,6 +1,6 @@
     name: BananaImageToMap
    -version: 3.1
    +version: 3.1.1
     description: Generates a world based on an image heightmap complete with custom map features
    -authors: ['codename_B', 'SpaceManiac']
    +authors: ['codename_B', 'SpaceManiac', 'V10lator']
     main: com.ubempire.map.ImageToMapPlugin
     load: startup
    


    Please note that this is untested and that I won't give support for it.
     
    Last edited by a moderator: Nov 27, 2016
  30. Thanks for updating the code. I'm new to minecraft and bukkit and was wondering is there a way to increase the max height for the BananaImageToMap code? I've modified the code so that it imports up to 256. Is there a way to increase the max height to say 512? I am working on importing my Digital Middle Earth model into Minecraft so that we can create the Mines of Moria in Minecraft. Right now the model is 16386x16386 and is about 1/4 scale. Here are some test images of the falls of Rauros. I am also interested in how I can use another image with color assignments to assign biomes to my world map. rauros.jpg rauros2.jpg
     

    Attached Files:

  31. Offline

    Techy4198

    slight problem here, I compiled the github source myself, fixing all errors, but the world generates like this:
    2013-05-11_14.27.40.png
    Note: the squids can still swim in what should be water, and I can still collide with what should be solid blocks, but it is invisible.

    edit: I believe it to be something with one or more of the populators.
    edit2: only appears to happen in water (water surrounded by forest shows as 'forest' biome still, so it is an issue with the part of the image reading code that generates water.
    edit3: if I regenerate good chunks with //regen they are fine, but 'broken' chunks regenerate completely empty.
     

Share This Page