Hello everyone thanks for joining me again as requested last time someone wanted me to explain how to build G Weiss and I will do that I will tell you how to build G wise I will be using a library for this called Lib GUI it’s part of cotton MC and it makes it Possible to build UI very very easily so I will put in a description this github repository and you will find a link here so what you do to add this library is first at the repository just paste that in there and then you add dependency and I’ve done that here make sure that your placed version with whatever is said set here and when you’ve done this we can get started on building mod alright so now that we have the dependency let’s start with making a GUI so there’s two types we are going to go into block GU Ice and client-side the Geo ice now block geo is our GUI is that pop up when you open in a container or something like an inventory like if you were to right-click a furnace client-side a GU ice our will only happen on the client so let’s say you have an item and you Right-click on with it it will open a GUI so let’s start with the client side of GUI is first because I think that is the easiest so let’s start with creating an item first and this item we will right click it to open a GUI to create an item we will First add a new package call it items we will add an item in here called let’s call it look I just call it GUI OOP there no gyi to learn just anything you can make it anything so I extend item the constructor you go back here now you instantiate this item Again I will not go too much in detail on how you create items this is just simple code that will add the item to the inventory there’s a millionth better tutorials going way deeper into this so I’m just going to register item now there you go so now we registered the Item so let’s say we want to open the item when we right-click on it there is an method called use here it is and this well this method will execute when the item is being used so in other words being right clicked so now we can start Making the GUI itself first we will make package to store out our geo ice so we stay nice and organized we will create a new class called screen example screen and this class can extend gotten client screen the constructor yep and now we create the Geo y example UI and this can Extend lightweight Gy description now this is the main GOI item and here everything is going to happen so what we need is constructor and first thing we’re gonna do is create a panel that will have everything in it so if you know HTML it would be the body tag Everything is going in there so there’s a bunch of different panels you can choose from but I really like the grid panel because it makes everything easy to lay out and then grid so you don’t have to worry about lining everything up pixel perfect it’ll do it for you so What we do for that is we create a grid panel I’ll call the roots because it’s just main panel and we will set this panel as the root now we will make sure the size of it is a decent size let’s start with 300 by 200 So now all we have to do is open the screen itself so we were going to do that by right-clicking the item so when we go back to the item all we have to do is write in this piece this line of code he opened the example screen and example Screen we’re going to feed the cheesy GUI and that should be it we can now launch the game now we are in game with the item and when we you right-click it you will see this very beautiful empty GOI well display now back into coding we Want to add things to the empty eg why we have this GUI and we added a root panel now we want to add things to this there is a bunch of different widgets we can put on it and libbed UI elements you put on a GUI are called widgets prefixed With the W well let’s go over a few of the widgets that can be used so you can see here this dependency of Lib GOI and you can open it to see the source code and you can see all the widgets available here so you have the button Which is very useful the grid panel that we already used in the label if you want the text on the screen scroll bar slider sprites if you want to put an image on the screen text feel this input and a toggle button I mean it all it’s all Self-explanatory and you can use all of these so let’s start with the easiest let’s type some text in this panel so to do this we need a label like I said not regularly w label there you go and we need to add what it’s gonna say in There which is going to be hello world now the content is added we need to set the position inside the root panel so we need to get the root and we need to place the label in there so the way we do that is read dot add yeah the label Get me to supply the XY coordinates start with one and one remember this is not any pixel this is in the grid so it will put it in the first cell of the first row and now we can launch the game again see how it looks Now if you right-click the item you will see hello world appear and there alright and there you have it now you know how to make client-side in geo eyes I said I was going to go into the other two eyes in this video but I’m going to do it in Next video because I figured that it’s probably a little too complicated to put in this video and it’s gonna make this video too long so in the next video we’ll go into inventories and making a GUI for the inventory of course so I’ll see you in the next video thanks for Watching I hope this was helpful the documentation for LabVIEW is in the description as well I basically went over to getting started part not a client side a GUI sparked if you want to go into inventories already you should take a look at getting started with geo Ice part anyways thanks for watching and I’ll see you in the next one Video Information
This video, titled ‘Minecraft Fabric Modding Tutorial! (GUIs)’, was uploaded by ErnieBernie on 2020-01-13 20:10:13. It has garnered 20149 views and 371 likes. The duration of the video is 00:12:36 or 756 seconds.
In this tutorial we’ll go further into building a GUI.
Resources: https://github.com/CottonMC/LibGui