Infinite eating metal loop
steve-the-player opened this issue · 7 comments
Issue description
if you open the powers menu while eating a metal nugget, when you exit, you will continue to automatically eat the metal until you switch hotbar slots
(this can be a big deal if it's in your offhand and an expensive/rarer metal)
Steps to reproduce
- Start eating a metal nugget (right click and hold)
- open the powers menu
- hover over the allomantic power you were just eating a metal for
- let go of right click
- exit the menu
Minecraft version
1.20.1 (Latest)
Forge version
47.3.0
Cosmere version
0.7.95
Other relevant versions
No response
If a (crash)log is relevant for this issue, link it here: (It's almost always relevant)
No response
This also works for metal vials. It will also stop when you open inventory
I can recreate this bug, but can't seem to figure out how to make it stop 😅 it doesn't seem to happen for other screens like the inventory.
I suspect it's related to how we open the menu weirdly. We don't do the full call to opening a screen, just sort of say 'oh by the way this screen is up at the moment'.
To me, it looks like Minecraft "remembers" that you were holding left click before the menu wrenches away mouse control. If you scroll in the hotbar, it'll place blocks and use items, so it's not just continuing an action. Gonna see if I can't hack-fix it B)
Leaf was right, it works if we open it normally. That does seem to remove the background shadow, however. This seems to be the reason we didn't open it normally in the first place (thanks Leaf). I'll see if I can fix it
I see. Same principle as why the click acts weird when we don't open the screen normally except reversed; it stops reading any previous input from before the Screen
was opened. So, Keybindings.MANIFESTATION_MENU.isDown()
starts returning false, and so the if-statement never passes the condition. Easy fix: don't use the keybind :)
Instead, I do this (minecraft
is now set in the constructor so it's always in memory):
if (this.minecraft.screen == SpiritwebMenu.instance)
{
raiseVisibility();
}