Started by
dkrdjdi
on
Topic category: User side tutorials
Create a simple procedure and apply the code there.
-
global trigger On player tick update
-
Enter the code editor in the procedure and import it.
import net.minecraftforge.client.event.RenderGuiOverlayEvent;
import net.minecraftforge.client.gui.overlay.VanillaGuiOverlay;
-
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
Nevermind, I suddenly became wise and figured out to replace PLAYER_HEALTH with FOOD_LEVEL
Still can't figure out how to trigger it based on a logic variable though.