WGCrystal.java 文件源码

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

项目:PurificatiMagicae 作者:
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider)
{
    if(dimList.contains(world.provider.getDimension()) == dimListMode)
    {
        int x = chunkX * 16 + random.nextInt(16);
        int z = chunkZ * 16 + random.nextInt(16);
        float sif = PurMag.INSTANCE.sif_storage.get(new GlobalChunkPos(chunkX, chunkZ, world.provider.getDimension()));
        int y = predicate.getY(random, chunkX, chunkZ, world, chunkGenerator, chunkProvider, x, z, sif);
        BlockPos pos = new BlockPos(x, y, z);

        if (predicate.canGenerateHere(random, chunkX, chunkZ, world, chunkGenerator, chunkProvider, pos, sif))
        {
            int count = predicate.getCrystalCount(random, chunkX, chunkZ, world, chunkGenerator, chunkProvider, pos, sif);
            predicate.beforePlace(random, chunkX, chunkZ, world, chunkGenerator, chunkProvider, pos, sif, count);
            BlockPos.MutableBlockPos genPos = new BlockPos.MutableBlockPos(pos);
            for (int i = 0; i < count; i++)
            {
                genPos.setY(pos.getY() + i);
                world.setBlockState(genPos, BlockRegistry.crystal.getDefaultState(), 2);
                TileSingleSip tss = new TileSingleSip();
                tss.setType(sipType, false);
                world.setTileEntity(genPos, tss);
            }
            PurMag.INSTANCE.debug("Crystal " + sipType + " " + pos);
            predicate.afterPlace(random, chunkX, chunkZ, world, chunkGenerator, chunkProvider, pos, sif, count);
        }
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号