Mobile manual aiming / Mobile control changes [UNSTABLE]
This commit is contained in:
@@ -37,64 +37,61 @@ public class TypeIO{
|
||||
public static void writeObject(Writes write, Object object){
|
||||
if(object == null){
|
||||
write.b((byte)0);
|
||||
}else if(object instanceof Integer){
|
||||
}else if(object instanceof Integer i){
|
||||
write.b((byte)1);
|
||||
write.i((Integer)object);
|
||||
}else if(object instanceof Long){
|
||||
write.i(i);
|
||||
}else if(object instanceof Long l){
|
||||
write.b((byte)2);
|
||||
write.l((Long)object);
|
||||
}else if(object instanceof Float){
|
||||
write.l(l);
|
||||
}else if(object instanceof Float f){
|
||||
write.b((byte)3);
|
||||
write.f((Float)object);
|
||||
}else if(object instanceof String){
|
||||
write.f(f);
|
||||
}else if(object instanceof String s){
|
||||
write.b((byte)4);
|
||||
writeString(write, (String)object);
|
||||
}else if(object instanceof Content){
|
||||
Content map = (Content)object;
|
||||
writeString(write, s);
|
||||
}else if(object instanceof Content map){
|
||||
write.b((byte)5);
|
||||
write.b((byte)map.getContentType().ordinal());
|
||||
write.s(map.id);
|
||||
}else if(object instanceof IntSeq){
|
||||
}else if(object instanceof IntSeq arr){
|
||||
write.b((byte)6);
|
||||
IntSeq arr = (IntSeq)object;
|
||||
write.s((short)arr.size);
|
||||
for(int i = 0; i < arr.size; i++){
|
||||
write.i(arr.items[i]);
|
||||
}
|
||||
}else if(object instanceof Point2){
|
||||
}else if(object instanceof Point2 p){
|
||||
write.b((byte)7);
|
||||
write.i(((Point2)object).x);
|
||||
write.i(((Point2)object).y);
|
||||
}else if(object instanceof Point2[]){
|
||||
write.i(p.x);
|
||||
write.i(p.y);
|
||||
}else if(object instanceof Point2[] p){
|
||||
write.b((byte)8);
|
||||
write.b(((Point2[])object).length);
|
||||
for(int i = 0; i < ((Point2[])object).length; i++){
|
||||
write.i(((Point2[])object)[i].pack());
|
||||
write.b(p.length);
|
||||
for(Point2 point2 : p){
|
||||
write.i(point2.pack());
|
||||
}
|
||||
}else if(object instanceof TechNode){
|
||||
TechNode map = (TechNode)object;
|
||||
}else if(object instanceof TechNode map){
|
||||
write.b(9);
|
||||
write.b((byte)map.content.getContentType().ordinal());
|
||||
write.s(map.content.id);
|
||||
}else if(object instanceof Boolean){
|
||||
}else if(object instanceof Boolean b){
|
||||
write.b((byte)10);
|
||||
write.bool((Boolean)object);
|
||||
}else if(object instanceof Double){
|
||||
write.bool(b);
|
||||
}else if(object instanceof Double d){
|
||||
write.b((byte)11);
|
||||
write.d((Double)object);
|
||||
}else if(object instanceof Building){
|
||||
write.b((byte)12);
|
||||
write.i(((Building)object).pos());
|
||||
}else if(object instanceof LAccess){
|
||||
write.d(d);
|
||||
}else if(object instanceof Building b){
|
||||
write.b(12);
|
||||
write.i(b.pos());
|
||||
}else if(object instanceof LAccess l){
|
||||
write.b((byte)13);
|
||||
write.s(((LAccess)object).ordinal());
|
||||
}else if(object instanceof byte[]){
|
||||
write.s(l.ordinal());
|
||||
}else if(object instanceof byte[] b){
|
||||
write.b((byte)14);
|
||||
write.i(((byte[])object).length);
|
||||
write.b((byte[])object);
|
||||
}else if(object instanceof UnitCommand){
|
||||
write.i(b.length);
|
||||
write.b(b);
|
||||
}else if(object instanceof UnitCommand c){
|
||||
write.b((byte)15);
|
||||
write.b(((UnitCommand)object).ordinal());
|
||||
write.b(c.ordinal());
|
||||
}else{
|
||||
throw new IllegalArgumentException("Unknown object type: " + object.getClass());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user