lukflug / PanelStudio

An extensible and customizable GUI API/library to create ClickGUIs, HUDEditors and TabGUIs designed for use in Minecraft utility mods.
https://lukflug.github.io/panelstudio.html
MIT License
309 stars 23 forks source link

My HUD GUI is not rendering. #11

Closed banqq closed 3 years ago

banqq commented 3 years ago

The render() method is in the handler for the RenderGameOverlayEvent.Text event. But the HUD is not rendered when loading the world. But I still see the render only when I open my ClickGUI.

EventHandler: public class EventProcessor { public EventProcessor() { MinecraftForge.EVENT_BUS.register(this); } @SubscribeEvent public void onRender(RenderGameOverlayEvent.Text e) { Client.getInstance().gui.render(); //gui - instance of MinecraftHUDGUI } }

Block of code with initialization of HUDClickGUI: gui = new HUDClickGUI(guiInterface, null); Toggleable hudToggle=new Toggleable() { @Override public void toggle() {} @Override public boolean isOn() {return hudEditor;} }; Client.getInstance().moduleManager.getAllHUDModules().forEach(m -> { m.init(theme); gui.addComponent(new HUDPanel(m.getComponent(), theme.getCategoryRenderer(), m, new SettingsAnimation(ClickGUI.animationSpeed), hudToggle, 2)); });

lukflug commented 3 years ago

You should use the addHUDComponent method to add a HUD module, instead of addComponent.