Switched to HJson content parsing

This commit is contained in:
Anuken
2019-11-13 19:12:12 -05:00
parent d8c997b355
commit 3106389f6a
2 changed files with 4 additions and 6 deletions

View File

@ -14,6 +14,7 @@ import io.anuke.arc.util.reflect.Field;
import io.anuke.arc.util.reflect.*;
import io.anuke.arc.util.serialization.*;
import io.anuke.arc.util.serialization.Json.*;
import io.anuke.arc.util.serialization.Jval.*;
import io.anuke.mindustry.*;
import io.anuke.mindustry.content.*;
import io.anuke.mindustry.content.TechTree.*;
@ -182,7 +183,7 @@ public class ContentParser{
}else if(child.name.equals("liquid")){
block.consumes.add((Consume)parser.readValue(ConsumeLiquid.class, child));
}else if(child.name.equals("power")){
if(child.isDouble()){
if(child.isNumber()){
block.consumes.power(child.asFloat());
}else{
block.consumes.add((Consume)parser.readValue(ConsumePower.class, child));
@ -342,10 +343,7 @@ public class ContentParser{
init();
}
//add comments starting with //, but ignore links
json = json.replace("http://", "http:~~").replace("https://", "https:~~").replaceAll("//.*?\n","\n").replace("http:~~", "http://").replace("https:~~", "https://");
JsonValue value = parser.fromJson(null, json);
JsonValue value = parser.fromJson(null, Jval.read(json).toString(JsonFormat.plain));
if(!parsers.containsKey(type)){
throw new SerializationException("No parsers for content type '" + type + "'");
}

View File

@ -1,3 +1,3 @@
org.gradle.daemon=true
org.gradle.jvmargs=-Xms256m -Xmx1024m
archash=4082a8d53d41e79d3eb735d0daf4c0f412066f3e
archash=5019282ec7f078174fd4d6794baee85ebfe311ba