klikli-dev / modonomicon

Data-driven minecraft in-game documentation with progress visualization.
25 stars 9 forks source link

Occultism Dictionary of Spirits blank in the book preview alongside JourneyMap #230

Closed Kevin-Marsh closed 3 months ago

Kevin-Marsh commented 3 months ago

Describe the bug The Dictionary is blank in the images that are meant to preview the pentacles.

To Reproduce Install Modnomicon, Occultism, and Journeymap

Expected behavior The Pentacle should render.

Screenshots 2024-07-01_13 53 23 2024-07-01_13 52 28

System (please complete the following information):

klikli-dev commented 3 months ago

Hmm journeymap seems to modify the posestack leading to Z-issues. Various other pages also do not work, e.g. rendering items on recipe pages. Moreover, it looks like this only affects wherever I use vanilla render methods to render minecraft contents such as blocks or items.

This seems to me like something journeymap should not do or rather clean up the guigraphics and posestack after their rendering. However, it is possible that I am missing a best practice convention to guard against this.

Could you open an issue with journeymap as well and link to this one @Kevin-Marsh to figure out on which side it needs to be fixed?

mysticdrew commented 3 months ago

looks like something is going on with layering. Where in your code are you drawing that book over the screen?

mysticdrew commented 3 months ago

Ahh okay, so this seems to be an issue with the gui layering logic To be honest, I used to use this a lot too and it caused nothing but problems with other mods. So I switched to a similar implementation as the net.minecraft.client.gui.components.PopupScreen Then I no longer needed to use hacky stuff in Fabric which did not have an API for layering screens. Then I stopped having tons of mod conflicts in all mod loaders.

The root cause of this issue. This issue is happening because the Screen events are firing for every layer, when in reality, the pre event should fire once before the first layer or NeoForge should add a new event. So the minimap is drawing for every screen layer when it should only be drawing for the first layer. The event has no way to signify to consumers what layer it is on.

mysticdrew commented 3 months ago

I fixed this on my end for the next beta.

But you will continue to run into problems with mods using gui-layering. Mainly due to the patches in GameRenderer Forge and Neoforge does with the farplane translations and ortho this does.

Getting off gui-layering will cause less headaches.

klikli-dev commented 3 months ago

I fixed this on my end for the next beta.

But you will continue to run into problems with mods using gui-layering. Mainly due to the patches in GameRenderer Forge and Neoforge does with the farplane translations and ortho this does.

Getting off gui-layering will cause less headaches.

Thanks a lot! I am using a custom layering system in Fabric to show book parts on top of each other, maybe I can adopt that for the other loaders as well

mysticdrew commented 3 months ago

This was my solution, based on the realms popup screen. https://github.com/TeamJM/journeymap-api/blob/1.21.x_2.0/common/src/main/java/journeymap/api/v2/client/ui/component/LayeredScreen.java

klikli-dev commented 3 months ago

This was my solution, based on the realms popup screen. https://github.com/TeamJM/journeymap-api/blob/1.21.x_2.0/common/src/main/java/journeymap/api/v2/client/ui/component/LayeredScreen.java

I had no idea the realms popup even existed! Thanks! I think mine is very similar although it has a few more overrides that are apparently not necessary. I'll compare

mysticdrew commented 3 months ago

It was added in 1.20.1 or 4 I think. it is a much simpler solution.

It does have the disadvantage that you cannot make any screen layered. But, for me that is fine.

klikli-dev commented 3 months ago

@mysticdrew Can you take a look at this enigmatica issue: https://github.com/EnigmaticaModpacks/Enigmatica10/issues/17#issuecomment-2206968753

I suspect this is related to your fix or the underlying issue.

Kevin-Marsh commented 3 months ago

@klikli-dev Journeymap 13 didn't have the fix in it. It was only shipped today in beta 14