public int getChannelsOnSide( EnumFacing side ) { if( !this.powered ) { return 0; } return this.channelsOnSide[side.ordinal()]; }
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; }
@Override public int getMetaFromState( final IBlockState state ) { return state.getValue( FACING ).ordinal(); }
@Override public int getMetaFromState( final IBlockState state ) { return state.getValue( FACING ).ordinal(); }
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 ); }
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 ); }
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 ); }
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 ); }
@Override public void setInputQuad( Quad quad ) { super.setInputQuad( quad ); quad.resetInterp( this.interpHelper, quad.orientation.ordinal() >> 1 ); }
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 ); }
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 ); }
public int getSeed() { final int val = this.getSide().ordinal() | ( this.getColor().ordinal() << 3 ) | ( this.isLumen() ? 0x80 : 0x00 ); return Math.abs( this.pos + val ); }
@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(); }
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 ); }
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; } }
@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; } }
@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; } }
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;