Better IO
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
package mindustry.world;
|
||||
|
||||
import mindustry.annotations.Annotations.Struct;
|
||||
import arc.util.Time;
|
||||
import mindustry.gen.BufferItem;
|
||||
import mindustry.type.Item;
|
||||
import arc.util.*;
|
||||
import arc.util.io.*;
|
||||
import mindustry.annotations.Annotations.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.type.*;
|
||||
|
||||
import java.io.*;
|
||||
|
||||
@@ -46,22 +47,22 @@ public class DirectionalItemBuffer{
|
||||
indexes[buffer] --;
|
||||
}
|
||||
|
||||
public void write(DataOutput stream) throws IOException{
|
||||
public void write(Writes write){
|
||||
for(int i = 0; i < 4; i++){
|
||||
stream.writeByte(indexes[i]);
|
||||
stream.writeByte(buffers[i].length);
|
||||
write.b(indexes[i]);
|
||||
write.b(buffers[i].length);
|
||||
for(long l : buffers[i]){
|
||||
stream.writeLong(l);
|
||||
write.l(l);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void read(DataInput stream) throws IOException{
|
||||
public void read(Reads read){
|
||||
for(int i = 0; i < 4; i++){
|
||||
indexes[i] = stream.readByte();
|
||||
byte length = stream.readByte();
|
||||
indexes[i] = read.b();
|
||||
byte length = read.b();
|
||||
for(int j = 0; j < length; j++){
|
||||
long value = stream.readLong();
|
||||
long value = read.l();
|
||||
if(j < buffers[i].length){
|
||||
buffers[i][j] = value;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user