This commit is contained in:
Anuken
2021-02-07 10:21:38 -05:00
parent fdafa0933f
commit ca78cb1a3f
2 changed files with 7 additions and 6 deletions

View File

@@ -396,7 +396,6 @@ public class NetClient implements ApplicationListener{
netClient.byteStream.setBytes(net.decompressSnapshot(data, dataLen));
DataInputStream input = netClient.dataStream;
//go through each entity
for(int j = 0; j < amount; j++){
int id = input.readInt();
byte typeID = input.readByte();

View File

@@ -845,13 +845,15 @@ public class NetServer implements ApplicationListener{
public void writeEntitySnapshot(Player player) throws IOException{
syncStream.reset();
Seq<CoreBuild> cores = state.teams.cores(player.team());
int sum = state.teams.present.sum(t -> t.cores.size);
dataStream.writeByte(cores.size);
dataStream.writeByte(sum);
for(CoreBuild entity : cores){
dataStream.writeInt(entity.tile.pos());
entity.items.write(Writes.get(dataStream));
for(TeamData data : state.teams.present){
for(CoreBuild entity : data.cores){
dataStream.writeInt(entity.tile.pos());
entity.items.write(Writes.get(dataStream));
}
}
dataStream.close();