Serialization that makes more sense

This commit is contained in:
Anuken
2020-05-08 20:22:11 -04:00
parent aab97fefc8
commit 8d5cd7b814
10 changed files with 36 additions and 22 deletions
+5 -5
View File
@@ -252,8 +252,8 @@ public abstract class SaveVersion extends SaveFileReader{
}
}
stream.writeInt(Groups.sync.count(Entityc::serialize));
for(Syncc entity : Groups.sync){
stream.writeInt(Groups.all.count(Entityc::serialize));
for(Entityc entity : Groups.all){
if(!entity.serialize()) continue;
writeChunk(stream, true, out -> {
@@ -278,9 +278,9 @@ public abstract class SaveVersion extends SaveFileReader{
for(int j = 0; j < amount; j++){
readChunk(stream, true, in -> {
byte typeid = in.readByte();
Syncc sync = (Syncc)EntityMapping.map(typeid).get();
sync.read(Reads.get(in));
sync.add();
Entityc entity = (Entityc)EntityMapping.map(typeid).get();
entity.read(Reads.get(in));
entity.add();
});
}
}