Jump to content

Recommended Posts

Posted

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?

Posted
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

Posted
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

Posted

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

  • Thanks 1
Posted

Ad hoc screens don't need to be registered. You only register container screens.

Use ClientRegistry.registerKeyBinding() and have it do Minecraft.setScreen()

  • Thanks 1

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.

Posted
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?

Posted (edited)
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 by Luis_ST
  • Thanks 1
Posted (edited)

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 by warjort
  • Thanks 1

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.

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...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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