Skip to content

Commit

Permalink
Minorly optimise MCForge-Redux map importer
Browse files Browse the repository at this point in the history
  • Loading branch information
UnknownShadow200 committed May 24, 2018
1 parent 520a9bd commit 182e276
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions fCraft/MapConversion/MapMCF.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,12 @@ public class MapMCF : MapMCSharp {
Map map = LoadHeaderInternal( gs );
map.Blocks = new byte[map.Volume];

int i = 0, lo, hi;
while ((lo = gs.ReadByte()) != -1) {
hi = gs.ReadByte();
int id = lo | (hi << 8);
int i = 0, id;
while ((id = gs.ReadByte()) != -1) {
gs.ReadByte(); // NOTE: This breaks the 5 block ids past 255, but I doubt they really had much use.

if (id <= (byte)Block.StoneBrick) map.Blocks[i] = (byte)id;
else map.Blocks[i] = Mapping[id & 0xFF];
// NOTE: This breaks the 5 block ids past 255, but I doubt they really had much use.
else map.Blocks[i] = Mapping[id];
i++;
}
return map;
Expand Down

0 comments on commit 182e276

Please sign in to comment.