Wynntils

Wynntils

611k Downloads

Container queries crash if `clickOnSlot` is the first step

kristofbolyai opened this issue ยท 4 comments

commented
[20:32:24] [Render thread/ERROR] (wynntils) Exception thrown by com.wynntils.screens.questbook.WynntilsQuestBookScreen.init()
 java.lang.NullPointerException: Cannot invoke "com.wynntils.handlers.container.type.ContainerContent.containerId()" because "container" is null
	at com.wynntils.handlers.container.scriptedquery.QueryStep.lambda$clickOnSlot$3(QueryStep.java:46) ~[main/:?]
	at com.wynntils.handlers.container.scriptedquery.QueryStep.startStep(QueryStep.java:85) ~[main/:?]
	at com.wynntils.handlers.container.scriptedquery.ScriptedContainerQuery.startStep(ScriptedContainerQuery.java:51) ~[main/:?]
	at com.wynntils.handlers.container.scriptedquery.FixedQueryStep.startStep(FixedQueryStep.java:23) ~[main/:?]
	at com.wynntils.handlers.container.scriptedquery.ScriptedContainerQuery.startStep(ScriptedContainerQuery.java:51) ~[main/:?]
	at com.wynntils.handlers.container.ContainerQueryHandler.runQuery(ContainerQueryHandler.java:73) ~[main/:?]
	at com.wynntils.handlers.container.scriptedquery.ScriptedContainerQuery.executeQuery(ScriptedContainerQuery.java:46) ~[main/:?]
	at com.wynntils.models.content.ContentBookQueries.queryContentBook(ContentBookQueries.java:140) ~[main/:?]
	at com.wynntils.models.content.ContentModel.scanContentBook(ContentModel.java:237) ~[main/:?]
	at com.wynntils.models.quests.QuestModel.rescanQuestBook(QuestModel.java:61) ~[main/:?]
	at com.wynntils.screens.questbook.WynntilsQuestBookScreen.doInit(WynntilsQuestBookScreen.java:77) ~[main/:?]
	at com.wynntils.screens.base.WynntilsScreen.init(WynntilsScreen.java:37) ~[main/:?]
	at net.minecraft.client.gui.screens.Screen.init(Screen.java:427) ~[[email protected]_19_4.layered+hash.529533973-v2.jar:?]
	at net.minecraft.client.Minecraft.setScreen(Minecraft.java:1079) ~[[email protected]_19_4.layered+hash.529533973-v2.jar:?]
	at com.wynntils.screens.base.WynntilsMenuScreenBase.openBook(WynntilsMenuScreenBase.java:32) ~[main/:?]
	at com.wynntils.features.ui.WynntilsContentBookFeature.tryCancelQuestBookOpen(WynntilsContentBookFeature.java:123) ~[main/:?]
	at com.wynntils.features.ui.WynntilsContentBookFeature.onUseItem(WynntilsContentBookFeature.java:97) ~[main/:?]
	at com.wynntils.features.ui.__WynntilsContentBookFeature_onUseItem_UseItemEvent.invoke(.dynamic) ~[?:?]
	at net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:73) ~[eventbus-6.0.5.jar:?]
	at net.minecraftforge.eventbus.EventBus.post(EventBus.java:315) ~[eventbus-6.0.5.jar:?]
	at net.minecraftforge.eventbus.EventBus.post(EventBus.java:296) ~[eventbus-6.0.5.jar:?]
	at com.wynntils.core.events.EventBusWrapper.post(EventBusWrapper.java:54) ~[main/:?]
	at com.wynntils.core.WynntilsMod.postEvent(WynntilsMod.java:69) ~[main/:?]
	at com.wynntils.core.events.MixinHelper.post(MixinHelper.java:21) ~[main/:?]
	at net.minecraft.client.multiplayer.MultiPlayerGameMode.handler$zbp000$wynntils$useItemPre(MultiPlayerGameMode.java:661) ~[[email protected]_19_4.layered+hash.529533973-v2.jar:?]
	at net.minecraft.client.multiplayer.MultiPlayerGameMode.useItem(MultiPlayerGameMode.java) ~[[email protected]_19_4.layered+hash.529533973-v2.jar:?]
	at net.minecraft.client.Minecraft.startUseItem(Minecraft.java:1819) ~[[email protected]_19_4.layered+hash.529533973-v2.jar:?]
	at net.minecraft.client.Minecraft.handleKeybinds(Minecraft.java:2053) ~[[email protected]_19_4.layered+hash.529533973-v2.jar:?]
	at net.minecraft.client.Minecraft.tick(Minecraft.java:1880) ~[[email protected]_19_4.layered+hash.529533973-v2.jar:?]
	at net.minecraft.client.Minecraft.runTick(Minecraft.java:1180) ~[[email protected]_19_4.layered+hash.529533973-v2.jar:?]
	at net.minecraft.client.Minecraft.run(Minecraft.java:801) ~[[email protected]_19_4.layered+hash.529533973-v2.jar:?]
	at net.minecraft.client.main.Main.main(Main.java:237) ~[[email protected]_19_4.layered+hash.529533973-v2.jar:?]
	at net.fabricmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:468) ~[fabric-loader-0.14.21.jar:?]
	at net.fabricmc.loader.impl.launch.knot.Knot.launch(Knot.java:74) ~[fabric-loader-0.14.21.jar:?]
	at net.fabricmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:23) ~[fabric-loader-0.14.21.jar:?]
	at net.fabricmc.devlaunchinjector.Main.main(Main.java:86) ~[dev-launch-injector-0.2.1+build.8.jar:?]
	at dev.architectury.transformer.TransformerRuntime.main(TransformerRuntime.java:219) ~[architectury-transformer-5.2.76-runtime.jar:?]
commented

Happened while I am working on a better way to open the quest book.

commented

I sent a patch containing what was trying to make the queries more stable...

commented

Yeah... you can't really do that. There is no previous container, so we pass in null. (This too is documented ;-))

What was your intention? To work with an existing open container?

commented

Ah, I see. Yeah, your patch was good, but the clickOnSlot method in the scripted query assumes you will receive a ContainerContent object from a preceding container query operation. This, however, is not documented. :-D