Custom Gates won't accept NBT modifiers to entities
SargeRyong opened this issue ยท 4 comments
In MC 1.18.2, forge 40.2.0, gateways 2.2.1
Possible I'm doing something wildly wrong here, but I'm at my wit's end trying to figure out why Gateways won't parse my gates with custom entity nbt.
If I remove the nbt tags from my entities, it parses just fine, but even a simple one causes it to choke.
For example, this entity in a gate with only a single wave:
"entities": [{
"entity": "minecraft:zombie",
"nbt": {"ArmorItems": [{"id": "minecraft:leather_boots","Count": 1}]}
}]
results in the following error:
[18Aug2023 08:17:25.974] [Worker-Main-2/ERROR] [Gateways to Eternity/]: Failed parsing gateways file gatewaystoeternity:test_gate.
[18Aug2023 08:17:25.974] [Worker-Main-2/ERROR] [Gateways to Eternity/]: Underlying Exception:
java.lang.RuntimeException: java.lang.UnsupportedOperationException: JsonObject
at shadows.placebo.json.SerializerBuilder.lambda$coerce$0(SerializerBuilder.java:72) ~[Placebo-1.18.2-6.6.6.jar%23304!/:6.6.6]
at shadows.placebo.json.SerializerBuilder.lambda$autoRegister$2(SerializerBuilder.java:87) ~[Placebo-1.18.2-6.6.6.jar%23304!/:6.6.6]
at shadows.placebo.json.SerializerBuilder$Serializer.read(SerializerBuilder.java:155) ~[Placebo-1.18.2-6.6.6.jar%23304!/:6.6.6]
at shadows.gateways.gate.Wave.read(Wave.java:158) ~[GatewaysToEternity-1.18.2-2.2.1.jar%23198!/:?]
at shadows.gateways.gate.Wave$Serializer.deserialize(Wave.java:226) ~[GatewaysToEternity-1.18.2-2.2.1.jar%23198!/:?]
at shadows.gateways.gate.Wave$Serializer.deserialize(Wave.java:217) ~[GatewaysToEternity-1.18.2-2.2.1.jar%23198!/:?]
If I instead encapsulate the nbt object in single quotes
"entities": [{
"entity": "minecraft:zombie",
"nbt": '{"ArmorItems": [{"id": "minecraft:leather_boots","Count": 1}]}'
}]
I get this error instead:
Use JsonReader.setLenient(true) to accept malformed JSON at line 7 column 12 path $.waves[0].entities[0].nbt
I've checked and double checked and run the thing through a JSON validator dozens of times just to make sure an it is not malformed, so I have no idea what's going on here. Is this a bug or am I just very confused?
Single quotes are (iirc) not valid json syntax to the strict gson parser. You have to use double quotes, and inner quotes have to be escaped: \"
So what you probably want is
"entities": [{
"entity": "minecraft:zombie",
"nbt": "{\"ArmorItems\": [{\"id\": \"minecraft:leather_boots\",\"Count\": 1}]}"
}]
Oh, that was quick, thanks!
Using the string version, double-quoting, and escaping my inner quotes seems to have it working correctly.
Any idea why the object version of the tag isn't getting parsed, though? (the cause of the "UnsupportedOperationException: JsonObject" from the first stack trace)
I updated to gateways 2.3.0 just to make sure I wasn't looking at the wrong version of the schema, but it failed in the same way.
Regardless, I have a way forward now, tyvm!
The object parser was not added until 1.19, in 1.18 and prior only the stringified-nbt parser is present.