mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-01-20 17:28:14 +07:00
Fixed status parsing
This commit is contained in:
parent
d7dffe4241
commit
ea639dfee0
@ -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;
|
||||
}
|
||||
);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user