![Hud Compass](https://media.forgecdn.net/avatars/thumbnails/314/19/256/256/637410754645569418.png)
Bug that turns all mobs, dropped items, and player model invisible.
Romoslayer opened this issue · 11 comments
Hi, so I recently tried adding this mod to my mod pack and have run into a bug where after a couple of seconds after joining a single player world (probably servers too have not tried) my player model, chests, mobs, and dropped items become invisible (not deleted they are there since I can still pick up dropped items and hear mobs just can't see them) not sure why but after a series of removing multiple mods and testing to see if the bug is still there I have narrowed it down to this mod.
Quick video showing what it does when the bug occurs.
https://youtu.be/-pt7saRFLIE
It looks like the occurs when I look at / render special mobs from the "Champions" mod.
Alright in the meantime I will submit a bug report to the creators of the Champions mod.
As of 0.1.6 (1.16.5) and 0.2.2 (1.17.1) the workaround/fix has been implemented. Hopefully that solves the issue, because I didn't have time to test.
I think I realized what the issue may be. I rely on a forge event to detect when boss bars are about to draw, and move them a bit lower down. It's possible that this mod is doing something that interferes with that code, making it so I can't restore the logic to how it was, leading to the opengl stack overflow you see in the chat messages. 🤔
I'm the developer of the Champions mod, so I can help with giving information from my side.
I believe the only relevant part of Champions is right here:
https://github.com/TheIllusiveC4/Champions/blob/06b04c593b3fdca0bd8d49ed17e84cbc3c3c105f/src/main/java/top/theillusivec4/champions/client/ClientEventHandler.java#L15-L26
I conditionally cancel the boss bar render event to draw the Champions health bar instead when applicable. Specifically, just canceling the boss bar render event is enough to cause the error as I tested it with all of the other code commented out.
From what I can tell, what could be happening is Hud Compass listens and does the first half of its logic first, then Champions cancels the event, and then Hud Compass fails to receive the event so it never restores the logic previously. Could this be solved by Hud Compass attaching a receiveCanceled = true
to the annotation of that latter listener?
If the Pre has been cancelled, the Post never fires. at all.
I can receive cancelled for Pre, but I can't do anything to receive Post for mods that cancel Pre but never fire Post themselves.
Ideally what you should do is, if the event was NOT cancelled when you did cancel it, then fire Post yourself. Checking for cancellation is important because otherwise 2 mods might decide to send a Post, and it could cause the opposite problem. Or well, looking at your code, you don't have receiveCanceled, so it should be fine for you to unconditionally send the Post yourself.
I have a workaround, though, which should prevent the issue on my end. I just need to get a handler for Post/ALL, and if the Post/BOSSHEALTH hasn't fired, call popMatrix() there.
I still think it would be good if you do send the Post event in your logic, though, to be more compatible with any other mod that needs to do something like what I do.
On further thought, I think what I added is not actually just a workaround, but a necessity. Mods that truly cancel the rendering and don't intend on actually drawing anything can't be expected to send a Post. That'd be forge's job. So I'm calling it a fix now, instead of a workaround.
I still think it would be good if you do send the Post event in your logic, though, to be more compatible with any other mod that needs to do something like what I do.
That's a very good point, thanks for the suggestion. I'll add that into the next Champions update to hopefully provide better compatibility in the future.