Payload stances changed to commands

This commit is contained in:
Anuken
2023-09-22 18:32:35 -04:00
parent 9762507db6
commit 06a5201ae8
6 changed files with 29 additions and 17 deletions

View File

@@ -311,7 +311,7 @@ public class TypeIO{
public static @Nullable UnitCommand readCommand(Reads read){
int val = read.ub();
return val == 255 ? null : UnitCommand.all.get(val);
return val == 255 || val >= UnitCommand.all.size ? null : UnitCommand.all.get(val);
}
public static void writeStance(Writes write, @Nullable UnitStance stance){
@@ -321,7 +321,7 @@ public class TypeIO{
public static UnitStance readStance(Reads read){
int val = read.ub();
//never returns null
return val == 255 ? UnitStance.shoot : UnitStance.all.get(val);
return val == 255 || val >= UnitStance.all.size ? UnitStance.shoot : UnitStance.all.get(val);
}
public static void writeEntity(Writes write, Entityc entity){