Let’s add items and a custom item group all right we found ourselves back and tell you once more and in this tutorial we’re going to be adding a custom items and a custom item group to fabric in one nineteen three please do note that the top right corner is the compatibility Please note if you’re in a future version check the comments or the description for the compatibility but what do we need for a custom item well the first thing in the tutorial mod package we’re going to right click new package called item and then instead of There we’re gonna make a new Java class called the mod items class now this is where all of our items are going to go and how do we actually add an item well for this what we’re going to need is first of all we’re going to need a Helper method to actually register those items and that’s going to be a private static item from net Minecraft item right here just hit the Tab Key to autocomplete and we’re going to call this the register item method we need parentheses inside of there we’re going To put the name parameter as well as an item parameter and then afterwards just put in the curly brackets and then there you go we’re going to return registry making sure that we choose net Minecraft registry extremely important not Java RMI registry net microf registry it entered the autocomplete dot register And then here we’re going to choose Registries dot item once again autocomplete with the tab key that this is going to add it to your Imports at the top armor new identifier from net Minecraft util tab Once Again tutorial mod.mod ID and putting in the name and You can see I basically always press the Tab Key to autocomplete this after the first parentheses comma item and then ending it with a semicolon no errors should be present at this point and we should be fine what we’re then going to need is a new item so now we’re going to Actually create this item this is a public static final item now the first item is going to be citrine going to be equal to the register item method right here when we start typing the name so you can see I started typing a quotation mark to make a string and this name Right here generates automatically you do not have to type this out and this is going to be called citrine and then afterwards we need make a new item right here inside of here we make new fabric hot fabric item settings there you go and then just end it with a semicolon And the item has been registered now it hasn’t been registered fully because we also need another public static avoid register on items method and this is just going to do the following tutorial mod.logger dot debug let’s say or info either one works fine and this is going To be registering or items or and then it’s going to register this for our tutorial mod that mod ID this is just basically an output now the reason we need to call this method that we need to call this in the tutorial mode class in the uninitialize method right here on Items dot register mod items now you might say well this doesn’t really do anything well actually does do something and it basically sort of initializes this class so that all of the different items are actually properly registered one thing that has not happened yet is This item has not been added to a item group this is correct because for this we need some more additional methods that is a change in 193 so first of all we’re going to add it to a vanilla item group and then after we’ve actually seen This item in game we’re then going to add a custom item group as well so this is going to be a public static void at items to item group going to be the method over here I’m going to make another helper method which is actually going to be private the time being Public static void add to item group and then you want to make an item group parameter here called group and then an item item so we’re going to add this item right to this particular group and the way that this is going to work is we’re going to call the item group Events that modify entries passing in the group right here dot register and then entries and then you can see this is a Lambda expression so entries in this little arrow over here and then here we’re going to say entries dot add and passing in the item this is going to Add this item to this particular group and then inside of the add items to item group we’re going to then say add to item we’re going to say item group group start let’s do ingredients comma citri there we go and then this particular thing is just going to be cold right here so We’re just going to call add items to item group and now all of the items will be added to their groups in this case citrine is going to be added to the ingredients you can actually add items to multiple groups as well that also works and we’re going to see that in Just a moment but for the time being we actually need to continue with a few other things because while the item is now in game it doesn’t have a texture it doesn’t have a name and all of that and that all happens in the assets folder now this is extremely important so Please do pay close attention to this the folder is resources assets Oreo mod and then we can see they have an icon PNG in here we can just delete this that’s fine and then inside of the tutorial mode folder we’re going to create a few folders I’m going to right Click new directory the first one is going to be called block States this one we’re going to need when we add a block but we still want to add this just that we have the entire structure done then once again in the tutorial mode folder right click new directory called Lang l-a-n-g Once Again tutorial mode right click directory this is the models directory and then tutorial mode right click directory called texture now what’s also extremely important they have to be written exactly like this the same casing all of that then in the models folder we’re going to right click again New directory called item and then also in the same folder models right click new directory called block please note that it is block and item singular or lowercase exactly written like this the textures follow the same thing goes right click new directory alt block and then in the textures folder again right Click new directory called item this is the correct folder structure you know make a note out of this make sure that it is exactly written right this has to be your mod ID and then everything should be fine first of all if we were now to go into the game what would Happen is that our item if we hover over it will have the name item dot tutorial Mod Dot citri which is of course kind of a weird item name to have so in the Lang folder we’re going to right click new file file called en underscore us.json please once again make sure that This is written exactly like this not anything Ian Dash underscore or whatever it is en underscored us.json this is going to localize our game with a default English language if you have another language that you want to translate you can look up the translate codes on the Minecraft Wiki and then Also add that as well for the time being we’re going to stick to English what we want is we want a curly bracket right here and then we want to put in the key that is going to be translated to something else so the key as I said is Item dot tutorial mod so this is always item dot your mod ID that the name of the item so the name of the item is the thing that you’ve given right here this by the way also follows the exact same rules as the mod ID it can only contain Lowercase characters underscore Dash and numbers no uppercase characters and no spaces so here after we have the key we’re going to put in a colon and then another string and this is going to to be the actual string that is displayed now this in this case can include spaces And uppercase characters on all of that so that is pretty much that is pretty much what you want so this is the localized name for English in this game now continue along in the models folder in the side of the item folder we now want to create another file and that is the Citrine.adjson so this once again of course is the name given in the mod items class and then dot Json ending is also very important now the contents of this are you know they can be quite complicated I’m going to type this out and then I’m going to explain what they Mean this is also going to be available in the GitHub repository Link in the description below so no worries at all so first of all we’re going to have a parent that is item slash generated armor and then textures colon a open curly bracket layer 0 written exactly Like this and then tutorial mod or your mod ID all in item slashery now what the frick is this craziness absolutely no worries the parent basically determines how your item is displayed usually a lot of times you just want to use item generated for normal items then they’re Just going to be displayed in sort of the way that a normal item is displayed in vanilla it’s basically the 2D texture sort of extruded out into 3D space a little bit and that is how this is going to work now inside of the textures you Can see we are defining the layer 0 it is incredibly important that this is written correctly it shouldn’t be layer with an uppercase l a lowercase L all of these things have to be written exactly like this please double triple a quadruple check I’ve seen this numerous Times that people have written parent or you know textures has a has a maybe a typo in there or something like that or it’s texture instead of textures it has to be exactly like this double triple a quadruple check and then layer 0 right here we set this to a particular extra So this texture where is this located this is basically what we’re doing with this it’s located in the tutorial mod folder so it’s going to look in the tutorial mode assets folder instead of the texture folder right so right here it’s going to look in the textures Folder under the item folder and it’s looking for a PNG called citrine this is what we’re going to add and this is also going to be available to you in for download in the description below and you can see this is basically what this refers to and then this particular image Is going to be shown inside of the game for our citrine item and now the item has been added so let’s for the first time go into the game make a new world and let’s actually take a look at whether or not the item has been properly added and then we’re going to Add a custom item group and a new item as well so let’s go into the game alright so we find ourselves in Minecraft and let’s just see so in the ingredients tab at the very bottom we should see the citrine has been successfully added so that is absolutely Awesome because as you can see both the item has been properly added so the texture is correct the name is correct and it also has been added to the correct item Group which is absolutely phenomenal so now let’s add a custom item group and a second item as well all Right let’s start with actually adding the item first so we’re going to add the custom item so how do you add a second item right do you need another mod items class absolutely not you just need another item right here so what you do is you usually what I do is I just Select this press Ctrl D to duplicate it what I do is just I select this press Ctrl D to duplicate it and then a new one has been added or you can also collect it press Ctrl C and Ctrl V to paste another one in now you’re going to Have an arrow right here because it has the same name of course we want a different name so I’m going to call this the raw underscore citri same with this name raw underscore history if those names would match then we actually would get an error and we wouldn’t be able to Actually get into the game so that’s very important that those are unique now let’s add the raw citrine to the same item group for this once again we’re just going to duplicate this and instead of adding the citrine we’re going to add raw citrine and that is it now the Second item has been added of course it doesn’t have a name it doesn’t have a texture so there’s a few things missing so once again in the enormous Json file I can just duplicate this make a comma over here because they always have to be separated by commas this is now going to Be the raw citrine and this is the same thing raw citrine is going to be the name displayed same in here I can just copy this particular Json file so I can drag it into the same folder while holding Ctrl and then I can change the name to Raw underscore citrine inside of Here don’t forget to change the name here raw underscore citrine it now looks for a raw citrine PNG instead of the item folder inside of the textures folder in the tutorial mod folder once again this is the same idea and we’re going to copy this over now all of the Textures are going to be available to you as well so no worries at all and there you go now we’ve actually added the second item and if there’s just items like this then that is pretty much always how you’re going to go about adding them now when it comes to a Custom item group it’s a little more complicated but also not too worry so in the item package we’re going to right click new Java class called mod item group and inside of there we’re going to make a let’s zoom in a little bit we’re going to make a public static item group Called citrine and then this is going to be actually a sign inside of a public static void or register item groups and this is going to look pretty crazy but no worries at all we’re going to get through this so this is going to be citrine and this is equal to a fabric Item group making sure we choose the one from the API right here once again hitting tab to autocomplete this that Builder adding in a new identifier tutorial mod.mod ID armor latrine so this is just going to be the path right this is our unique identifier after the second closing parenthesis we’re gonna Just hit enter and do a dot display name we’re just going to say text.literal and we’re just going to say this is the citrine item group so this in this case if we hover over the item group this is what’s going to be displayed now the fact that we’re using a literal string Means that this is going to be the same regardless of whatever language we have if we actually do want to have this change on different languages we you can also say text.translatable and then instead of adding a literal string that’s going to be displayed exactly like this we can Also in add a key so this would then for example be item group Dot citri and then this is a thing that we can translate in the en underscore us Json file right so item group citrine is then going to be the citrine item group and then if you Know someone has a different Lang file for example I don’t know German d e underscore d e then they could also translate this and they can actually localize this to another language that’s why sometimes the translatable text here in this case is probably better we also Want to choose an icon right so dot icon this is going to be a supplier of a new item stack and then here we’re going to say mod items that citri and then at the very end we’re going to say dot build and end it with a semicolon so the Supplier might be a little bit weird it’s basically just sort of a thing that is going to delay the execution of getting this citrine item because of the difference in when things are registered so basically just going to say hey when you you know the I can write you Remember the icon for the ingredients was the iron ingot in our case our custom one is going to be the citrine item that’s pretty much all that we’re going to do and then in the tutorial mod class we need to call this at the very top or item group dot register item Groups and then there you go now we still need to add our items to it so in our mod items class we can just go in here and we’re just going to duplicate both of these and instead of adding them to the ingredients we’re here going to Add them to our custom item group of the citrine right and we’re going to do the same thing here mod item group dot citrine and then there you go now they’re going to be added to both of them which is absolutely no worries you can actually do that right in the new Item group system you can add the your items to as many item groups as you want and just for you know demonstration purposes we’re gonna actually add them to both why not I mean this is just you know for demonstration I think that that makes a lot of sense right there we go And that is actually all that we need to do so this is all of the item group that we need if you need a second one or a third one you know you just make a new item group you just just duplicate this right you make this one between two you Know you change the name right here you change the name here and then there you go and now you have a sec right so it’s very very straightforward once you have one of them it is very easy to add another base so let’s go into the game One more time and see if everything works alright so here we are once again in the game and if we open the inventory we can already see that there are two arrows added here and that is exactly what we want you can see the Citroen item group and both of our items are Included here and if we go to the ingredients we can actually see that they are also included inside of the ingredients item Group which is absolutely perfect and both of our items have been successfully added to the game absolutely freaking awesome and that’s it for this tutorial thank you so much For watching and I’ll see you next time so yeah Video Information
This video, titled ‘Minecraft 1.19.3 – Fabric Modding Tutorial: Custom Items | #2’, was uploaded by Modding by Kaupenjoe on 2023-01-23 15:59:48. It has garnered 15871 views and 323 likes. The duration of the video is 00:15:48 or 948 seconds.
In this Minecraft Modding Tutorial for Fabric in Minecraft 1.19.3, we are adding a Custom Item to Minecraft!
== SUPPORT ME ON PATREON == ▶️ https://www.patreon.com/Kaupenjoe
== COMPATIBILITY == ▶️ Compatible with 1.19.3 and 1.19.4 🛑 NOT COMPATIBLE with 1.20.X
== ASSETS & DOWNLOAD LINKS == GitHub Repo: https://github.com/Tutorials-By-Kaupenjoe/Fabric-Tutorial-1.19.3/tree/2-items Assets Zipped: https://url.kaupenjoe.net/mbkj07/assets
== 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 ▶️ Learn Forge Modding with Minecraft 1.18: https://url.kaupenjoe.net/CourseForge118 * ▶️ Learn Fabric Modding with Minecraft 1.18: https://url.kaupenjoe.net/CourseFabric118 * ▶️ Complete and Roblox Lua Game Development: https://url.kaupenjoe.net/RobloxCoupon *
== 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