Select command from reconstructor / Units save command when controlled

This commit is contained in:
Anuken
2023-05-30 20:08:48 -04:00
parent 7911a22cc9
commit b6f5d424da
8 changed files with 103 additions and 9 deletions

View File

@@ -301,12 +301,13 @@ public class TypeIO{
return Nulls.unit;
}
public static void writeCommand(Writes write, UnitCommand command){
write.b(command.id);
public static void writeCommand(Writes write, @Nullable UnitCommand command){
write.b(command == null ? 255 : command.id);
}
public static UnitCommand readCommand(Reads read){
return UnitCommand.all.get(read.ub());
public static @Nullable UnitCommand readCommand(Reads read){
int val = read.ub();
return val == 255 ? null : UnitCommand.all.get(val);
}
public static void writeEntity(Writes write, Entityc entity){