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
+12
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<>(){ json.setSerializer(ItemStack.class, new Serializer<>(){
@Override @Override
public void write(Json json, ItemStack object, Class knownType){ public void write(Json json, ItemStack object, Class knownType){
+1 -1
View File
@@ -1,4 +1,4 @@
if(JavaVersion.current().ordinal() < JavaVersion.VERSION_14.ordinal() && System.getenv("JITPACK") != "true"){ if(JavaVersion.current().ordinal() < JavaVersion.VERSION_14.ordinal()){
throw new GradleException("!!! YOU MUST USE JAVA 14 OR ABOVE TO COMPILE AND RUN MINDUSTRY !!! Read the README. Your version: ${System.properties["java.version"]}") throw new GradleException("!!! YOU MUST USE JAVA 14 OR ABOVE TO COMPILE AND RUN MINDUSTRY !!! Read the README. Your version: ${System.properties["java.version"]}")
} }