Jump to content

How do I create a GUI that opens when a world is created


ThePuddingStone

Recommended Posts

Hello! First of all I am very new to Minecraft Modding and have recently dropped MCreator because of its limitations. I've known Java for years but I never quite understood how Minecraft Modding works. I do know some really basic stuff like Items, Blocks, Foods etc. I've found some good tutorials on modding to use but none of them cover my very specific topic.
I want to be able to make a Custom GUI (which I have 0 idea how to do) and make it open once whenever a player creates a world or joins a server for the first time. The GUI I want to make has you select one out of multiple options (which is mandatory so the player wont be able to ESC out of it) and that option be stored in a variable for the rest of the world's life span. Think of it as a "Choose your character" screen similar to other games.
I would like if you could explain to me how GUI design works and where I need to place all my classes and other files to make it. I don't know if having a block entity or an entity type is mandatory but if it isn't please tell me how it's done.
I'm doing this all in Minecraft 1.18.2. If this question has been made before, sorry for reposting, I could not find it so please direct me to it. Thank you all in advance!

Link to comment
Share on other sites

welcome to the club!

what you want to do isn't easy and you should really do a few simple learning mods before that. even something that you wouldn't release or even play with yourself. there are things you need to learn.

first thing you need is events. whenever there is a question "when", events are the answer. you can respond to player tossing an item, or a skeleton joining world, or item despawning, or farmland about to be trampled, etc. some events you can cancel (basically say no to mob about to spawn, or to farmland about to be trampled), in some events you can do more than just say no (when stick item is about to despawn, you may prolong its life by x seconds, etc.).   https://forge.gemwire.uk/wiki/Events

anyway, you need events to answer the first question - when do we display gui. forget the gui for now and make it a simple message in chat by saying player.displayClientMessage(Component.literal("show gui now"), false); 

do not proceed with gui until you have this message shown when player first joins the game and until you ensure it's not shown next time.

ok next - you need networking           https://forge.gemwire.uk/wiki/Using_SimpleChannel/1.18 ,          https://forge.gemwire.uk/wiki/Sides/1.18  , and a few more pages.

then gui, but after networking.  do you still want to make a mod with gui window as your first mod?

Edited by Potato5
Link to comment
Share on other sites

3 minutes ago, Potato5 said:

welcome to the club!

what you want to do isn't easy and you should really do a few simple learning mods before that. even something that you wouldn't release or even play with yourself. there are things you need to learn.

first thing you need is events. whenever there is a question "when", events are the answer. you can respond to player tossing an item, or a skeleton joining world, or item despawning, or farmland about to be trampled, etc. some events you can cancel (basically say no to mob about to spawn, or to farmland about to be trampled), in some events you can do more than just say no (when stick item is about to despawn, you may prolong its life by x seconds, etc.).   https://forge.gemwire.uk/wiki/Events

anyway, you need events to answer the first question - when do we display gui. forget the gui for now and make it a simple message in chat by saying player.displayClientMessage(Component.literal("show gui now"), false); 

do not proceed with gui until you have this message shown when player first joins the game and until you ensure it's not shown next time.

ok next - you need networking           https://forge.gemwire.uk/wiki/Using_SimpleChannel/1.18 ,          https://forge.gemwire.uk/wiki/Sides/1.18  , and a few more pages.

then gui, but after networking.  do you still want to make a mod with gui window as your first mod?

Thanks a lot for this response. I did say I'm new but this isn't actually my first mod. I'm gonna sit down and read the pages you linked . Networking is something I never even heard about.
If there's anything more I need to know please tell me! Thanks a ton!

Link to comment
Share on other sites

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.



×
×
  • Create New...

Important Information

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