yurisuika / Raised

Raises the hotbar so the selector is not cut off!
GNU Lesser General Public License v3.0
17 stars 5 forks source link

Sometimes items are raised #69

Closed Aceplante2 closed 9 months ago

Aceplante2 commented 10 months ago

Sometimes items are raised a few pixels causing them to misalign with the inventory grid. But this only happens in survival.

forge 1.18.2

yurisuika commented 10 months ago

If you are having some issue, provide more information like logs, mod list, screenshots, whatever you can.

Aceplante2 commented 10 months ago

Yes, at the time I had removed your mod temporarily and it hasn't happened since, but Ill test it out later.

mikewk commented 10 months ago

I've run into this issue as well in 1.18.2. In my case have narrowed it down to an interaction with Mantle's extra heart rendering feature. With the feature turned on, it looks like somethings are rendered correctly (Hotbar, Hearts, Inventory items), some things aren't being moved at all (Armor, Hunger, Xp) and some things are being moved too low (Inventory background, Game menus). I'm guessing this is because the Hotbar and Inventory items are rendered before the Hearts, the Armor/Hunger/Xp are translated by your mod (so they're erroneously moved down but then back up), and the rest of the UI is just moved down.

As a note, all of this testing has been done on a fresh 1.18.2 with only Raised, Mantle, and Tinker's Construct.

I haven't really dug deep into the MC gui code, but looking at the Mantle code (https://github.com/SlimeKnights/Mantle/blob/1.18.2/src/main/java/slimeknights/mantle/client/ExtraHeartRenderHandler.java) and your code my best guess is that Mantle is cancelling the PreLayer event, which your code catches and translates the GUI back. Then Mantle sends a PostLayer event, which you also catch and translates the gui some more causing everything rendered after this point to be too low.

I don't really know enough about how the GUI renderer is supposed to work to say what needs to be fixed. As in I don't know if Mantle is breaking some type of contract by cancelling the PreLayer event then sending a PostLayer event, or if that's a valid case that you should be catching, likely by keeping track of whether or not you've translated the GUI back already in the PostLayer event. However, given how long the Mantle code has existed, my gut says it's the latter. https://github.com/SlimeKnights/Mantle/issues/146

I've attached some screenshots. The first are at 5 pixels, the last one is at 50 pixels to really highlight the elements that are being moved down.

2023-11-11_14 21 20 2023-11-11_14 21 26 2023-11-11_14 21 45 2023-11-11_14 33 22

Aceplante2 commented 9 months ago

sure enough, yes i am using mantle

yurisuika commented 9 months ago

Nicely done, it seems to work just fine.

Interestingly enough, nothing seemed to be amiss until I uninstalled Health Overlay, which does the same exact thing. So I guess between the two one disables the other or itself.