net.minecraft.util.EnumFacing.ordinal()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(7.4k)|赞(0)|评价(0)|浏览(83)

本文整理了Java中net.minecraft.util.EnumFacing.ordinal()方法的一些代码示例,展示了EnumFacing.ordinal()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。EnumFacing.ordinal()方法的具体详情如下:
包路径:net.minecraft.util.EnumFacing
类名称:EnumFacing
方法名:ordinal

EnumFacing.ordinal介绍

暂无

代码示例

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

public int getChannelsOnSide( EnumFacing side )
{
  if( !this.powered )
  {
    return 0;
  }
  return this.channelsOnSide[side.ordinal()];
}

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

public void setUvRotation( EnumFacing facing, int rotation )
{
  if( rotation == 2 )
  {
    rotation = 3;
  }
  else if( rotation == 3 )
  {
    rotation = 2;
  }
  Preconditions.checkArgument( rotation >= 0 && rotation <= 3, "rotation" );
  this.uvRotations[facing.ordinal()] = (byte) rotation;
}

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

public static FacingToRotation get( EnumFacing forward, EnumFacing up )
{
  return values()[forward.ordinal() * 6 + up.ordinal()];
}

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

protected void writeToStream( final ByteBuf data ) throws IOException
{
  if( this.canBeRotated() )
  {
    final byte orientation = (byte) ( ( this.up.ordinal() << 3 ) | this.forward.ordinal() );
    data.writeByte( orientation );
  }
}

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

@Override
public int getMetaFromState( final IBlockState state )
{
  return state.getValue( FACING ).ordinal();
}

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

@Override
public int getMetaFromState( final IBlockState state )
{
  return state.getValue( FACING ).ordinal();
}

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

private void putVertexTL( UnpackedBakedQuad.Builder builder, EnumFacing face, float x, float y, float z, UvVector uv )
{
  float u, v;
  switch( this.uvRotations[face.ordinal()] )
  {
    default:
    case 0:
      u = uv.u1;
      v = uv.v1;
      break;
    case 1: // 90° clockwise
      u = uv.u1;
      v = uv.v2;
      break;
    case 2: // 180° clockwise
      u = uv.u2;
      v = uv.v2;
      break;
    case 3: // 270° clockwise
      u = uv.u2;
      v = uv.v1;
      break;
  }
  this.putVertex( builder, face, x, y, z, u, v );
}

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

private void putVertexTR( UnpackedBakedQuad.Builder builder, EnumFacing face, float x, float y, float z, UvVector uv )
{
  float u, v;
  switch( this.uvRotations[face.ordinal()] )
  {
    default:
    case 0:
      u = uv.u2;
      v = uv.v1;
      break;
    case 1: // 90° clockwise
      u = uv.u1;
      v = uv.v1;
      break;
    case 2: // 180° clockwise
      u = uv.u1;
      v = uv.v2;
      break;
    case 3: // 270° clockwise
      u = uv.u2;
      v = uv.v2;
      break;
  }
  this.putVertex( builder, face, x, y, z, u, v );
}

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

private void putVertexBR( UnpackedBakedQuad.Builder builder, EnumFacing face, float x, float y, float z, UvVector uv )
{
  float u;
  float v;
  switch( this.uvRotations[face.ordinal()] )
  {
    default:
    case 0:
      u = uv.u2;
      v = uv.v2;
      break;
    case 1: // 90° clockwise
      u = uv.u2;
      v = uv.v1;
      break;
    case 2: // 180° clockwise
      u = uv.u1;
      v = uv.v1;
      break;
    case 3: // 270° clockwise
      u = uv.u1;
      v = uv.v2;
      break;
  }
  this.putVertex( builder, face, x, y, z, u, v );
}

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

private void putVertexBL( UnpackedBakedQuad.Builder builder, EnumFacing face, float x, float y, float z, UvVector uv )
{
  float u;
  float v;
  switch( this.uvRotations[face.ordinal()] )
  {
    default:
    case 0:
      u = uv.u1;
      v = uv.v2;
      break;
    case 1: // 90° clockwise
      u = uv.u2;
      v = uv.v2;
      break;
    case 2: // 180° clockwise
      u = uv.u2;
      v = uv.v1;
      break;
    case 3: // 270° clockwise
      u = uv.u1;
      v = uv.v1;
      break;
  }
  this.putVertex( builder, face, x, y, z, u, v );
}

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

@Override
public void setInputQuad( Quad quad )
{
  super.setInputQuad( quad );
  quad.resetInterp( this.interpHelper, quad.orientation.ordinal() >> 1 );
}

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

public PacketPartPlacement( final BlockPos pos, final EnumFacing face, final float eyeHeight, final EnumHand hand )
{
  final ByteBuf data = Unpooled.buffer();
  data.writeInt( this.getPacketID() );
  data.writeInt( pos.getX() );
  data.writeInt( pos.getY() );
  data.writeInt( pos.getZ() );
  data.writeByte( face.ordinal() );
  data.writeFloat( eyeHeight );
  data.writeByte( hand.ordinal() );
  this.configureWrite( data );
}

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

