
[Bug] "NotConnectionPredicate" data generation not working.
Closed this issue · 1 comments
Version Info
- Minecraft, 1.21.1
- Fusion, 1.2.7b
What mod loader are you using?: NeoForge
Are you using OptiFine: No
Description of the Bug
When using "NotConnectionPredicate" as shown in Steps to Reproduce for data generation it generates:
{
"type": "fusion:not",
"predicates": {
...
}
}
This does not work, however changing "predicates" to "predicate" does.
It looks like this is caused by the below code where "deserialize" is checking for "predicate" where as "serialize" is using "predicates".
public static final Serializer<NotConnectionPredicate> SERIALIZER = new Serializer<NotConnectionPredicate>() {
public NotConnectionPredicate deserialize(JsonObject json) throws JsonParseException {
if (json.has("predicate") && json.get("predicate").isJsonObject()) {
ConnectionPredicate predicate = FusionPredicateRegistry.deserializeConnectionPredicate(json.getAsJsonObject("predicate"));
return new NotConnectionPredicate(predicate);
} else {
throw new JsonParseException("Not-predicate must have object property 'predicate'!");
}
}
public JsonObject serialize(NotConnectionPredicate value) {
JsonObject json = new JsonObject();
json.add("predicates", FusionPredicateRegistry.serializeConnectionPredicate(value.predicate));
return json;
}
};
Steps to Reproduce
Generate data for model using below code:
DefaultConnectionPredicates.not(
DefaultConnectionPredicates.and(
...
)
)