當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。