[World Generation Bug] Blocks Not Visible

Discussion in 'Bukkit Help' started by Bench3, Sep 2, 2012.

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

    Bench3

    Hi, i'm attempting to make my first world generation plugin and I would like it to be very simple and generate a flat land. Unfortunately, its not working :p

    It is floating on on invisible blocks and generates a perimeter around them and in other seemingly random places. This is my code so far for my world generator:

    Code:
    import java.util.ArrayList;
    import java.util.List;
    import java.util.Random;
     
    import org.bukkit.Location;
    import org.bukkit.Material;
    import org.bukkit.World;
    import org.bukkit.generator.BlockPopulator;
    import org.bukkit.generator.ChunkGenerator;
     
    import com.TheBCBroz.Bench3.Houses.Main.Houses;
     
    public class FlatLandGenerator extends ChunkGenerator {
     
        Houses plugin;
     
        public FlatLandGenerator(Houses instance) {
        plugin = instance;
        }
     
        public Location getFixedSpawnLocation(World world, Random random) {
        return new Location(world, -26, 50, -127);
        }
     
        public byte[] generate(World world, Random rand, int cX, int cZ) {
        byte[] blocks = new byte[65536];
        int x, y, z;
     
        for (x = 0; x < 16; ++x) {
            for (z = 0; z < 16; ++z) {
            blocks[coordsToInt(x, 0, z)] = (byte) Material.BEDROCK.getId();
     
            for (y = 1; y < 49; ++y) {
                blocks[coordsToInt(x, y, z)] = (byte) Material.DIRT.getId();
            }
     
            blocks[coordsToInt(x, 50, z)] = (byte) Material.GRASS.getId();
            }
        }
        return blocks;
        }
     
        public List<BlockPopulator> getDefaultPopulators(World world) {
        return new ArrayList<BlockPopulator>();
        }
     
        private int coordsToInt(int x, int y, int z) {
        return (x * 16 + z) * 128 + y;
        }
    }
    I am generating this code with multiverse; the command I use is:

    /mv create flatworld normal -g Houses

    Thanks in advance,
    ~Ben :D
     
Thread Status:
Not open for further replies.

Share This Page