Patbox / TextPlaceholderAPI

Placeholder API for Fabric
GNU Lesser General Public License v3.0
38 stars 17 forks source link

[1.20.4] Not bootstrapped (called from registry ResourceKey[minecraft:root / minecraft:game_event) #51

Closed axieum closed 7 months ago

axieum commented 9 months ago

Just updating my dependencies to 1.20.3+, and noticed an error when parsing text nodes.

Caused by: java.lang.IllegalArgumentException: Not bootstrapped (called from registry ResourceKey[minecraft:root / minecraft:game_event])
    at net.minecraft.Bootstrap.createNotBootstrappedException(Bootstrap.java:123) ~[minecraft-merged-736734f32e-1.20.4-net.fabricmc.yarn.1_20_4.1.20.4+build.1-v2.jar:?]
    at net.minecraft.Bootstrap.ensureBootstrapped(Bootstrap.java:116) ~[minecraft-merged-736734f32e-1.20.4-net.fabricmc.yarn.1_20_4.1.20.4+build.1-v2.jar:?]
    at net.minecraft.registry.Registries.create(Registries.java:230) ~[minecraft-merged-736734f32e-1.20.4-net.fabricmc.yarn.1_20_4.1.20.4+build.1-v2.jar:?]
    at net.minecraft.registry.Registries.createIntrusive(Registries.java:225) ~[minecraft-merged-736734f32e-1.20.4-net.fabricmc.yarn.1_20_4.1.20.4+build.1-v2.jar:?]
    at net.minecraft.registry.Registries.createIntrusive(Registries.java:213) ~[minecraft-merged-736734f32e-1.20.4-net.fabricmc.yarn.1_20_4.1.20.4+build.1-v2.jar:?]
    at net.minecraft.registry.Registries.<clinit>(Registries.java:127) ~[minecraft-merged-736734f32e-1.20.4-net.fabricmc.yarn.1_20_4.1.20.4+build.1-v2.jar:?]
    at net.minecraft.text.HoverEvent$ItemStackContent.method_54202(HoverEvent.java:148) ~[minecraft-merged-736734f32e-1.20.4-net.fabricmc.yarn.1_20_4.1.20.4+build.1-v2.jar:?]
    at com.mojang.serialization.codecs.RecordCodecBuilder.create(RecordCodecBuilder.java:72) ~[datafixerupper-6.0.8.jar:?]
    at net.minecraft.text.HoverEvent$ItemStackContent.<clinit>(HoverEvent.java:148) ~[minecraft-merged-736734f32e-1.20.4-net.fabricmc.yarn.1_20_4.1.20.4+build.1-v2.jar:?]
    at net.minecraft.text.HoverEvent$Action.<clinit>(HoverEvent.java:225) ~[minecraft-merged-736734f32e-1.20.4-net.fabricmc.yarn.1_20_4.1.20.4+build.1-v2.jar:?]
    at eu.pb4.placeholders.impl.textparser.TextTags.lambda$register$12(TextTags.java:303) ~[placeholder-api-2.3.0+1.20.3.jar:?]
    at eu.pb4.placeholders.impl.textparser.TextParserImpl.recursiveParsing(TextParserImpl.java:149) ~[placeholder-api-2.3.0+1.20.3.jar:?]
    at eu.pb4.placeholders.impl.textparser.TextTags.lambda$register$8(TextTags.java:231) ~[placeholder-api-2.3.0+1.20.3.jar:?]
    at eu.pb4.placeholders.impl.textparser.TextParserImpl.recursiveParsing(TextParserImpl.java:149) ~[placeholder-api-2.3.0+1.20.3.jar:?]
    at eu.pb4.placeholders.impl.textparser.TextParserImpl.parse(TextParserImpl.java:44) ~[placeholder-api-2.3.0+1.20.3.jar:?]
    at eu.pb4.placeholders.api.parsers.TextParserV1.parseNodesWith(TextParserV1.java:96) ~[placeholder-api-2.3.0+1.20.3.jar:?]
    at eu.pb4.placeholders.api.parsers.TextParserV1.parseNodes(TextParserV1.java:83) ~[placeholder-api-2.3.0+1.20.3.jar:?]
    at eu.pb4.placeholders.impl.textparser.MergedParser.parseNodes(MergedParser.java:17) ~[placeholder-api-2.3.0+1.20.3.jar:?]
    at eu.pb4.placeholders.api.parsers.NodeParser.parseNode(NodeParser.java:17) ~[placeholder-api-2.3.0+1.20.3.jar:?]
    at eu.pb4.placeholders.api.parsers.NodeParser.parseNode(NodeParser.java:21) ~[placeholder-api-2.3.0+1.20.3.jar:?]

Any ideas? I am calling parseNode during pre launch when my configuration is loaded, to have pre-parsed nodes to speed up placeholder replacement later.

Patbox commented 9 months ago

Yeah ideally you shouldn't use any classes from Placeholder API in pre-launch, as most of them would initialize vanilla ones causing further issues!