public static void formatTriangles(byte data[], int id) {
		if (data == null) {
			ModelHeader modelHeader = Model.modelHeaderCache[id] = new ModelHeader();
			modelHeader.vertexCount = 0;
			modelHeader.triangleCount = 0;
			modelHeader.texturedTriangleCount = 0;
			return;
		}
		Stream buffer = new Stream(data);
		buffer.offset = data.length - 18;
		ModelHeader header = Model.modelHeaderCache[id] = new ModelHeader();
		header.buffer = data;
		header.vertexCount = buffer.getUnsignedShort();
		header.triangleCount = buffer.getUnsignedShort();
		header.texturedTriangleCount = buffer.getUnsignedByte();
		int faceOff = buffer.getUnsignedByte();
		int priOff = buffer.getUnsignedByte();
		int transOff = buffer.getUnsignedByte();
		int skinOff = buffer.getUnsignedByte();
		int vSkinOff = buffer.getUnsignedByte();
		int vertXOff = buffer.getUnsignedShort();
		int vertYOff = buffer.getUnsignedShort();
		int vertZOff = buffer.getUnsignedShort();
		int colorOff = buffer.getUnsignedShort();
		int off = 0;
		header.vertexModOffset = off;
		off += header.vertexCount;
		header.triangleMeshLinkOffset = off;
		off += header.triangleCount;
		header.trianglePriorityOffset = off;
		if (priOff == 255) {
			off += header.triangleCount;
		} else {
			header.trianglePriorityOffset = -priOff - 1;
		}
		header.triangleSkinningOffset = off;
		if (skinOff == 1) {
			off += header.triangleCount;
		} else {
			header.triangleSkinningOffset = -1;
		}
		header.triangleFaceTypeOffset = off;
		if (faceOff == 1) {
			off += header.triangleCount;
		} else {
			header.triangleFaceTypeOffset = -1;
		}
		header.vertexSkinOffset = off;
		if (vSkinOff == 1) {
			off += header.vertexCount;
		} else {
			header.vertexSkinOffset = -1;
		}
		header.triangleTransparencyOffset = off;
		if (transOff == 1) {
			off += header.triangleCount;
		} else {
			header.triangleTransparencyOffset = -1;
		}
		header.triangleVertexPointOffset = off;
		off += colorOff;
		header.triangleColorOffset = off;
		off += header.triangleCount * 2;
		header.triangleTextureOffset = off;
		off += header.texturedTriangleCount * 6;
		header.vertexOffsetX = off;
		off += vertXOff;
		header.vertexOffsetY = off;
		off += vertYOff;
		header.vertexOffsetZ = off;
		off += vertZOff;
	}