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

I have this screen which I like 

guard-screen.png

 

However since I am forced to use AbstractContainerScreen, it now looks like this

2023-05-01-22-14-47.png

 

Here is my Screen Class

public ArcherGuardScreen(ArcherMenu pMenu, Inventory pPlayerInventory, Component pTitle) {
        super(pMenu, pPlayerInventory, pTitle);
        init();
    }

    @Override
    protected void init() {
        this.addRenderableWidget(new Button(this.width / 2 + 5, this.height / 6 - 12 + 24, 70, 20, Component.nullToEmpty("Stay"), (p_96278_) -> {
            ModMessages.sendToServer(new ArcherUpdateC2S(1));
            this.minecraft.setScreen(null);
        }));
        this.addRenderableWidget(new Button(this.width / 2 + 5, this.height / 6 - 12 + 60, 70, 20, Component.nullToEmpty("Move Freely"), (p_96278_) -> {
            ModMessages.sendToServer(new ArcherUpdateC2S(2));
            this.minecraft.setScreen(null);
        }));
        this.addRenderableWidget(new Button(this.width / 2 + 5, this.height / 6 - 12 + 96 , 70, 20, Component.nullToEmpty("Ignore Nearby"), (p_96278_) -> {
            ModMessages.sendToServer(new ArcherUpdateC2S(3));
            this.minecraft.setScreen(null);
        }));
        this.addRenderableWidget(new Button(this.width / 2 + 5, this.height / 6 - 12 + 132 , 70, 20, Component.nullToEmpty("Hire Guard"), (p_96278_) -> {
            ModMessages.sendToServer(new ArcherUpdateC2S(4));
            this.minecraft.setScreen(null);
        }));
        super.init();
    }

    @Override
    public boolean shouldCloseOnEsc() {
        return true;
    }

    @Override
    public boolean isPauseScreen() {
        return true;
    }

    @Override
    protected void renderBg(PoseStack pPoseStack, float pPartialTick, int pMouseX, int pMouseY) {

    }

    @Override
    public void onClose() {
        this.minecraft.setScreen(null);
    }

Please note my old Screen class was identical to this one except it did most of the backend there however since I am forced to use containers for an actual server I had to revamp the entire thing so only init() is changed everything else is the same as last class except the new method renderBg() which I am sure its causing this but I am so so bad and PoseStacks I have no idea how to set the text to where it needs to be, for now ill just mess with the Button widget values

this.width / 2 + 5

That x position the typical pattern to centre then add 5.

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

And if you are not doing a traditional container screen, you probably want to override what AbstractContainerScreen.init() does when it calculates leftPos/topPos

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

  • Author
Just now, warjort said:
this.width / 2 + 5

That x position the typical pattern to centre then add 5.

got it, fixed up and looking good. Thanks

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.