Convert your bukkit world generator to a single player mod

Discussion in 'Resources' started by jtjj222, Jun 27, 2012.

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

    jtjj222

    Thanks to the mcp team, for all their great work.
    This tutorial assumes that you know how to use MCP.

    I will add instructions on how to add another map type option in the "create new world" dialogue, but for now, it will overwrite the normal or superflat options.
    I also want to add a part about using biomes.

    If your generator uses bukkit noise generators, add them to the /src/minecraft/net/minecraft/src folder in the root of your mcp folder. You can find them in the bukkit source code.
    http://jd.bukkit.org/doxygen/de/dc4/SimplexOctaveGenerator_8java_source.html
    I also have a (slow) voronoi nosie implementation based off of LibNoise for java:
    https://dl.dropbox.com/u/12637402/Voronoi.java


    Step 1: Based on whether or not you want to overwrite the normal, or superflat world type, open the class ChunkProviderGenrate, or ChunkProviderFlat, respectively. Replace the generate function's code with that of your generator. Note that you must remove any bukkit dependencies. To set blocks, use the following code:
    Code:
    par1ArrayOfByte[x << 11 | z << 7 | y] = (byte)BlockID;
    Your Block populators will need to be completely rewritten, although I want to find (or make) a way around this. Put any population code in the populate() function. Use the worldObj.setBlock(x,y,z,BlockID) function to change blocks. Make sure you call populate() from within your generate function!

    Using MCP, re-obfuscate and package, or test with the build in testing scripts.

    ????

    profit.

    I am sure you want an example, so if codename_B is alright with it, I will port over BananaCakeTown or another one of his many world generators.

    Stay tuned for biomes and adding another menu option!
     
    hawkfalcon and codename_B like this.
  2. Offline

    codename_B

    S'all yours.
     
  3. Offline

    jtjj222

    codename_B the chunkgenerator has been ported with 1 modification! (changing Material.x.getId() to Block.x.BlockID) I added a location class shown below, and replaced the code in xyzToByte() with
    Code:
        private int xyzToByte(int x, int y, int z) {
            return (x << 11 | z << 7 | y);
        }
    Other than that, porting is going easily, I hope the populators will be that easy!
    (note that I have 2 screens, that's why there is those black bars)
    bananacaketownchunkgenported.png
     
Thread Status:
Not open for further replies.

Share This Page