Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * @author jtjj222
- * As part of my series on terrain generation
- * http://forums.bukkit.org/threads/the-always-up-to-date-definitive-guide-to-terrain-generation-part-one-prerequisites-and-setup.93982/
- * Enjoy, use it as much as you want.
- */
- public class BasicChunkGenerator extends ChunkGenerator {
- /**
- *
- * @param x
- * X co-ordinate of the block to be set in the array
- * @param y
- * Y co-ordinate of the block to be set in the array
- * @param z
- * Z co-ordinate of the block to be set in the array
- * @param chunk
- * An array containing the Block id's of all the blocks in the chunk. The first offset
- * is the block section number. There are 16 block sections, stacked vertically, each of which
- * 16 by 16 by 16 blocks.
- * @param material
- * The material to set the block to.
- */
- void setBlock(int x, int y, int z, byte[][] chunk, Material material) {
- if (chunk[y >> 4] == null)
- chunk[y >> 4] = new byte[16 * 16 * 16];
- if (!(y <= 256 && y >= 0 && x <= 16 && x >= 0 && z <= 16 && z >= 0))
- return;
- try {
- chunk[y >> 4][((y & 0xF) << 8) | (z << 4) | x] = (byte) material
- .getId();
- } catch (Exception e) {
- // do nothing
- }
- }
- @Override
- /**
- * @param world
- * The world the chunk belongs to
- * @param rand
- * Don't use this, make a new random object using the world seed (world.getSeed())
- * @param biome
- * Use this to set/get the current biome
- * @param ChunkX and ChunkZ
- * The x and z co-ordinates of the current chunk.
- */
- public byte[][] generateBlockSections(World world, Random rand, int ChunkX,
- int ChunkZ, BiomeGrid biome) {
- return null;
- }
- /**
- * Returns a list of all of the block populators (that do "little" features)
- * to be called after the chunk generator
- */
- @Override
- public List<BlockPopulator> getDefaultPopulators(World world) {
- ArrayList<BlockPopulator> pops = new ArrayList<BlockPopulator>();
- //Add Block populators here
- return pops;
- }
- }
Add Comment
Please, Sign In to add comment