WorldGenerator.java 文件源码

java
阅读 31 收藏 0 点赞 0 评论 0

项目:Got-Wood 作者:
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {
    if (world.provider.getDimension() == 0) {

        WorldGenAbstractTree apple = new WorldGenApple(false);
        WorldGenAbstractTree maple = new WorldGenMaple(false);
        WorldGenAbstractTree ebony = new WorldGenEbony(false);
        WorldGenAbstractTree fir = new WorldGenFir(false);
        WorldGenAbstractTree pine = new WorldGenPine(false);
        WorldGenAbstractTree willow = new WorldGenWillow();
        WorldGenAbstractTree yew = new WorldGenYew();

        // get the biome
        Biome biome = world.getBiome(new BlockPos(chunkX * 16, 64, chunkZ * 16));

        if (biome instanceof BiomeDesert) {
            makeTree(ebony, chunkX, chunkZ, random, world, 0, 1);
        }

        if (biome instanceof BiomeForest || biome instanceof BiomeForestMutated) {
            if (random.nextInt(4) == 0) {
                makeTree(maple, chunkX, chunkZ, random, world, 0, 3);
            }

            if (random.nextInt(12) == 0) {
                makeTree(apple, chunkX, chunkZ, random, world, 1, 2);
            }

            makeTree(pine, chunkX, chunkZ, random, world, 0, 3);
        }

        if (biome instanceof BiomeHills) {
            makeTree(maple, chunkX, chunkZ, random, world, 0, 3);
            makeTree(fir, chunkX, chunkZ, random, world, 0, 3);
        }

        if (biome instanceof BiomeMesa && random.nextBoolean()) {
            makeTree(ebony, chunkX, chunkZ, random, world, 1, 3);
        }

        if (biome instanceof BiomePlains) {
            makeTree(apple, chunkX, chunkZ, random, world, 0, 1);
        }

        if (biome instanceof BiomeRiver && random.nextInt(3) == 0) {
            makeTree(yew, chunkX, chunkZ, random, world, 0, 3);
        }

        if (biome instanceof BiomeSavanna) {
            makeTree(ebony, chunkX, chunkZ, random, world, 0, 3);
        }

        if (biome instanceof BiomeSwamp) {
            if (random.nextInt(2) == 0) {
                makeTree(willow, chunkX, chunkZ, random, world, 0, 3);
            }
            if (random.nextInt(1) == 0) {
                makeTree(yew, chunkX, chunkZ, random, world, 0, 3);
            }
        }

        if (biome instanceof BiomeTaiga) {
            makeTree(pine, chunkX, chunkZ, random, world, 0, 3);
            makeTree(fir, chunkX, chunkZ, random, world, 1, 4);
        }
        if (biome instanceof BiomeJungle) {
            makeTree(rubber, chunkX, chunkZ, random, world, 0, 3);
        }
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号