[Tutorial] How to hide player's health bar.

Started by dkrdjdi on

Topic category: User side tutorials

Joined May 2013
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
[Tutorial] How to hide player's health bar.
Thu, 08/22/2024 - 14:44 (edited)

Create a simple procedure and apply the code there.

 

  1. global trigger On player tick update

    https://imgur.com/jRnLkea

  2. Enter the code editor in the procedure and import it.


     

    import net.minecraftforge.client.event.RenderGuiOverlayEvent;
    import net.minecraftforge.client.gui.overlay.VanillaGuiOverlay;

    https://imgur.com/rgLfgZa

     

  3. Paste the code you present at the bottom of this code and you're done.


     

        private static void execute(@Nullable Event event) {
        }

    ...


     

        private static void execute(@Nullable Event event) {
        }

     

    //+Add code

     

    @SubscribeEvent
        public static void onRenderGuiOverlay(RenderGuiOverlayEvent.Pre event) {
            if (event.getOverlay() == VanillaGuiOverlay.PLAYER_HEALTH.type()) {
                event.setCanceled(true);
            }
        }
    }
     


 

Just because you're hiding your health bar doesn't mean you're invincible.

It will be useful when creating a custom health bar.

Edited by dkrdjdi on Thu, 08/22/2024 - 14:44
Joined Feb 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Nevermind, I suddenly became…
Sat, 06/28/2025 - 21:16

Nevermind, I suddenly became wise and figured out to replace PLAYER_HEALTH with FOOD_LEVEL

Joined Feb 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Still can't figure out how…
Sat, 06/28/2025 - 22:21

Still can't figure out how to trigger it based on a logic variable though.