Java 类net.minecraft.world.gen.feature.WorldGenBush 实例源码

项目:HempFarmer    文件:HempGen.java   
private void runGenerator(WorldGenBush gen, World world, Random rand, int chunkX, int chunkZ, int chance) {

        int maxHeight = world.getHeight() + 1;
        int chancesToSpawn = chance;
        for (int i = 0; i < chancesToSpawn; i++) {
            int x = chunkX + rand.nextInt(6);
            int y = rand.nextInt(maxHeight) + world.getSeaLevel();
            int d = maxHeight - y;
            y = (y <= maxHeight) ? y : y + d;
            int z = chunkZ + rand.nextInt(6);
            gen.generate(world, rand, new BlockPos(x, y, z));

        }

    }