Let’s add custom items to Minecraft Minecraft modding courses with close to 100 topics ranging from Custom tools and armor to custom block entities all the way to custom mobs Linked In the description below all right we found each other ones more and in this tutorial we’re going to be adding a Custom items to Minecraft here for Ford 120x and this is going to be very interesting indeed first of all for this we’re going to need a new class and this is going to happen in the tutorial mod package we’re going to right click new package and this is going to be the item Package and there we’ll right click new Java class and we’ll call this the mod items class if the window over here add file to git appears this just means that this class will be added to the next commit you can just hit add and then you’re going to be fine if this doesn’t Appear that just means that you haven’t added a GitHub repository which of course is not necessary I just wanted to mention this here now the mod items class is quite important because this will basically hold all of our items that we’re going to register for our mod And the way that we register an item is via a deferred register so I’m going to type this out I’m going to explain after we’re done so we need a public static final and then a deferred register one F and two r’s you can see once it suggests This to us you can select it and press tab to autocomplete and it will also add an import over here that’s quite important you then want the angled brackets so this is a smaller than and then inside of here we want to add item from net Micro World item once again we Can hit the tab to autocomplete for this to import over here and we’re going to call this the items this is going to be equal to once again the Deferred register tap to order complete dot create tap to autocomplete this will also generate the two parentheses inside Of the parentheses we want to write Forge Registries once again tap to autocomplete dot items and then comma tutorial mod done mod ID and basically once again those were all done with using the Tab Key to autocomplete this now in the high level overview a deferred register is basically a long List of certain things in this case it is a long list of items and we’re going to add those items to that list and they’re then going to be registered at a specific time when Forge basically loads the items that’s a that’s a high level overview of a deferred register and Usually that should be everything you really need to know especially here in the beginning and when you have a deferred register you actually also need to register that and we’re going to do this by adding a public static void register method with an i event bus so This this I event bus over here once again tap to autocomplete I’m going to call this the event bus parameter and inside of this method we’re going to call items.register and then passing in the event bus parameter right here now as always of course all of the code that We’re writing here is available to you in the description below in the GitHub repository so you can always double check and compare with your own code that you’re writing if there’s any discrepancies or if you get any errors for example now this register method we want to take this to the tutorial mode Or our quote-unquote main class and then just between here so between the I event bus and the ad listener we’re just going to add mod items.register and then passing in the mod event bus variable right here this will ensure that our deferred register is properly registered As well and that will make sure that our items are actually added to the game and now how do we add an item well we add an item by saying public static final registry object this one right here of type item once again I’m going to call This the sapphire and this is going to be equal to items.register and the first parameter is going to be a string now you can see that this bus right here this generates automatically you don’t have to type this out and I continue I put in Sapphire here as a string and Once I put in a comma you can see that the name right here is also generates automatically do not type this out if you want to type this out it would look like this you can see it looks nothing like we’ve seen before the name right here is generated by IntelliJ you might Say this seems pretty obvious I’ve seen this plenty of times that people don’t understand that this name right here right Name colon you don’t have to type that out now after they come out we’re going to make a supplier so that’s going to be an open and closing parenthesis And then a minus and a bigger than so this is going to be sort of an arrow right here and that’s going to be a supplier the supplier is going to be of a new item in this case you can see net Micro World item we’re going to hit the Tab Key to autocomplete and inside of the item Constructor we’re going to say new properties once we hit the Tab Key here you can see it creates new item properties for us and we can end this with a semicolon and no errors should be present and of course once again you can Compare this to the GitHub repository in the description below to make sure that you write everything correctly now with this the sapphire actually has been added to the game however it has no texture it has no name and it is not even in any creative mode tab so that’s Not quite what we want so first of all let’s tackle the creative mode tab for this in the tutorial mode class you should have an add creative method right here and the add creative method here is going to be used to add your custom items to already existing vanilla tabs And not your own custom one we’re going to see the custom one in a little bit but for now this is how you add them to the vanilla ones you can say if event dot get Tab Key and if that is equal to the with creative mode tabs this one Right here the tabs tap to autocomplete Dot and let’s say ingredients here in this case so we’re going to add something to the ingredients tab inside of the if statement we’re going to say event dot accept and then we’re going to put in mod items dot Sapphire and with This added here the sapphire will get added to the ingredients tab please also note if you don’t have the add creative method over here you can of course create it but then also make sure to add The Listener right here in the tutorial mode Constructor that’s quite important But usually if you’ve gone through the setup you should have this so no worries right and now our item might be added to the creative modes tab however it still doesn’t have a name it still doesn’t have a texture and how can we fix that well for this we’re gonna need to go Into the resources folder and namely the assets folder so this is quite important so I want you to pay close attention to this in the resources folder we’re going to right click new directory and we’re going to call this assets inside of this folder we’re going to right click again New directory hold to Tool warrior mod now this folder right here I’m calling this tutorial mode because that is the name of my mod ID it of course needs to match your mod ID so if you’ve named this anything else this needs to match your mod ID exactly and inside of this Folder we’re going to need a couple of new ones so the first one is going to be Lang l-a-n-g then once again in the digital mod folder right click new directory called models very important models with an S at the end and then tutorial mode folder again new directory Called textures so here you can see the full folder structure it’s going to be tutorial mode Lang tutorial mode models tutorial mode textures and there’s one layer deeper that we need to go in the models folder we want to right click new directory called item very important This has to be item not items it is very important that this is item similar in the textures folder we want to right click new directory called item again and we can start from the top over here so the Lang is going to be the language Folder so inside of it there go Json files that are responsible for translating the keys of certain values in the game to their respective language so in the Lang folder we’re going to right click new file I’m going to call this the en underscore us data Json Please make sure that this is written correctly I’ve seen many different ways of this I’ve seen en.us and Json is I’ve seen a lot of things it is en underscore us.json written exactly like this I’m going to hit enter and then you’re gonna be inside of the Json file the Json file Itself it’s going to have a curly bracket over here and the closing curly bracket will generate automatically and then we’re going to translate the item the item right now will be called item.tutorial mode dot Sapphire and this is the key that we have to translate so To do this we’re going to make a string we’re going to say item dot tutorial Mod Dot Sapphire then colon and this is the translated string and this is going to be going to be the sapphire note that right here I can actually use uppercase characters Because this is the sort of the human readable name of that specific item and those can include any type of character basically this key over here generates in the following way this is of course an item right so we’ve registered a new item the name of it is sapphire so this Name right here matches this name right here and the tutorial mod is just our mod ID and that is basically how this key sort of fits together now our item has a name but it doesn’t have a texture for this we need an item model Json file And those can be quite complicated but don’t worry we’re going to get through this and you’re going to understand them once we’re through that so in the models item folder we’re going to right click new file I’m going to call this the sapphire.json note that the name of this Json file has to match exactly the name that we’ve given in the mod items class when we’re registering our item and it also needs the dot Json ending over here we’re going to hit enter again and once again the name of this file has some match 100 exactly the name of this one Right here so that’s very important but once that is the case we can now fill this item model JS file and I’m going to type this out once and I’m going to then explain so first of all we’re going to have a parent over here this is going to be item slash generated And then we’re going to have textures those textures are going to be layer 0 tutorial mod colon item Sapphire now you might say what the frick is going on here this is craziness don’t worry at all the parent right here determines how your item is displayed when you’re Holding in your hand and in the inventory basically item generated is a normal item that you’ve seen I mean probably thousands of times it basically takes the 2D texture and it extrudes it a little bit in the third dimension and that gives the illusion of a three-dimensional thing inside of your Hand basic then we’re defining a texture and that texture is going to be under the textures folder inside of the tutorial mod folder so it’s going to be tutorial mod textures instead of the item folder there we go so this matches here and then it’s going to look for a Sapphire.png inside of this particular folder that’s all the magic that happens right here and that’s pretty much all that there’s to it now I want you to pay once again close attention to what you’re writing inside of this Json file you can always take a look at the GitHub Repository in the description below to compare your Json file with what I have here it is not parents it is not layers it is not item uppercase it is not items I know you might say you have all of this here but I’ve seen all of those Mistakes maybe all of them at once and just make sure to compare this with your own file make sure that your directory structure your photo structure is all right and then you can proceed and proceeding we are going by adding the sapphire PNG over here to our textures Item folder so you can see the sapphire PNG is now right here in the item folder and that’s exactly what it’s looking for fantastic all of the textures are of course also available to you for downloads so you can also add the sapphire over here so no worries at all But that is basically how you add the item and you might say oh that’s quite an involved process don’t worry once we go into the game and actually see this item we’re going to add a second item as well just so that you see that once You’ve done this once it becomes at some point it becomes pretty routine but for now let’s actually start the game and let’s take a look at our Sapphire all right Francis back in Minecraft and let’s just take a look in the greens tab at the very bottom we should find there We go our Sapphire has been successfully added to the game it has a name and it also has a texture and can I just say the texture looks pretty freaking cool so that is one example of an item added we’re now going to add a second item and Also a custom creative mode tab let’s see so in our second item a lot of people say oh do we need another more items class you know and this is sort of once again one of those things where if you think of that you might want to take Another look at the Java because that sort of seems to be an issue of thinking in programming terms because you of course want to make this efficient and to make this efficient we just need another registry object so below our Sapphire we can just make another public static final registry object of type Item I’m going to call this the raw underscore Sapphire and this is going to be equal to items.register the name here is raw Sapphire making sure that the name is something completely different or unique to this name because if the names match then you actually will get an error so that’s Very important another supplier of a new item passing in item properties what the item properties do and a few of their things we’re going to see in future tutorials so no worries at all the time being we’re just going to keep them empty basically yeah but with this raw Sapphire we can now add this to the creative mode tab as well so we’re just going to duplicate this line and click on this line press Ctrl D I’m going to change this to the raw Sapphire right here and then we add the language similar thing we’re just going to Duplicate this line make pressing Ctrl D we’re going to add a comma here and we’re going to change this to Raw Sapphire and then similar here this could be the raw Sapphire and now we’ve already added to the creative mode Tab and we’ve already translated it how are We going to do this with the models but for right now what I’m going to do is I’m going to take this Json file I’m going to drag it into the same folder while holding Ctrl you can see that a little plus appears so it will duplicate This particular file file and I’m going to rename this file to Raw underscore Sapphire I’m going to hit OK and then the only thing I need to change in this file is the texture that it points to and that is the raw underscore Sapphire and with that the item model file the Translation and the addition to the creative mode tab has been done immediately we now just have to copy over the texture over here and then we’re done this is it the second item successfully added but adding them all to the creative mode tabs that are already existing in vanilla that’s a Little boring let’s create our own creative mode Tab and this is going to be very interesting as well in the item package we’re going to right click new Java class I’m going to call this the mod creative mode tabs and this will be a very interesting indeed so this once Again needs a deferred register so we’re going to say public static final deferred register once again tap to autocomplete this time of type creative mode tab this one right here there you go I’m going to call this the creative mode tabs and this will be equal to a Deferred register once again have to autocomplete that create so I’m basically always just starting to type in what I want to call similar here this time we want to choose Registries from net Minecraft core Registries tap the autocomplete and then choose the creative mode tab right here and then Passing in tutorial mod.modadi as a second parameter and I’m going to have a public static void register method in there we have an i event bus called event bus as a parameter and I’m going to call Creative Mode tabs.register passing in the event bus parameter and immediately this Register method will be called in the tutorial mode plus we’re just going to call this at the very top over here this is mod creative mode tabs.register and then passing in the event bus once again and then we want to actually register our creative mode tab the way to do this Is we’re going to make a public static final registry object of type creative mode Tab and this will be called the tutorial tab tutorial underscore tab this will be equal to creative mode tabs.register the first parameter is going to be the name tutorial underscore tab comma and then a new supplier once Again of a new creative mode tab but the way that this works is we’re going to say creative mode Tab and you can see it already suggests us the Builder right here we’re just going to hit tab to autocomplete and we can actually add a Few things first thing we can do is we can add an icon over here icon tab to autocomplete and inside of the item method we’re going to make a new supplier of a new item stack of mod items Dot sapphire.get and what this is Going to do is this is going to make it so that the tab icon is going to be of our Sapphire very cool indeed after the third closing parentheses we’re just going to make a new line over here I’m going to say dot title inside here we’ll Make a a component dot translatable the string here is going to be creative tab dot tutorial underscore tab we’ll have to translate this in a moment but first of all we’re going to also call the display items method and here we’re going to start writing p and you can see It suggests to us a display items generator I’m going to hit tab to autocomplete and I’m going to put in opening curly bracket and inside of those curly brackets we can now add all of our items to our custom tutorial tab so to our custom preview mode Tab and The order we add them in is also the order they get added inside of the tab we want to add a semicolon here at the end and then we can add the items so we’re going to say p output.accept mod items Dot sapphire.get and then once again just duplicate this and add the Raw Sapphire and there we go you can also add vanilla items here if you so choose to this would be done by once again doing the accept and then just saying items Dot and then for example the diamond and then we don’t need to get over here we only need get for our Custom items and this is the custom creative mode tab added as well we can now also add the translation so let’s just take this key to the en underscore us Json file and we’re going to add this right here and this is just going to be our Sapphire tutorial tab awesome and This is now going to be the thing that we see when we hover over the tab as well so this is going to be translated properly as well and that’s absolutely phenomenal but let’s take our ornament let’s go into the game one more time see our custom creative mode tab as well as The new raw Sapphire item as well all right we’re back in Minecraft and let’s just take a look and you can see we already have a second page which is a very very good thing to see and you can see the sapphire tutorial tab has been Added we have the sapphire we have the raw Sapphire and we even have a diamond right here it’s the name is correct the texture is correct everything is working and this is absolutely phenomenal and with this you can already see this is how you can add some items but for now We’re just getting started it’s going to get way cooler than this but as always all of the code is going to be available to you in the description below including also the download for the pngs for the following textures that’s all going to be there so no worries at all And next time we’re going to add custom blocks you can see that in this video right here hope to see you there so yeah Video Information
This video, titled ‘Forge Modding Tutorial – Minecraft 1.20: Custom Items & Creative Mode Tab | #2’, was uploaded by Modding by Kaupenjoe on 2023-07-05 14:59:47. It has garnered 5590 views and 180 likes. The duration of the video is 00:17:50 or 1070 seconds.
In this Minecraft Modding Tutorial for Forge, we are adding a Custom Item to Minecraft 1.20, as well as a Custom Creative Mode Tab!
== MODDING COURSES == FORGE ▶️ https://url.kaupenjoe.net/CourseForge120X FABRIC ▶️ https://url.kaupenjoe.net/CourseFabric120X
== COMPATIBILITY == ▶️ Compatible with 1.20 & 1.20.1
== ASSETS & DOWNLOAD LINKS == GitHub Repo: https://github.com/Tutorials-By-Kaupenjoe/Forge-Tutorial-1.20.X/tree/2-customItems Assets Zipped: https://url.kaupenjoe.net/mbkj48/assets
== SUPPORT ME ON PATREON == ▶️ https://www.patreon.com/Kaupenjoe
== 25% OFF FOR GAMING SERVERS == ▶️ https://www.bisecthosting.com/Kaupenjoe
== TAKE A LOOK AT MY COURSES WITH COUPON CODES == ▶️ NEW Forge Modding with Minecraft 1.20.X: https://url.kaupenjoe.net/CourseForge120X ▶️ NEW Fabric Modding with Minecraft 1.20.X: https://url.kaupenjoe.net/CourseFabric120X ▶️ Complete and Roblox Lua Game Development: https://url.kaupenjoe.net/RobloxCoupon * ▶️ Learn Forge Modding with Minecraft 1.18: https://url.kaupenjoe.net/CourseForge118 * ▶️ Learn Fabric Modding with Minecraft 1.18: https://url.kaupenjoe.net/CourseFabric118 *
== SUPPORT ME ON PATREON == ▶️ https://www.patreon.com/Kaupenjoe
== SOCIALS == Discord: https://discord.com/invite/yqxykanpWf Personal Twitter: https://twitter.com/Kaupenjoe
Instagram: https://url.kaupenjoe.net/tutorials/instagram Facebook: https://url.kaupenjoe.net/tutorials/facebook Twitter: https://url.kaupenjoe.net/tutorials/twitter TikTok: https://url.kaupenjoe.net/tutorials/tiktok Written Tutorials: https://url.kaupenjoe.net/tutorials/blog
== LICENSE == Source Code is distributed under the MIT License. Additional Licenses for other assets can be seen below or in the accompanying CREDITS.txt on download.
== AFFILIATE DISCLAIMER == * Some of the links and other products that appear in the video description are from companies which I will earn an affiliate commission or referral bonus from or are my own products. This means that if you click on one of the product links, I’ll receive a small commission or additional kickback without any additional cost for you. This helps support the channel and allows me to continue to make videos. Thank you for the support!
== HASHTAGS == #Minecraft #MinecraftModding #MinecraftTutorial #Kaupenjoe