Commandable blocks

This commit is contained in:
Anuken
2022-02-17 16:19:07 -05:00
parent 49a39d42e7
commit 9f3af412f0
12 changed files with 177 additions and 16 deletions

View File

@@ -486,6 +486,21 @@ public class TypeIO{
return JsonIO.read(Rules.class, string);
}
public static void writeVecNullable(Writes write, @Nullable Vec2 v){
if(v == null){
write.f(Float.NaN);
write.f(Float.NaN);
}else{
write.f(v.x);
write.f(v.y);
}
}
public static @Nullable Vec2 readVecNullable(Reads read){
float x = read.f(), y = read.f();
return Float.isNaN(x) || Float.isNaN(y) ? null : new Vec2(x, y);
}
public static void writeVec2(Writes write, Vec2 v){
if(v == null){
write.f(0);