Jump to content

[1.7.10]GUI


BuddingDev

Recommended Posts

Well, if you want it to look like a vanilla GUI, why not copy and modify a vanilla GUI  :o

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Link to comment
Share on other sites

A big question when creating a GUI is whether or not it will need a container -- needed if you have slots that you want the player to interact with. If you don't need that, then GUIs are actually very simple -- you just extend GuiScreen, open them, and have a drawScreen() function that draws what you want (colored rectangles, image textures, text, etc).

 

The second question is whether your GUI is only informative or whether it needs to change behavior in the game. If it changes the game, you need to understand that the GUI only executes on the client side so you'll need to send a packet to the server to let it know what the player did in the GUI.

 

What exactly do you want your GUI to do?

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Link to comment
Share on other sites

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

I was just wondering if there is a GUI resource library that stuff like Vanilla GUI borders, Vanilla buttons, Vanilla stuff n stuff can be found.

I am currently learning to make GUI, and I am always astonished by how the tutorial makers make the GUIs look so much like vanilla ones.

Link to comment
Share on other sites

Because for the most part they are vanilla GUI objects.  That is, taking the existing pieces and re-purposing them.

 

In fact, I made a wooden hopper recently, and aside from having to use my own container/guicontainer code (due to slot stack limits) it's 100% vanilla.  The texture used, the text printed, the inventory slot definition...all vanilla.  I just had to specify it as my own GUI so I could override the mergeItemstackIntoInventory function so that shift-clicking respected slot stack limits (the wooden hopper being dirt cheap has a slot limit of 16...along with only being able to send items downwards...yeah, it's a dumb chute).

 

If you have a more specific question, just ask.  "How to build an arbitrary GUI" is not a question that can be answered without knowing what the GUI is for and what operations it has.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

I was just wondering if there is a GUI resource library that stuff like Vanilla GUI borders, Vanilla buttons, Vanilla stuff n stuff can be found.

I am currently learning to make GUI, and I am always astonished by how the tutorial makers make the GUIs look so much like vanilla ones.

 

Yes, there are GuiScreen, GuiButton, GuiSlider, etc. classes that help provide consistency. For the placement and sizing of buttons and text, you should just copy what the vanilla classes that extend GuiScreen do. Lastly, you can simply copy the gui texture assets and just modify them in an image editing program like GIMP. Like if I want to make a container with slots placed differently, I just cut and paste the slots in an image editing program.

 

Do you know how to find the textures and code for GUI in the referenced library for forgeSrc?

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Link to comment
Share on other sites

I also supplied one up-thread that you can steal.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

Uhm. In most cases you will want to make new class extending GuiScreen. Override initGui() to add buttons and initialize other sub-gui stuff (like lists for example). Then in drawScreen you will need to draw those buttons and other parts you want. Use actionPerformed to track button-clicks. mouseClicked is good to track some more customized mouse actions - e.g moving lists.

 

There are a lot of other stuff, but that is mostly it.

You can open GUI using player.openGui or mc.displayGuiScreen(gui) - second one is CLIENT ONLY.

 

Remember that initGui() is called on every rescaling and that you need to pull values like width/height of screen from super-class.

1.7.10 is no longer supported by forge, you are on your own.

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.

Announcements



×
×
  • Create New...

Important Information

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