Better IO

This commit is contained in:
Anuken
2020-02-13 22:11:59 -05:00
parent e3621f44da
commit 09c57c32d6
54 changed files with 568 additions and 619 deletions

View File

@@ -1,9 +1,8 @@
package mindustry.world;
import arc.util.*;
import mindustry.type.Item;
import java.io.*;
import arc.util.io.*;
import mindustry.type.*;
import static mindustry.Vars.content;
@@ -60,19 +59,19 @@ public class ItemBuffer{
index--;
}
public void write(DataOutput stream) throws IOException{
stream.writeByte((byte)index);
stream.writeByte((byte)buffer.length);
public void write(Writes write){
write.b((byte)index);
write.b((byte)buffer.length);
for(long l : buffer){
stream.writeLong(l);
write.l(l);
}
}
public void read(DataInput stream) throws IOException{
index = stream.readByte();
byte length = stream.readByte();
public void read(Reads read){
index = read.b();
byte length = read.b();
for(int i = 0; i < length; i++){
long l = stream.readLong();
long l = read.l();
if(i < buffer.length){
buffer[i] = l;
}