ShitOnFloorGen.java 文件源码

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

项目:Firma 作者:
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {
    for (int i = 0; i < random.nextInt(16); i++) {
        belowTree = false;
        int x = random.nextInt(16) + chunkX * 16;
        int z = random.nextInt(16) + chunkZ * 16;
        int y = world.getHeight();
        BlockPos pos = new BlockPos(x,y,z);
        while(!shitCheck(world, pos)) {
            pos = pos.down();
        }
        IBlockState b = world.getBlockState(pos);
        if (Util.isClay(b.getBlock()) || Util.isDirt(b.getBlock()) || Util.isGrass(b.getBlock()) || Util.isRawStone(b.getBlock())
                || Util.isSand(b.getBlock()) || Util.isGravel(b.getBlock()) && b.getBlock() instanceof BaseBlock) { // Sensible
                                                                                                                    // locations
                                                                                                                    // for
                                                                                                                    // shit
            BaseBlock bb = (BaseBlock) b.getBlock();
            String meta = bb.getMetaName(b.getBlock().getMetaFromState(b));
            pos = pos.up();
            world.setBlockState(pos, FirmaMod.shitOnFloor.getDefaultState(), 2);
            SoFTileEntity te = (SoFTileEntity) world.getTileEntity(pos);
            if (te != null) {
                te.setItem(getItemForArea(random,meta));
                te.markDirty();
            }
        }
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号