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


Java BlockVec3.getBlockMetadata方法代码示例

本文整理汇总了Java中micdoodle8.mods.galacticraft.api.vector.BlockVec3.getBlockMetadata方法的典型用法代码示例。如果您正苦于以下问题:Java BlockVec3.getBlockMetadata方法的具体用法?Java BlockVec3.getBlockMetadata怎么用?Java BlockVec3.getBlockMetadata使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在micdoodle8.mods.galacticraft.api.vector.BlockVec3的用法示例。


在下文中一共展示了BlockVec3.getBlockMetadata方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: canBlockPassAirOnSide

import micdoodle8.mods.galacticraft.api.vector.BlockVec3; //导入方法依赖的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: canBlockPassAir

import micdoodle8.mods.galacticraft.api.vector.BlockVec3; //导入方法依赖的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.vector.BlockVec3.getBlockMetadata方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。