[WGEN/MECH] blueGen 0.1 - A new, crazy world generator! [1.0.1-R1]

Discussion in 'Inactive/Unsupported Plugins' started by BlueCactus, Jan 9, 2012.

?

Would you rather:

  1. Different types of trees?

    3 vote(s)
    75.0%
  2. Or snowy areas?

    1 vote(s)
    25.0%
  1. Offline

    BlueCactus

    blueGen 0.1 - Developed by BlueCactus​
    ------------------------------------------------------------
    blueGen is a new world generator that takes a turn on the random side. It features strange near-eternal forests and a dangerous "core".​
    (This plugin will show up in your log as "aWorldBlender")
    Download it here:
    Features:
    Generates a world with a surface area with trees, sand, grass and water,​
    a stone area with ores, and a core, plus more!​
    Changelog:
    Everything! (First version!)​
    Picture (featuring the derpy trees):[​IMG]
     
  2. Offline

    DrAgonmoray

    @BlueCactus
    It thinks its name is aWorldBlender because that's what it says in your plugin.yml
    ..As for the generating part, idk because I can't see your source code.
     
  3. Offline

    BlueCactus

    I know why its calling it aWorldBlender. I'm just telling people so they know what it is.
    Want me to send you the source code? I'd be glad to see a solution to this problem, its very annoying.
     
  4. Offline

    DrAgonmoray

    Oh, ok.
    And go right ahead. I'll see if I can find the issue.
     
  5. Offline

    codename_B

    A nice start to world generation, why not have a look at some of the more advanced things now? I'd love to see another WGEN fan progress
     
  6. Offline

    BlueCactus

    Because I epic fail with the BlockPopulator.
    Those derpy trees are made by the ChunkGenerator.
     
  7. Offline

    codename_B

    BlockPopulator is probably easier than ChunkGenerator cos you don't have to worry about staying with your chunk :p
     
  8. Offline

    BlueCactus

    :eek: Now I know why the generator was failing when I was trying to make trees with branched branched leaves with ChunkGenerator. I was doing place a block at X, Z at X+1, Z at X-1, Z, at X, Z+1, at X, Z-1. Inevitably these were going off the chunk.

    Do you see anything wrong with my BlockPopulator?

    BlockPopulator (open)

    public class treeplacer extends BlockPopulator {
    public void populate(World x, Random y, Chunk z){
    int xx = y.nextInt(2);
    int zz = y.nextInt(2);
    int yy = x.getHighestBlockYAt(xx, zz);
    z.getBlock(xx, yy+ 1, zz).setType(Material.WOOD);
    z.getBlock(xx, yy+ 2, zz).setType(Material.WOOD);
    z.getBlock(xx, yy+ 3, zz).setType(Material.WOOD);
    z.getBlock(xx, yy+ 4, zz).setType(Material.WOOD);
    z.getBlock(xx, yy+51, zz).setType(Material.LEAVES);
    z.getBlock(xx+1, yy+ 5, zz).setType(Material.LEAVES);
    z.getBlock(xx+1, yy+ 4, zz).setType(Material.DRAGON_EGG);
    z.getBlock(xx-1, yy+ 5, zz).setType(Material.LEAVES);
    z.getBlock(xx, yy+ 5, zz+1).setType(Material.LEAVES);
    z.getBlock(xx, yy+ 5, zz-1).setType(Material.LEAVES);
    z.getBlock(xx, yy+ 5, zz+2).setType(Material.LEAVES);
    z.getBlock(xx, yy+ 5, zz-2).setType(Material.LEAVES);
    z.getBlock(xx+2, yy+ 5, zz).setType(Material.LEAVES);
    z.getBlock(xx-2, yy+ 5, zz).setType(Material.LEAVES);
    }
    }
     
  9. Offline

    codename_B

    Aside from the fact that your formatting is terrible, in one bit you have dragon eggs and another line you have +51 and your variable names make no sense and are just going to confuse you... it looks fine.

    Here, this will help (hopefully) it's the treepopulator from my latest WGEN. heldplayer wrote this one for me a while ago, but it demonstrates effectively what you're trying to do and how to do it.

    Feel free to use it!

    You can obviously ignore the stuff about continents.

    Code:
    package de.bananaco.wgen.populators;
     
    import java.util.Random;
    import org.bukkit.Chunk;
    import org.bukkit.Material;
    import org.bukkit.World;
    import org.bukkit.block.Block;
    import org.bukkit.generator.BlockPopulator;
     
    import de.bananaco.wgen.Continent;
    import de.bananaco.wgen.ContinentManager;
    import de.bananaco.wgen.ContinentType;
     
    /**
    * BlockPopulator that adds trees based on the biome.
    * @author heldplayer
    */
    public class TreePopulator extends BlockPopulator {
     
        @Override
        public void populate(World world, Random random, Chunk chunk) {
            // Is this even on a continent we want to use it on?
            int conx = Continent.getContinentFromChunk(chunk.getX());
            int conz = Continent.getContinentFromChunk(chunk.getZ());
           
            Continent continent = ContinentManager.getInstance(world.getName()).getContinent(world, conx, conz);
           
            // Don't do anything if it's not one we want to use
            if(!(continent.getType() == ContinentType.DEFAULT || continent.getType() == ContinentType.GRASSY))
                return;
           
            int centerX = (chunk.getX() << 4) + random.nextInt(16);
            int centerZ = (chunk.getZ() << 4) + random.nextInt(16);
     
            byte data = 0;
            int chance = 0;
            int height = 4 + random.nextInt(3);
            int multiplier = 1;
     
            if (random.nextBoolean()) {
                data = 2;
                height = 5 + random.nextInt(3);
            }
     
            switch (world.getBlockAt(centerX, 0, centerZ).getBiome()) {
                case FOREST:
                    chance = 160;
                    multiplier = 10;
                    break;
                case PLAINS:
                    chance = 40;
                    break;
                case RAINFOREST:
                    chance = 160;
                    multiplier = 10;
                    break;
                case SAVANNA:
                    chance = 20;
                    break;
                case SEASONAL_FOREST:
                    chance = 140;
                    multiplier = 8;
                    break;
                case SHRUBLAND:
                    chance = 60;
                    break;
                case SWAMPLAND:
                    chance = 120;
                    break;
                case TAIGA:
                    chance = 120;
                    data = 1;
                    height = 8 + random.nextInt(3);
                    multiplier = 3;
                    break;
                case TUNDRA:
                    chance = 5;
                    data = 1;
                    height = 7 + random.nextInt(3);
                    break;
            }
     
            for (int i = 0; i < multiplier; i++) {
                centerX = (chunk.getX() << 4) + random.nextInt(16);
                centerZ = (chunk.getZ() << 4) + random.nextInt(16);
                if (random.nextInt(300) < chance) {
                    int centerY = world.getHighestBlockYAt(centerX, centerZ) - 1;
                    Block sourceBlock = world.getBlockAt(centerX, centerY, centerZ);
                   
                    if (sourceBlock.getType() == Material.GRASS) {
                        world.getBlockAt(centerX, centerY + height + 1, centerZ).setTypeIdAndData(18, data, true);
                        for (int j = 0; j < 4; j++) {
                            world.getBlockAt(centerX, centerY + height + 1 - j, centerZ - 1).setTypeIdAndData(18, data, true);
                            world.getBlockAt(centerX, centerY + height + 1 - j, centerZ + 1).setTypeIdAndData(18, data, true);
                            world.getBlockAt(centerX - 1, centerY + height + 1 - j, centerZ).setTypeIdAndData(18, data, true);
                            world.getBlockAt(centerX + 1, centerY + height + 1 - j, centerZ).setTypeIdAndData(18, data, true);
                        }
     
                        if (random.nextBoolean()) {
                            world.getBlockAt(centerX + 1, centerY + height, centerZ + 1).setTypeIdAndData(18, data, true);
                        }
                        if (random.nextBoolean()) {
                            world.getBlockAt(centerX + 1, centerY + height, centerZ - 1).setTypeIdAndData(18, data, true);
                        }
                        if (random.nextBoolean()) {
                            world.getBlockAt(centerX - 1, centerY + height, centerZ + 1).setTypeIdAndData(18, data, true);
                        }
                        if (random.nextBoolean()) {
                            world.getBlockAt(centerX - 1, centerY + height, centerZ - 1).setTypeIdAndData(18, data, true);
                        }
     
                        world.getBlockAt(centerX + 1, centerY + height - 1, centerZ + 1).setTypeIdAndData(18, data, true);
                        world.getBlockAt(centerX + 1, centerY + height - 1, centerZ - 1).setTypeIdAndData(18, data, true);
                        world.getBlockAt(centerX - 1, centerY + height - 1, centerZ + 1).setTypeIdAndData(18, data, true);
                        world.getBlockAt(centerX - 1, centerY + height - 1, centerZ - 1).setTypeIdAndData(18, data, true);
                        world.getBlockAt(centerX + 1, centerY + height - 2, centerZ + 1).setTypeIdAndData(18, data, true);
                        world.getBlockAt(centerX + 1, centerY + height - 2, centerZ - 1).setTypeIdAndData(18, data, true);
                        world.getBlockAt(centerX - 1, centerY + height - 2, centerZ + 1).setTypeIdAndData(18, data, true);
                        world.getBlockAt(centerX - 1, centerY + height - 2, centerZ - 1).setTypeIdAndData(18, data, true);
     
                        for (int j = 0; j < 2; j++) {
                            for (int k = -2; k <= 2; k++) {
                                for (int l = -2; l <= 2; l++) {
                                    world.getBlockAt(centerX + k, centerY + height - 1 - j, centerZ + l).setTypeIdAndData(18, data, true);
                                }
                            }
                        }
     
                        for (int j = 0; j < 2; j++) {
                            if (random.nextBoolean()) {
                                world.getBlockAt(centerX + 2, centerY + height - 1 - j, centerZ + 2).setTypeIdAndData(0, (byte) 0, true);
                            }
                            if (random.nextBoolean()) {
                                world.getBlockAt(centerX + 2, centerY + height - 1 - j, centerZ - 2).setTypeIdAndData(0, (byte) 0, true);
                            }
                            if (random.nextBoolean()) {
                                world.getBlockAt(centerX - 2, centerY + height - 1 - j, centerZ + 2).setTypeIdAndData(0, (byte) 0, true);
                            }
                            if (random.nextBoolean()) {
                                world.getBlockAt(centerX - 2, centerY + height - 1 - j, centerZ - 2).setTypeIdAndData(0, (byte) 0, true);
                            }
                        }
                       
                        // Trunk
                        for (int y = 1; y <= height; y++) {
                            world.getBlockAt(centerX, centerY + y, centerZ).setTypeIdAndData(17, data, true);
                        }
                    }
                }
            }
        }
     
    }
    
     
  10. Offline

    md_5

    Latest rb please
     

Share This Page