Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

As the title says. I couldn't find much online. I don't want to use ContainerScreen because I think that is for a different purpose.

 

Also this is my first post here :)

 

EDIT: Also why doesn't it work when i put stable_58 in build.gradle?

 

mappings channel: 'snapshot', version: 'stable_58'

 

I had to use 20200119-1.14.4 instead.

Edited by rizexor
added another problem

  • Author
1 hour ago, diesieben07 said:

What's a "HUD Screen"?

To add things to the HUD you can use RenderGameOverlayEvent. Make sure to check the various subtypes, this event is fired many times every frame, you usually just want one.

 

Define "doesn't work".

Like adding Health bar and rendering text etc.

 

Doesn't work meaning it fails to fetch it.

  • Author
11 minutes ago, diesieben07 said:

Okay, refer to my answer then.

 

...

Define "fails". Maybe post an error message?

Could not find net.minecraftforge:forge:1.14.4-28.1.0_mapped_snapshot_stable_58.

 

EDIT:

mappings channel: 'snapshot', version: 'stable_58'

 

even tried

 

mappings channel: 'stable', version: '58'

Edited by rizexor

  • Author

Also what class should I extend? Earlier we could override render function of Gui class.

 

I am guessing Screen is the replaced one so i tried to make this class:

package com.example.examplemod.client.gui;

import net.minecraft.client.gui.screen.Screen;
import net.minecraft.util.text.ITextComponent;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

public class ExampleHUD extends Screen {

    private static final Logger LOGGER = LogManager.getLogger();

    protected ExampleHUD(ITextComponent titleIn) {
        super(titleIn);
    }
}

But when i do:

@SubscribeEvent
    public void onRender(RenderGameOverlayEvent.Pre event) {
        Minecraft mc = Minecraft.getInstance();
        mc.displayGuiScreen(new ExampleHUD());
    }

I get errror:

'ExampleHUD(net.minecraft.util.text.ITextComponent)' has protected access in 'com.example.examplemod.client.gui.ExampleHUD

  • Author
6 minutes ago, diesieben07 said:

No class needs to be extended.

displayGuiScreen is not for showing HUDs.

Ok thanks but then how to call for example drawCenteredString? (Sorry if im asking stupid questions I'm new to modding)

  • Author
2 minutes ago, diesieben07 said:

Please learn basic Java before making a mod. Knowing how to call methods is basic Java.

 Minecraft mc = Minecraft.getInstance();
        mc.fontRenderer.drawString("Gay", 10, 10, 16777215);

I figured it out. I know how to call methods in Java just that i don't know which classes have these methods.

 

Now i don't know how to render a rectangle for health bar.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.