Fixed status parsing
This commit is contained in:
@@ -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(Color.class, (type, data) -> Color.valueOf(data.asString()));
|
||||||
put(BulletType.class, (type, data) -> {
|
put(BulletType.class, (type, data) -> {
|
||||||
if(data.isString()){
|
if(data.isString()){
|
||||||
@@ -520,6 +508,19 @@ public class ContentParser{
|
|||||||
currentContent = planet;
|
currentContent = planet;
|
||||||
read(() -> readFields(planet, value));
|
read(() -> readFields(planet, value));
|
||||||
return planet;
|
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;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user