public override void Convert(ResourceLocation source, ResourceLocation dest) { ContentBinaryReader br = new ContentBinaryReader(source); BinaryDataReader data = br.ReadBinaryData(); float xllcorner = data.GetDataSingle("xllcorner"); float yllcorner = data.GetDataSingle("yllcorner"); int width = data.GetDataInt32("width"); int height = data.GetDataInt32("height"); float[] demData = new float[height * width]; int bits = data.GetDataInt32("bits", 32); ContentBinaryReader br2 = data.GetData("data"); for (int i = 0; i < height; i++) { for (int j = 0; j < width; j++) { demData[i * width + j] = br2.ReadSingle(); } } br2.Close(); data.Close(); Half[] demData16 = Half.ConvertToHalf(demData); // ========================================================= BinaryDataWriter result = new BinaryDataWriter(); result.AddEntry("xllcorner", xllcorner); result.AddEntry("yllcorner", yllcorner); result.AddEntry("width", width); result.AddEntry("height", height); result.AddEntry("bits", 16); Stream dataStream = result.AddEntryStream("data"); ContentBinaryWriter bw = new ContentBinaryWriter(dataStream); for (int i = 0; i < demData.Length; i++) { bw.Write(demData16[i].InternalValue); } bw.Close(); bw = new ContentBinaryWriter(dest); bw.Write(result); bw.Close(); }