Posted July 5, 20223 yr Yo! Here again, I'm trying to create a new custom GUI Screen, smthing like, press V and it displays a GUI with buttons, etc. So, how can I create it? extending screen? And how can I register it? Btw, there's any doc or example?
July 5, 20223 yr 24 minutes ago, Zanckor said: So, how can I create it? depends on what the Screen should do? Do you only want to have a Button? 24 minutes ago, Zanckor said: extending screen? a Screen extension is in all cases required 25 minutes ago, Zanckor said: Btw, there's any doc or example? unfortunately there is no doc but you can take a look at all vanilla Screens as an example
July 5, 20223 yr Author 1 minute ago, Luis_ST said: depends on what the Screen should do? Do you only want to have a Button? I want a Button that increase a capability per one, like a stat "Stamina" that i want to increase one per one. Something like a MMORPG menu to increase my stats
July 5, 20223 yr create a new class and extends Screen, override #init and add there all Buttons you want (use #addRenderableWidget) inside the OnPress action of the Button you need to send a custom Network Packet (see: https://forge.gemwire.uk/wiki/SimpleChannel) to the server which increase your Capability value, if your Capability is also required on the client you need to sync it back after the value changes
July 5, 20223 yr Ad hoc screens don't need to be registered. You only register container screens. Use ClientRegistry.registerKeyBinding() and have it do Minecraft.setScreen() 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.
July 6, 20223 yr Author Yo, I've a part of my code done, there's something wrong? (I'm mean, yes, but what xD) https://ibb.co/H2N8vcC (GUI Code) https://ibb.co/VwKVT6g (Call screen) Btw, I'm using ItemPickupEvent for now, just to test
July 6, 20223 yr Author 2 minutes ago, diesieben07 said: Do not use @OnlyIn. ItemPickupEvent is a server side event, you cannot directly open a screen from there. Oh okay, i was thinking that too xD, and about the rest of the code? There's something wrong?
July 6, 20223 yr 15 minutes ago, Zanckor said: about the rest of the code? There's something wrong? looks okay, your Button is just 1x1 large but everything else looks okay Edit: you should not super null in the constructor Edited July 6, 20223 yr by Luis_ST
July 6, 20223 yr You need a render method in your screen and then use renderBackground() Don't forget to call super.render() after that to draw the widgets. There is also renderDirtBackground() if you want that. Edited July 6, 20223 yr by warjort 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.
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.