I am trying to make the experience bar change color on an event.
My code works, but the expLevel (e.g 30) appears behind my HUD, not infront of it.
How would I go about making my HUD appear behind it? Any help would be greatly appreciated!
My code is as follows:
@OnlyIn(Dist.CLIENT)
public class DodgeGui {
private final ResourceLocation bar = new ResourceLocation(Dodge.MODID, "textures/gui/dodgebar.png");
public final static int width = 182; //182
private final int height = 5;
public static int j = 0;
@SubscribeEvent
public void renderOverlay(RenderGameOverlayEvent event) {
if (event.getType() == RenderGameOverlayEvent.ElementType.TEXT) {
Minecraft mc = Minecraft.getInstance();
mc.getTextureManager().bindTexture(bar);
int scaledHeight = mc.getMainWindow().getScaledHeight() - 32 + 3;
int scaledWidth = mc.getMainWindow().getScaledWidth() / 2 - 91; //-91
mc.ingameGUI.blit(scaledWidth, scaledHeight, 0, height, j, height);
}
}
}
Thank you greatly for your time.
- Roman