Dynamic Surroundings: HUDs

Dynamic Surroundings: HUDs

14M Downloads

[Bug] Please don't cancel events in EventPriority.HIGH handlers

gbl opened this issue ยท 4 comments

commented

GuiHUDHandler registers RenderGameOverlayEvent.[Pre|Post] with priority EventPriority.HIGH, and PotionHud cancels those events. This means it's not only preventing the standard potion rendering that MC does, but also every other mod that registers itself with a lower priority, and tries to cooperate by not rendering when the event is cancelled.

This leads to this issue report in my mod: gbl/DurabilityViewer#2

Please cooperate with other mods by doing the Event cancellation thing in a EventPriority.LOW handler.

commented

Hi so not sure why nobody else has said anything but this actually still seems to be an issue.

With version 3.6.0.0 of this mod and version 1.12 1.6 of Durability Viewer, as well as version 3.6.2.1 of Dynamic Surroundings itself, this issue still occurs. If the DS Potion HUD is set to be visible, it completely disables Durability Viewer from rendering, regardles of settings.

Figure I'll report this on both pages even tho I doubt 1.12 is going to be supported anymore.

commented

IIRC I need to cancel the event to prevent the MC potion HUD from rendering as well as the DS hud. Have you tried setting your event handler to receive canceled event? Seems like this is the proper thing to do based on what you are doing with your mod.

commented

Cancelling the event is the right thing to do to stop Minecraft from displaying its own HUD. The problem I'm having is that the cancellation happens with EventPriority.HIGH, which tells not just Minecraft, but also all other mods to not render. I am still getting the events, but I choose not to render them if the event is cancelled, because that's needed for cooperation with mods, for example map mods, which want to take over the whole screen and actually prevent other mods from doing their thing. The only thing I ask is using EventPriority.LOW, not HIGH, for your event handler (and thus cancellation) so you cancel what MC is trying to do, but not other mods.

commented

Pushed v3.6.0.0 to CurseForge.