當前位置: 首頁>>代碼示例>>Java>>正文


Java Direction.directionToFacing方法代碼示例

本文整理匯總了Java中net.minecraft.util.Direction.directionToFacing方法的典型用法代碼示例。如果您正苦於以下問題:Java Direction.directionToFacing方法的具體用法?Java Direction.directionToFacing怎麽用?Java Direction.directionToFacing使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.minecraft.util.Direction的用法示例。


在下文中一共展示了Direction.directionToFacing方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getIcon

import net.minecraft.util.Direction; //導入方法依賴的package包/類
@Override
public IIcon getIcon( IBlockAccess world, int i, int j, int k, int side )
{
    if( side == 0 || side == 1 )
    {
        return Icons.Top;
    }

    int metadata = world.getBlockMetadata( i, j, k );
    int direction = Direction.directionToFacing[ getDirection( metadata ) ];
    if( side == direction )
    {
        return Icons.Front;
    }

    return Icons.Side;
}
 
開發者ID:TeacherGaming,項目名稱:qcraft-mod,代碼行數:18,代碼來源:BlockQuantumComputer.java

示例2: isBlockStateValid

import net.minecraft.util.Direction; //導入方法依賴的package包/類
private boolean isBlockStateValid (World world, int x, int y, int z) {
    int meta = world.getBlockMetadata(x, y, z);
    int mask = meta;

    if (meta > 0) {
        for (int i = 0; i <= 3; i++) {
            int bit = 1 << i;
            int opSide = Direction.directionToFacing[Direction.rotateOpposite[i]];
            if ((meta & bit) != 0 && !canPlaceOnBlock(world, x + Direction.offsetX[i], y, z + Direction.offsetZ[i], opSide)
                && (world.getBlock(x, y + 1, z) != this || (world.getBlockMetadata(x, y + 1, z) & bit) == 0))
                mask &= ~bit;
        }
    }

    if (mask == 0)
        return false;

    if (mask != meta)
        world.setBlockMetadataWithNotify(x, y, z, mask, 2);

    return true;
}
 
開發者ID:jaquadro,項目名稱:GardenCollection,代碼行數:23,代碼來源:BlockIvy.java

示例3: updateOutput

import net.minecraft.util.Direction; //導入方法依賴的package包/類
private void updateOutput( World world, int x, int y, int z )
{
    if( world.isRemote )
    {
        return;
    }

    // Redetermine subtype
    int metadata = world.getBlockMetadata( x, y, z );
    int direction = getDirection( metadata );
    int subType = getSubType( metadata );
    int newSubType = evaluateInput( world, x, y, z ) ? SubType.ObserverOn : SubType.ObserverOff;
    if( newSubType != subType )
    {
        // Set new subtype
        setDirectionAndSubType( world, x, y, z, direction, newSubType );
        subType = newSubType;

        // Notify
        world.markBlockForUpdate( x, y, z );
        world.notifyBlocksOfNeighborChange( x, y, z, this );
    }

    // Observe
    int facing = Facing.oppositeSide[ Direction.directionToFacing[ direction ] ];
    observe( world, x, y, z, facing, subType == SubType.ObserverOn );
}
 
開發者ID:TeacherGaming,項目名稱:qcraft-mod,代碼行數:28,代碼來源:BlockQuantumLogic.java

示例4: evaluateInput

import net.minecraft.util.Direction; //導入方法依賴的package包/類
private boolean evaluateInput( World world, int i, int j, int k )
{
    int metadata = world.getBlockMetadata( i, j, k );
    int direction = Facing.oppositeSide[ Direction.directionToFacing[ getDirection( metadata ) ] ];
    int backDir = Facing.oppositeSide[ direction ];
    return getRedstoneSignal( world, i, j, k, backDir );
}
 
開發者ID:TeacherGaming,項目名稱:qcraft-mod,代碼行數:8,代碼來源:BlockQuantumLogic.java

示例5: getFacing

import net.minecraft.util.Direction; //導入方法依賴的package包/類
/**
 * <p>Get the cardinal direction the given Entity is facing towards.</p>
 *
 * @param entity the Entity
 * @return a cardinal direction (one of {@link net.minecraftforge.common.ForgeDirection#NORTH},
 * {@link net.minecraftforge.common.ForgeDirection#WEST}, {@link net.minecraftforge.common.ForgeDirection#SOUTH},
 * {@link net.minecraftforge.common.ForgeDirection#EAST})
 */
public static ForgeDirection getFacing(Entity entity) {
	int dir = MathHelper.floor_double((entity.rotationYaw * 4 / 360) + 0.5) & 3;
	return ForgeDirection.VALID_DIRECTIONS[Direction.directionToFacing[dir]];
}
 
開發者ID:diesieben07,項目名稱:SevenCommons,代碼行數:13,代碼來源:Entities.java


注:本文中的net.minecraft.util.Direction.directionToFacing方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。