当前位置: 首页>>代码示例>>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;未经允许,请勿转载。