public void writeToStream( final ByteBuf stream )
{
  stream.writeByte( this.pos );
  final int val = this.getSide().ordinal() | ( this.getColor().ordinal() << 3 ) | ( this.isLumen() ? 0x80 : 0x00 );
  stream.writeByte( val );
}

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

public int getSeed()
{
  final int val = this.getSide().ordinal() | ( this.getColor().ordinal() << 3 ) | ( this.isLumen() ? 0x80 : 0x00 );
  return Math.abs( this.pos + val );
}

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

@Override
public void updateState()
{
  final EnumSet<GridFlags> set = this.gridProxy.getFlags();
  this.compressedData = set.contains( GridFlags.CANNOT_CARRY ) ? 0 : ( set.contains( GridFlags.DENSE_CAPACITY ) ? 2 : 1 );
  this.compressedData |= ( this.gridProxy.getGridColor().ordinal() << 3 );
  for( final EnumFacing dir : this.gridProxy.getConnectableSides() )
  {
    this.compressedData |= ( 1 << ( dir.ordinal() + 8 ) );
  }
  this.findConnections();
  this.getInternalGrid();
}

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

public PacketClick( final BlockPos pos, final EnumFacing side, final float hitX, final float hitY, final float hitZ, final EnumHand hand, boolean leftClick )
{
  final ByteBuf data = Unpooled.buffer();
  data.writeInt( this.getPacketID() );
  data.writeInt( this.x = pos.getX() );
  data.writeInt( this.y = pos.getY() );
  data.writeInt( this.z = pos.getZ() );
  if( side == null )
  {
    data.writeByte( -1 );
  }
  else
  {
    data.writeByte( side.ordinal() );
  }
  data.writeFloat( this.hitX = hitX );
  data.writeFloat( this.hitY = hitY );
  data.writeFloat( this.hitZ = hitZ );
  data.writeByte( hand.ordinal() );
  data.writeBoolean( this.leftClick = leftClick );
  this.configureWrite( data );
}

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

private FacadeRenderState getFacadeRenderState( EnumFacing side )
  {
    // Store the "masqueraded" itemstack for the given side, if there is a facade
    final IFacadePart facade = this.getFacade( side.ordinal() );

    if( facade != null )
    {
      final ItemStack textureItem = facade.getTextureItem();
      final IBlockState blockState = facade.getBlockState();

      if( blockState != null && textureItem != null )
      {
        return new FacadeRenderState( blockState, !facade.getBlockState().isOpaqueCube() );
      }
    }

    return null;
  }
}

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

@Override
  public boolean transform()
  {
    int s = this.quad.orientation.ordinal() >> 1;
    if( this.format.hasColor || this.format.hasUV || this.format.hasLightMap )
    {
      this.interpCache.copyFrom( this.quad );
      this.interpHelper.setup();
      for( Vertex v : this.quad.vertices )
      {
        this.interpHelper.locate( v.dx( s ), v.dy( s ) );
        if( this.format.hasColor )
        {
          v.interpColorFrom( this.interpHelper, this.interpCache.vertices );
        }
        if( this.format.hasUV )
        {
          v.interpUVFrom( this.interpHelper, this.interpCache.vertices );
        }
        if( this.format.hasLightMap )
        {
          v.interpLightMapFrom( this.interpHelper, this.interpCache.vertices );
        }
      }
    }
    return true;
  }
}

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

@Override
  public boolean transform()
  {
    int s = this.quad.orientation.ordinal() >> 1;

    this.quad.clamp( this.clampBounds );

    // Check if the quad would be invisible and cull it.
    Vertex[] vertices = this.quad.vertices;
    float x1 = vertices[0].dx( s );
    float x2 = vertices[1].dx( s );
    float x3 = vertices[2].dx( s );
    float x4 = vertices[3].dx( s );

    float y1 = vertices[0].dy( s );
    float y2 = vertices[1].dy( s );
    float y3 = vertices[2].dy( s );
    float y4 = vertices[3].dy( s );

    // These comparisons are safe as we are comparing clamped values.
    boolean flag1 = x1 == x2 && x2 == x3 && x3 == x4;
    boolean flag2 = y1 == y2 && y2 == y3 && y3 == y4;
    return !flag1 && !flag2;
  }
}

代码示例来源:origin: Vazkii/Botania

tessellator.getBuffer().begin(GL11.GL_LINES, DefaultVertexFormats.POSITION);
double len = (double) -ClientTickHandler.ticksInGame / 100F + new Random(dir.ordinal() ^ tile.getPos().hashCode()).nextInt(10000);
double add = vecMag.mag();
double rand = Math.random() - 0.5;

相关文章