private List<EncounterSet> getEncountersHGSS(boolean useTimeOfDay)
			throws IOException {
		String encountersFile = romEntry.getString("WildPokemon");
		NARCContents encounterData = readNARC(encountersFile);
		List<EncounterSet> encounters = new ArrayList<EncounterSet>();
		// Credit for
		// https://github.com/magical/pokemon-encounters/blob/master/nds/encounters-gen4-johto.py
		// for the structure for this.
		int[] amounts = new int[] { 0, 5, 2, 5, 5, 5 };
		for (byte[] b : encounterData.files) {
			int[] rates = new int[6];
			rates[0] = b[0] & 0xFF;
			rates[1] = b[1] & 0xFF;
			rates[2] = b[2] & 0xFF;
			rates[3] = b[3] & 0xFF;
			rates[4] = b[4] & 0xFF;
			rates[5] = b[5] & 0xFF;
			// Up to 8 after the rates
			// Grass has to be handled on its own because the levels
			// are reused for every time of day
			int[] grassLevels = new int[12];
			for (int i = 0; i < 12; i++) {
				grassLevels[i] = b[8 + i] & 0xFF;
			}
			// Up to 20 now (12 for levels)
			Pokemon[][] grassPokes = new Pokemon[3][12];
			grassPokes[0] = readPokemonHGSS(b, 20, 12);
			grassPokes[1] = readPokemonHGSS(b, 44, 12);
			grassPokes[2] = readPokemonHGSS(b, 68, 12);
			// Up to 92 now (12*2*3 for pokemon)
			if (rates[0] != 0) {
				if (!useTimeOfDay) {
					// Just write "day" encounters
					List<Encounter> grassEncounters = stitchEncsToLevels(
							grassPokes[1], grassLevels);
					EncounterSet grass = new EncounterSet();
					grass.encounters = grassEncounters;
					grass.rate = rates[0];
					encounters.add(grass);
				} else {
					for (int i = 0; i < 3; i++) {
						EncounterSet grass = new EncounterSet();
						grass.encounters = stitchEncsToLevels(grassPokes[i],
								grassLevels);
						grass.rate = rates[0];
						encounters.add(grass);
					}
				}
			}

			// Hoenn/Sinnoh Radio
			EncounterSet radio = readOptionalEncountersHGSS(b, 92, 4);
			if (radio.encounters.size() > 0) {
				encounters.add(radio);
			}

			// Up to 100 now... 2*2*2 for radio pokemon
			int offset = 100;
			for (int i = 1; i < 6; i++) {
				List<Encounter> encountersHere = readSeaEncountersHGSS(b,
						offset, amounts[i]);
				offset += 4 * amounts[i];
				if (rates[i] != 0) {
					// Valid area.
					EncounterSet other = new EncounterSet();
					other.encounters = encountersHere;
					other.rate = rates[i];
					encounters.add(other);
				}
			}

			// Swarms
			EncounterSet swarms = readOptionalEncountersHGSS(b, offset, 4);
			if (swarms.encounters.size() > 0) {
				encounters.add(swarms);
			}
		}
		return encounters;
	}