Decorator.java 文件源码

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

项目:Placemod 作者:
@Override
public void generate(Random randomDefault, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {
    if (!allowedDimensions.contains(world.provider.getDimension())) {
        return; // Dimension with given id is not allowed
    }
    Random random = getRandom(world.getSeed(), chunkX, chunkZ);
    int drops = (int) density + (random.nextDouble() <= (density - (int) density) ? 1 : 0);
    net.minecraft.world.biome.Biome biome = world.getBiomeGenForCoords(new BlockPos(chunkX * 16, 64, chunkZ * 16));
    Biome.Style biomeStyle = Biome.determine(biome);
    ArrayList<Cluster> biomeClusters = distributor.getClusters(biomeStyle);
    for (int i = 0; i < drops; ++i) {
        double pointer = random.nextDouble();
        for (Cluster cluster : biomeClusters) {
            if (pointer <= cluster.getChance()) {
                place(world, cluster, chunkX, chunkZ, random.nextLong());
                break;
            }
            pointer -= cluster.getChance();
        }
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号