UnitType serializer set

This commit is contained in:
Anuken
2020-10-14 09:13:29 -04:00
parent d630110396
commit 2b435c2600
2 changed files with 13 additions and 1 deletions

View File

@@ -165,6 +165,18 @@ public class JsonIO{
}
});
json.setSerializer(UnitType.class, new Serializer<>(){
@Override
public void write(Json json, UnitType object, Class knownType){
json.writeValue(object.name);
}
@Override
public UnitType read(Json json, JsonValue jsonData, Class type){
return Vars.content.getByName(ContentType.unit, jsonData.asString());
}
});
json.setSerializer(ItemStack.class, new Serializer<>(){
@Override
public void write(Json json, ItemStack object, Class knownType){