* WARNING! The files written by this method probably won't load in the Notchian server. Make backups.
*/
@Override
public void write(int x, int z, Chunk chunk) throws IOException {
CompoundTag levelTag = chunkToTag(chunk);
RegionFile region = cache.getRegionFile(dir, x, z);
int regionX = x & (REGION_SIZE - 1);
int regionZ = z & (REGION_SIZE - 1);
DataOutputStream out = region.getChunkDataOutputStream(regionX, regionZ);
try {
NBTOutputStream nbtOut = new NBTOutputStream(out, false);
Map<String, Tag> tagMap = new HashMap<String, Tag>(1);
tagMap.put("Level", levelTag);