@OnlyIn does literally nothing for modders, it's only supposed to be used internally in Minecraft, use
@Mod.EventBusSubscriber(modid = "exampleid", value = Dist.CLIENT)
to ensure it's only called on the client, not that you have to use static methods with EventBusSubscriber, and instead of registering an instance of your class you register the class object directly. See the image I attached for more info.
You should also not use the raw RenderGameOverlayEvent, I recommend RenderGameOverlayEvent#Post.
For mods you should always use ElementType.ALL to distinguish from vanilla and you should rebind the default GUI textures after you're finished with you're rendering
Hello! I'm trying to adventure myself into minecraft modding, and now my next goal is to render a HUD bar, like a new XP bar for the user.
This is the current code that renders something on screen:
But when in game, it renders weirdly:
And the HUD png image looks like this:
It seems its rendering some other minecraft texture atlas on top of my texture, and i have no idea why it does this
does anyone has any clue on what could be happening?
Thank you!
A few things,
@OnlyIn does literally nothing for modders, it's only supposed to be used internally in Minecraft, use
to ensure it's only called on the client, not that you have to use static methods with EventBusSubscriber, and instead of registering an instance of your class you register the class object directly. See the image I attached for more info.
You should also not use the raw RenderGameOverlayEvent, I recommend RenderGameOverlayEvent#Post.
For mods you should always use ElementType.ALL to distinguish from vanilla and you should rebind the default GUI textures after you're finished with you're rendering
You use MCreator? Don't.