sFXprt Posted May 2, 2023 Posted May 2, 2023 I have this screen which I like However since I am forced to use AbstractContainerScreen, it now looks like this 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 Quote
warjort Posted May 2, 2023 Posted May 2, 2023 this.width / 2 + 5 That x position the typical pattern to centre then add 5. Quote 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.
warjort Posted May 2, 2023 Posted May 2, 2023 And if you are not doing a traditional container screen, you probably want to override what AbstractContainerScreen.init() does when it calculates leftPos/topPos Quote 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.
sFXprt Posted May 2, 2023 Author Posted May 2, 2023 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 Quote
Recommended Posts
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.