Fixed status parsing

This commit is contained in:
Anuken 2022-02-14 11:14:24 -05:00
parent d7dffe4241
commit ea639dfee0

View File

@ -88,18 +88,6 @@ public class ContentParser{
}
}
});
put(StatusEffect.class, (type, data) -> {
if(data.isString()){
StatusEffect result = locate(ContentType.status, data.asString());
if(result != null) return result;
result = (StatusEffect)fieldOpt(StatusEffects.class, data);
if(result != null) return result;
throw new IllegalArgumentException("Unknown status effect: '" + data.asString() + "'");
}
StatusEffect effect = new StatusEffect(currentMod.name + "-" + data.getString("name"));
readFields(effect, data);
return effect;
});
put(Color.class, (type, data) -> Color.valueOf(data.asString()));
put(BulletType.class, (type, data) -> {
if(data.isString()){
@ -520,6 +508,19 @@ public class ContentParser{
currentContent = planet;
read(() -> readFields(planet, value));
return planet;
},
ContentType.status, (TypeParser<StatusEffect>)(mod, name, value) -> {
if(value.isString()){
StatusEffect result = locate(ContentType.status, value.asString());
if(result != null) return result;
result = (StatusEffect)fieldOpt(StatusEffects.class, value);
if(result != null) return result;
throw new IllegalArgumentException("Unknown status effect: '" + value.asString() + "'");
}
StatusEffect effect = new StatusEffect(currentMod.name + "-" + value.getString("name"));
currentContent = effect;
readFields(effect, value);
return effect;
}
);