Skip to content

Commit

Permalink
UnitType serializer set
Browse files Browse the repository at this point in the history
  • Loading branch information
Anuken committed Oct 14, 2020
1 parent d630110 commit 2b435c2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 12 additions & 0 deletions core/src/mindustry/io/JsonIO.java
Expand Up @@ -165,6 +165,18 @@ public Weather read(Json json, JsonValue jsonData, Class type){
}
});

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){
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle
@@ -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"]}")
}

Expand Down

0 comments on commit 2b435c2

Please sign in to comment.