当前位置: 首页>>代码示例>>Java>>正文


Java IPartialSealableBlock类代码示例

本文整理汇总了Java中micdoodle8.mods.galacticraft.api.block.IPartialSealableBlock的典型用法代码示例。如果您正苦于以下问题:Java IPartialSealableBlock类的具体用法?Java IPartialSealableBlock怎么用?Java IPartialSealableBlock使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


IPartialSealableBlock类属于micdoodle8.mods.galacticraft.api.block包,在下文中一共展示了IPartialSealableBlock类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: canBlockPassAirOnSide

import micdoodle8.mods.galacticraft.api.block.IPartialSealableBlock; //导入依赖的package包/类
private static boolean canBlockPassAirOnSide(World world, Block block, BlockVec3 vec, int side)
{
    if (block instanceof IPartialSealableBlock)
    {
        return !((IPartialSealableBlock) block).isSealed(world, vec.x, vec.y, vec.z, ForgeDirection.getOrientation(side));
    }

    //Half slab seals on the top side or the bottom side according to its metadata
    if (block instanceof BlockSlab)
    {
        return !(side == 0 && (vec.getBlockMetadata(world) & 8) == 8 || side == 1 && (vec.getBlockMetadata(world) & 8) == 0);
    }

    //Farmland etc only seals on the solid underside
    if (block instanceof BlockFarmland || block instanceof BlockEnchantmentTable || block instanceof BlockLiquid)
    {
        return side != 1;
    }

    if (block instanceof BlockPistonBase)
    {
        BlockPistonBase piston = (BlockPistonBase) block;
        int meta = vec.getBlockMetadata(world);
        if (BlockPistonBase.isExtended(meta))
        {
            int facing = BlockPistonBase.getPistonOrientation(meta);
            return side != facing;
        }
        return false;
    }

    return !block.isSideSolid(world, vec.x, vec.y, vec.z, ForgeDirection.getOrientation(side ^ 1));
}
 
开发者ID:4Space,项目名称:4Space-5,代码行数:34,代码来源:OxygenUtil.java

示例2: isSealed

import micdoodle8.mods.galacticraft.api.block.IPartialSealableBlock; //导入依赖的package包/类
@Override
public boolean isSealed(World world, int x, int y, int z, ForgeDirection direction) {
    int meta = world.getBlockMetadata(x, y, z);
    SubBlock sb = this.getSubBlock(meta);
    if(sb instanceof IPartialSealableBlock) {
        return ((IPartialSealableBlock)sb).isSealed(world, x, y, z, direction);
    }

    return true;
}
 
开发者ID:katzenpapst,项目名称:amunra,代码行数:11,代码来源:BlockBasicMeta.java

示例3: canBlockPassAir

import micdoodle8.mods.galacticraft.api.block.IPartialSealableBlock; //导入依赖的package包/类
public static boolean canBlockPassAir(World world, Block block, BlockVec3 vec, int side)
{
    if (block == null)
    	return true;
	
	//Check leaves first, because their isOpaqueCube() test depends on graphics settings
    //(See net.minecraft.block.BlockLeaves.isOpaqueCube()!)
    if (block instanceof BlockLeavesBase)
    {
        return true;
    }

    if (block.isOpaqueCube())
    {
        return block instanceof BlockGravel || block.getMaterial() == Material.cloth || block instanceof BlockSponge;

    }

    if (block instanceof BlockGlass || block instanceof BlockStainedGlass)
    {
        return false;
    }

    if (block instanceof IPartialSealableBlock)
    {
        return !((IPartialSealableBlock) block).isSealed(world, vec.x, vec.y, vec.z, ForgeDirection.getOrientation(side));
    }

    //Solid but non-opaque blocks, for example special glass
    if (OxygenPressureProtocol.nonPermeableBlocks.containsKey(block))
    {
        ArrayList<Integer> metaList = OxygenPressureProtocol.nonPermeableBlocks.get(block);
        if (metaList.contains(Integer.valueOf(-1)) || metaList.contains(vec.getBlockMetadata(world)))
        {
            return false;
        }
    }

    //Half slab seals on the top side or the bottom side according to its metadata
    if (block instanceof BlockSlab)
    {
        return !(side == 0 && (vec.getBlockMetadata(world) & 8) == 8 || side == 1 && (vec.getBlockMetadata(world) & 8) == 0);
    }

    //Farmland etc only seals on the solid underside
    if (block instanceof BlockFarmland || block instanceof BlockEnchantmentTable || block instanceof BlockLiquid)
    {
        return side != 1;
    }

    if (block instanceof BlockPistonBase)
    {
        BlockPistonBase piston = (BlockPistonBase) block;
        int meta = vec.getBlockMetadata(world);
        if (BlockPistonBase.isExtended(meta))
        {
            int facing = BlockPistonBase.getPistonOrientation(meta);
            return side != facing;
        }
        return false;
    }

    //General case - this should cover any block which correctly implements isBlockSolidOnSide
    //including most modded blocks - Forge microblocks in particular is covered by this.
    // ### Any exceptions in mods should implement the IPartialSealableBlock interface ###
    return !block.isSideSolid(world, vec.x, vec.y, vec.z, ForgeDirection.getOrientation(side ^ 1));
}
 
开发者ID:4Space,项目名称:4Space-5,代码行数:68,代码来源:OxygenPressureProtocol.java


注:本文中的micdoodle8.mods.galacticraft.api.block.IPartialSealableBlock类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。