Patcher fixes

This commit is contained in:
Anuken 2025-10-22 07:01:26 -04:00
parent 49bbd0b593
commit 45db096f0f
2 changed files with 6 additions and 0 deletions

View file

@ -97,6 +97,7 @@ public class ContentParser{
}
}
});
put(TextureRegion.class, (type, data) -> Core.atlas.find(data.asString()));
put(Color.class, (type, data) -> Color.valueOf(data.asString()));
put(StatusEffect.class, (type, data) -> {
if(data.isString()){

View file

@ -242,6 +242,11 @@ public class ContentPatcher{
if(value instanceof JsonValue jsv){ //setting values from object
if(prevValue == null || !jsv.isObject() || jsv.has("type")){
if(UnlockableContent.class.isAssignableFrom(metadata.type) && (jsv.isObject())){
warn("New content must not be instantiated: @", jsv);
return;
}
if(modify) modifiedField(object, field, getter.get());
try{
setter.get(json.readValue(metadata.type, metadata.elementType, jsv));