Netcode updates

This commit is contained in:
Anuken
2021-06-02 16:51:52 -04:00
parent eba6514fb5
commit 462a64bf21
4 changed files with 44 additions and 13 deletions

View File

@@ -2,7 +2,17 @@ package mindustry.net;
import arc.util.io.*;
import java.io.*;
public abstract class Packet{
//internally used by generated code
//TODO intermediate buffers should ONLY be needed for:
//readObject
//readBuilding
//readUnit (possibly)
protected static final ReusableByteInStream BAIS = new ReusableByteInStream();
protected static final Reads READ = new Reads(new DataInputStream(BAIS));
//these are constants because I don't want to bother making an enum to mirror the annotation enum
/** Does not get handled unless client is connected. */
@@ -15,6 +25,10 @@ public abstract class Packet{
public void read(Reads read){}
public void write(Writes write){}
public void read(Reads read, int length){
read(read);
}
public int getPriority(){
return priorityNormal;
}