本文整理匯總了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;
}
示例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;
}
示例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 );
}
示例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 );
}
示例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]];
}