int nparticles = data.readInt();
particles = new ArrayList<ParticleCount>(nparticles);
for(int i = 0; i < nparticles; i++) {
int particle = data.readByte();
int amount = data.readInt();
particles.add(new ParticleCount(Particles.values()[particle], amount));
}
}