maxpowa / AdvancedHUD

A continuation of AdvancedHUD by TurboSlow.
MIT License
9 stars 9 forks source link

Replacing in game gui breaks every other mod that uses events #3

Open rich1051414 opened 11 years ago

rich1051414 commented 11 years ago

Forge added events to the in game gui so replacing it is not necessary. Replacing it prevents all other mods that properly hook the gui from working.

https://github.com/maxpowa/AdvancedHUD/blame/master/advancedhud/TickHandler.java#L24

The RenderGameOverlay event has an eventtype variable included, so you can cancel the elements you need to, and leave the rest.

maxpowa commented 11 years ago

Other mods can hook into the API that my mod provides so that they can move their HUD elements as well. https://github.com/maxpowa/AdvancedHUD/tree/master/advancedhud/api

Also, using events would be silly because events can be cancelled. For example, lets say "Compact Display HUD" uses events, but cancels them to stop vanilla rendering. This mod would be completely broken in that case.

rich1051414 commented 11 years ago

You could atleast call the events. Requesting all mods to write custom versions to support your mod is silly. You should strive to make it compatible out of the box.

BitForger commented 9 years ago

rich1051414 does make a point. Since 1.7 its been increasingly easier to make mods compatible with others. I.e. using dynamic ids. If you would like help I'd be glad to. I have my own mod that doesn't do a super huge amount of stuff but I do understand the basics of events.

BinaryAura commented 9 years ago

The way I see it there are three types of HUD Items (4 if you include the cross-hairs):

  1. Bar (Boss, Experience)
  2. Icon (Health (vanilla), Hunger (vanilla), Armor (vanilla), Air (vanilla))
  3. Text (i.e. Chat, ToolTip, Record, PlayerList, Debug (this should be left alone))

In order to set this up, the code would have to recognize which type each HUDItem was and, if you wanted out-of-the-box compatibility recognize other new bars, and recognize that a resource packs can change the type.