Hey guys it’s Thomas here with techno vision and welcome to episode 2 of our modding tutorial series in this episode we’ll be talking about how to create a basic custom item and add it to the game and of course texture and all of that and I think this is a lot easier than The earlier versions of forge which is really great we can get right into it so the first thing you want to do is come to your tutorial folder here or whatever you named your mod of course and right-click new and create a package and this is going to be our utility package So we can name this you – and hit enter and again utility and for utility so we need to create our first utility class inside of here and then it’s going to be our registry handler class so you can right click new Java class and like I said we’re gonna name this registry Handler now you can enter now this class’s registry handler class is going to have all of our items blocks entities they’re all going to be in what’s called deferred registries and it’s okay if you don’t really understand what those are but we will be using them and they’re Pretty simple actually once you get the hang of them so inside of our class here we’re gonna make a few spaces the first thing we want to do is create a deferred registry for our items so we can type public static final deferred register oh nice misspelled deferred their deferred Register and in triangle braces we want to put item and this is gonna say that our deferred register can only hold items from Minecraft so if we hover over item we can import the class and make sure you import from neta minecraft i Tom and you can see it imported here and We want to name this deferred register items and this is gonna equal and make sure items is in all capitals as well because it is a final and it’s static as well this is gonna equal a new deferred keep putting two F’s deferred register to empty triangle braces and then in Parenthesis Forge registries dot items there we go we can put a semicolon on the end here and we also want to put our mod ID but we’ll do that in a second so make sure you import deferred register as well hover over an import class and We can save real quick now we need to add our mod ID to this as an argument here so if we go to our tutorial class or whatever you name your main mod class right above or I guess right below where you have your lager here we can create a New public static final string and we’re gonna name it mod underscore ID this is going to be equal to whatever your mod ID is basically so you can just copy and paste whatever is up in here right click copy and paste it in to these parentheses and put a semicolon on the End and now we can access our mod ID anywhere in the the mod so if we go back to registry handler all we have to do now is just put a comma and then type tutorial or whatever the name of your mod class is dot and you can see right There we have our mod ID and we can double click that there we go so that we now have our mod ID as an argument in there and we’ve successfully created this deferred register that’s pretty much it now we just have to add items to It so you can think of this sort of like a list of items and you’re gonna be adding to it over time so if we make a few spaces here we can make a quick comment here with two slashes just saying that this is four items only and We can make our first item so to make an item you want to tie a public static final registry objects and then in triangle braces item and then the name of your your item well first we should actually import registry object so we can import class and this is a registry Object because deferred registers take registry object items so inside of here we’re gonna name our item so in this case you know just like we did with the last tutorial sort of as an homage to it we’re gonna do Ruby so we’re gonna make A ruby item and so the name should be in all capitals as well because it is fine right here this is gonna equal items again this is the name of our deferred register so items don’t register and then in parentheses we’re gonna first put the name of our item so in those Parentheses make two quotation marks and inside those quotation marks we’re gonna type a ruby and then a comma after this and the actual item itself so I’m gonna write item base semicolon semicolon new with a semicolon at the end here now we haven’t made the item base class yet but Let me just run through this really quickly so right here this is the name not the name that shows up in Minecraft but the name of your item in the the code so if you have an item that has spaces in it in the name so let’s say You were gonna create an item called tanned leather so you would type tanned underscore leather so every time you have a space naturally in the language you would put an underscore but in this case this is one word it’s Ruby and of course we have our name Ruby here as Well and this is a lambda and this is a Java concept you might not understand it but that’s okay just know that right here this is your item pretty much the item class now we have to create this class because we haven’t made item base yet but we can file save all real Quickly now come over to your tutorial folder here and right click new package and we’re gonna name this items hit enter and this is gonna store all of the special unique items that you have as well as the base item in this case like we said item base here so in items you Want to right-click new Java class and name this exactly what we put here item base base there we go and if we enter we’re inside of item base now inside of here this is a really simple class it’s just going to extends item and that just makes it inherit the everything from Item we can import item as well again make sure it’s from neta minecraft and inside of here well I guess we can just hover over and click create constructor and matching super and that will create the constructor for us and this constructor we don’t actually need To pass anything into it so we can delete this because we can just do it all inside of the class it’s never gonna change so instead of super whatever this p underscore eye thing is just delete that and inside of super we want to type new item with a capital i dot properties With a capital P dot group and inside of here we’re going to type what our creative tab is that we this item is under so if you know you know minecraft creative tabs there’s like the material section the potions section if you type item group dot you can see all the Different item groups here these are all the vanilla creative tabs and we’ll make our own later in another video but for now I would just choose whatever fits so this is a material because it is a or so item group dot materials and yeah so we’re pretty much done with this class Super easy as you can tell way easier than 1.12 we can file save all real quick and again all this is saying is that whenever you create a new item using item base it’s creating a new item with properties that assign it to the group of materials so pretty much all Its you know pretty self-explanatory as you go down the line but we can go back to registry handler here and if we hover over item base we can import the class and now you can see that we have no errors and this is our final item Created now the last thing we have to do is actually initialize it inside of our game so if we actually make a few spaces here we can create a method to store all of our our register commands so public static void and we’re just gonna call init and it’s not gonna take any Arguments and inside of these curly braces here we’re gonna type items dot register and inside of the these parentheses here we’re gonna type FML Java mod loading context don’t get and after the dock gap we want to do dot get mod event bus there we go With two parentheses on the end and a semicolon and we want to make sure that we import FML Java mod loading context as well and we can save file save all so this method here is going to fill up over time with item start register block start register entity is that register And that way we can just call in it and that’s all we really need to do so let’s go back to our main class here our tutorial class or whatever you name your mod and in between this FML Java my loading context here and our event bus We’re going to type registry handler dot init with a semicolon and we can import our registry handler import class and you can see that we are now calling the init class in our our main constructor here for our main class so if we file And save all and we go up to the green triangle in the top right corner we can run our game and we’re just gonna see that our item is actually in the game and working it’s not gonna have a texture yet or a name but we’ll deal with that in a second Alright so we’re inside of the game and if we open up our creative menu we can go to the miscellaneous tab because we did put it as materials and I believe in the recent version minecraft combined materials and miscellaneous and if we scroll down we can see that we do have Our item here you can also find it in the search items menu by scrolling all the way down it’ll always be at the bottom and if we actually take it you can see that it doesn’t have a texture yet or a model but our item is working And it’s inside of the game so if you’re at this point and you can see this this cube here on the ground that means that you are doing well so let’s go back to our IntelliJ program now that we’re back in IntelliJ we’re gonna start working on Making our item model and the texture as well as giving it a name so you can close out of item based and registry Handler as we’re done with those classes for now but we’ll come back to them in a second however you want to go over to your resources folder here This is not in your main your Java path with calm techno vision tutorial this is completely separate this is your JA resources folder here and if you right-click we want to create a new directory and we want to name this assets hit enter and this assets folder Is going to store all of your JSON files all of your textures everything that really is important to texturing and modeling or your blocks and items so we’re gonna right click new directory and we’re going to name the directory inside of assets your mod ID so again Your mod ID is what you have up here with your at mod tag so my in this tutorial hit enter and inside of your mod ID folder we’re gonna right click create new directory and we’re gonna name this lang that’s LAN Jie enter and this Lang folder is gonna store all of The the names of your items but we’ll deal with that in a second go back to your tutorial folder right click and create another directory and name this one models now inside of this models folder we’re going to right click create new directory and our first directory is Going to be called block and we’re gonna create a second directory in models new directory called item so inside of your a tutorial folder there should be a Lang and a models folder and in your models folder you should have a block and an item folder now inside of tutorial we’re Going to create another directory right click new directory and we’re going to name this I believe textures enter and inside of textures we’re gonna create two directories first one is called blocks this is plural now and we’re gonna create another directory called items so again models is gonna have two Called block and item textures is gonna have two called blocks and items plural with an S on the end and this should be good I think for creating our first item so first we’re gonna deal with our the name of our items so instead of you’re laying folder here you want to Right-click new and we’re going to create a new file and you’re gonna name this file en underscore US dot JSON now this file is a JSON file not a Java file so the syntax is gonna be a little bit different but we’re gonna create a curly Brace and two curly braces and inside of those we’re gonna type in parentheses item dot the name of your mod your mod ID sorry tutorial again remember your mod ID is this tag that you put right here so item dot your mod ID dot and Then the name of your item and by name I mean this let’s go back to our registry handler I mean this name right here you can see we have Ruby there make sure you’re doing that name so Ruby and then at the end of these parentheses you want to put A or sorry quotation marks you want to put a colon and then another set of quotation marks and this is gonna be the actual name that you find in the game so we’re gonna take Ruby but remember my example before we had bound underscore leather if that was the case he would Put found leather because again this is the name that you’re actually finding inside of the game so I’m gonna put Ruby and I believe that’s it if you create a new entry you want to add a a parentheses or not a parentheses sorry a comma uh-hum and create a new entry but your Last entry should not have a comma you can file save all and we can close our en underscore US JSON file and we can go to our models here and we want to create a new file inside of our item directory so right click new file and This is going to be the name of your objects or your item rather dot JSON so again if it’s bound leather we’re gonna do pound underscore leather dot JSON or I guess tanned leather same thing but in our case we’re gonna do Ruby so Ruby dot JSON Enter and make sure it’s all lowercase of course now instead of here this is going to be our model a JSON this is going to determine what our item model looks like and it’ll use our texture that we reuse later so go over to the description and you want to enter in the First link in the description into Google and you will find this paste bin here and you can copy this paste bin right click copy and you can paste it into your Ruby JSON file right click paste and this is your your model JSON we just have to change a few things so The parent here is item slash generated because this item is just a regular item and the texture we’re using this is going to be the directory so where it says mod ID and all capitals you want to delete that and place in your mod ID again – tutorial and where it says item Name you want to place in the name of your item again this would be liked and underscore leather if you were using underscores in yours but mine is just Ruby and we can file save all and this should be it for the JSON again you can leave this item section alone all you Want to change is your mod ID and the name of the item otherwise the rest is fine just so it’s easier for you to sort of get right into it now the last thing we actually have to do is add our texture to the game so if we go back to our Desktop here you can see I already have a PNG file named Ruby but I will leave it as a link in the description down below it’s a great video on how to create a texture yourself I might make one on my own but I didn’t want to take Up time in the video to do that but essentially inside of anything like ms paint I think you can use Photoshop any of those photo editing sites or nut sites applications rather you can create a 16 by 16 we can just make sure here with properties or properties details You can see it is 16 by 16 pixels that’s you want to make sure that’s what it is otherwise it may not work and and make sure you name it exactly what you named your your item in your deferred registry of course so again if this was like tanned leather as We said before there your rename we put tan underscore leather so you want to include the underscores but in my case is just Ruby and we can open up our minecraft modding folder here go to tutorial mod source main resources assets tutorial or whatever you your mod ideas models not models sorry textures And items and you want to drop it inside of items find if we close out of this and go back to IntelliJ and we right-click on our project here and we click reload from disk and then we go all the way down into assets tutorial textures items you can see we do have Our Ruby dot PNG and it’s in there so now finally if we run the game we should be able to see our item and again you can run the game by making sure you’re on run client and clicking the green triangle here ok so we’re inside of the game and as You can see we do have the Ruby in our inventory and we can drop it on the ground and it’s working just like a normal item and it has a beautiful texture of course if you right-click it doesn’t do anything because it’s a basic item but we’ll be making more advanced Items later on and again if you go to your creative menu you can see that it is at the bottom of course and it does have the correct name that’s very important and it’s also in miscellaneous as well now one thing to note if you can’t find it in your creative inventory For whatever reason you can always open up your command line and by typing T and do /give @p which stands for at player and then your mod ID which is tutorial colon and then the name of your item so Ruby and if you enter you can see that It gave us one Ruby to the developer so that’s an easy way to get it from your creative inventory so we’ve now successfully created our first item in the game and if you ever want to make a new item it’s super easy and this is for A basic item of course all you have to do is go to your registry handler class here again that’s in your util folder and just copy and paste this line here where we have our Ruby you can just right-click copy paste below and just rename the object instead Of Ruby all doot and underscore leather and rename the item name as as well on here tanned others for leather and everything else you can keep the same all you have to do now is just open up models item and just right click copy where it’s copy copy the Ruby Jason that You made and you can just paste it in item again so you’re duplicating it and just rename it to your new item sort and underscore leather hit OK and all you need to do is again change Ruby to tan underscore leather file save all and then finally if you just drop your your Tan underscore leather dot PNG inside of items and you load up the game you now have a new item it’s that easy because of forges new changes so yeah that’s pretty much us done with the video thanks guys so much for watching I hope you learned a lot and in the next Episode we’ll be talking about blocks and more advanced items so yeah see you guys next episode Video Information
This video, titled ‘Minecraft 1.15.2: Forge Modding Tutorial – Custom Items (#2)’, was uploaded by TechnoVision on 2020-03-18 04:36:54. It has garnered views and [vid_likes] likes. The duration of the video is or seconds.
Learn to code a Minecraft mod from scratch in this complete tutorial series! In this episode, we create a custom item and apply a …