Hey guys it’s thomas here with technovision and in this episode of our fabric tutorial series i’m going to show you how to make a basic item like this ruby that you can see on screen all right so to get started what you want to do is come over to your package explorer Here and under the tutorial package or whatever you named your mod package you’re going to right click and create a new package and we’re going to name this registry and just like you would expect this is going to hold all of our classes in the future that register things like custom Items blocks and other stuff in the future so we’re going to right click on this package here and we’re going to create a new java class and we’re going to name this mod items now this class is going to store our custom items that we’re going to add and Register to the game so you want to come down here and we can actually create our first item right away so let me just create a little a note here so that we know that these are items and to create an item you can just create a public static final Item objects and you want to import this and make sure you import it from net.minecraft.item and you can name it whatever you would like so in my case i’m going to name this ruby because we’re going to be creating a ruby object so you want this to equal a new item Object of course and this is going to take in a item.settings object or settings object so we can pass in a new item dot settings objects and uh you could leave this how it is right now if you want but if you would like let’s add a semicolon There at the end to finish this you can actually append on several settings to your item to customize it there’s not a ton of options because this is just a basic item but for example we could first do dot group and this will allow you to pass in an Item group which is a specific creative tab to store your item so for example i could do item group dots dots and you can see that there’s a bunch of different creative tabs that we could select here and if i were to select for example item group dot Materials this means that the item the ruby item will show up in the materials tab in minecraft so yeah you can select whatever you would like here and we’ll cover custom item groups in a future episode you can also append several other options if you would like although of course they’re all optional You can keep appending on here and see that there’s some other methods like for example rarity this will allow you to select the rarity type for um to change the custom color of the actual item itself i believe some of the rarities come with like a yellow color for the Name or a blue color so for example we could do that we could depend on a rarity and let’s say we want the rarity to be rarity dots uh and let’s do uncommon so this will make our item name have a yellow color just like i believe the um i think maybe The golden apple is yellow i’m not sure which one is which item is yellow and minecraft but uh yeah and of course this is optional so you don’t have to do this if you wanted to have a white name i’m just showing you some examples here and then we can Also do for example you can see there’s a lot of them here you can make your item fireproof you could uh set the max count we should do that actually uh let’s set a max count of 16 here so the max count is going to determine the Max stack size so if you know in minecraft for example a i think it’s eyes of ender have a stack size of 16 so this will actually set that to a stack size of whatever you want so you could even have a stack size of five or even one Uh and if you don’t do this if you don’t touch this at all then this will just default to 64. the default item stack size but i’m going to put this here just so we can have some fun a little settings to add and of course you can keep going and do some Other stuff and we’ll talk about the more advanced ones like food and recipe remainder in another video so yeah now that that’s done we have our item here but we need to actually register it to the game so that our game knows that this is a real item To actually use so uh let’s make a little method here that we’re going to call in our main class so i’m going to create a public static void method called register items and this is going to register all of our items in the future and also right now So that we can just call this method in the main class really easily and it’ll be a really quick way to just register all of them so to register this item in particular we’re going to call the registry class so registry dots and then register and we’re using the register static method here And first thing you want to pass in is the the actual registry that we’re using so this is an item of course so we’re going to use the item registry so you can pass that in with registry dots item and you can see that there are a lot of different registries we’ll be Working with all of these in the future like block for example or you know enchantment there’s all these different types of registries but we’re going to be using item for right now and then you want to pass in an identifier that points to your item so you can do this with new identifier And what we’re going to pass in here is pretty much our mod id and then the path to our item so to make this make a little bit more sense i’ll make a little comment here every single item in minecraft has a special identifier and it’s always the mod id so mod id Colon and then the path or the name of the object so item name for example and so in our case since our mod id which if you remember in the main class here we have it set right here to tutorial and same in our our fabric.mod.json in our case we would want our Our identifier for our object to be our mod id so tutorial colon and then the name of the object so ruby and uh minecraft also has vanilla identifiers so you’ll notice in minecraft that there’s minecraft colon uh like what’s an item coal for example so yeah that’s what an identifier is and That’s what we’re making right here so let’s uh first pass in our mod id so we can grab our mod id from this static uh string here by calling our main mod class so in my case tutorial mod dot and then we have that mod id but of course you could just Pass it in as a string if you want and then we’re also going to pass in the path to our object so in my case just ruby and this should always be uh lower case you can uh if you want to add spaces you could do underscore so you could do Like uh shining for example underscore ruby you could do that if you want to add a space there but um i’m just going to be using ruby just to keep it simple and again just to make this clear this identifier object is pretty much just creating this string for us it’s creating tutorial Colon ruby so that’s all it’s doing i believe you could actually even just pass in this string if you wanted instead but yeah so that’s what the identifier is and then lastly we’re going to pass in of course the actual item we want to register which is our ruby item so We’re going to pass in our ruby item there and yeah you can see that everything is working great with no more errors so now all we have to do is actually just call this uh this method when the mod is initialized so we can come over here to Our tutorial mod uh class and on this on initialize method we can just call mod items which is our class that we just made and then dots register items and again this just means that when the mod is initialized it’s going to make sure that we register all these items to The game so they are they are available to the player all right so now our item is in the game but we need to add a texture otherwise it’s just going to be a blank looking item so to add a texture what we have to do is go over to our Resources folder here and we need to go to the assets folder under it and you should have a folder the same name as your mod id this is your mod id folder and it’s going to contain pretty much all of the important models and textures and even language files for your mod so If you don’t have this you can just create it right now but yeah you want to have this mod id folder here and you want to right click create a new directory and we’re first going to create a models uh package here so hit enter so you should have a models folder Under your mod id folder and then go back to your mod id folder and we’re going to create another directory here this one is going to be called textures and so pretty much all of our models for our items and our blocks are going to go Here and all the textures are going to go here so inside of models you want to right click and create a new directory and this is going to be called item and this is going to store the models for your items and then in textures we Want to right click and create a new directory and this one is going to be items plural with an s on the end and this is going to store the textures for your items like you would expect so what we want to do is create a model Here which is going to be a json file using json syntax to actually specify where our texture for this item is located so we can do that by right clicking and creating a new file and you want to name this the exact same name as your path so for Example if we go to mod items here you can see that our path is ruby so whatever you put here for your item is what you’re going to put for the actual name of the json and it’s very important that you get this correct so right click create a new file and we’re Going to call ours ruby.json hit enter and there we go so we have a json file here now json syntax can be a little bit tricky and it’s also a little confusing when we’re modding minecraft so to make this simple if you go in the description Of this video i created a sort of template item model json for you and we’ll go over it in a second so it’s not you know super confusing but essentially you can actually just copy this right now from the description so copy and you can actually paste it in here And this is our item model so this is for a basic item although you can modify these and create you know more advanced stuff and we’ll cover that in the future but just to go over this we have the parent field here which is just setting what the item is going to look Like in the game so in our case there’s several of these that you can choose from and you can we’ll talk about more in in the future but this is just a basic generated item so that’s what we’re setting here just saying it’s a regular item and then we have a texture Field here with a single layer and this is going to point basically to that that mod id colon and then item slash your path name so pretty simple all you have to do is replace these two fields here in capitals so replace your mod id with your mod id so in our case Tutorial and then replace the item name with uh the name of your item so again that’s what you put right here in the path so in my case ruby yeah so this is just basically just saying that the first and only layer for this texture is found in your tutorial Uh the mod id folder so right here then the items folder in textures so items here and then ruby so it’s saying that it’s looking for a ruby.png inside of this specific folder here great so we can file and save all all right now to add Our actual texture to the game what we want to do is go to the desktop here and i actually already created a texture for us but if you don’t know how to make minecraft textures i’ll link in the description of this video a great Tutorial on how to do it you can do it with ms paint or something like photoshop and essentially the important thing to note here is that you want your texture to be in increments of 16 by 16. so i recommend starting out with 16 by 16 but If you wanted to make a more hd looking image you could do increments like 32 by 32 or something like that but yeah you want to make sure that they are increments of 16 by 16 with preferably a bit depth of 32. so once you have this uh this png here You want to name it the exact name that you have here for your path again so everything should be again the same name for this so make sure you name it the same thing and then you want to drag it into this folder here in your uh your mod id Folder textures items and you can either do that by uh you can either drag it oop here we go we can either drag it directly into this folder here from intellij or if you want you can go into the file itself you can go to tutorial mod which is our mod folder And you can go to source main resources assets tutorial or your mod id folder whatever you named it uh textures items and then you can throw it in there so either are both uh you know both work uh but that’s just to show you both Options so and now if we actually go to items here you can see that we have added the ruby.png to our actual uh our actual package explorer okay so the last thing we need to do is just give our item a name inside of the game now so to Do that we can actually come up here to our mod id folder and we’re going to create another package now so new directory and this one is going to be called lang and this is going to store the language file that stores the names for our objects and eventually our blocks and Other things in the future so you want to right click here and create a new file and you can use whatever language file from minecraft that you would like but in my case i’m going to be using english so i’m going to do en underscore us dots json but of course there are Other language files if you would prefer to make this for like spanish or whatever language you want so yeah ian underscore us.json for english and then inside of here we’re going to add some curly braces and you can just fill this up with pretty much your items and their name as Fields so we’re going to create a field here with some quotation marks and for an item you want to use item dot and then your mod id so in my case tutorial dots and then that name that we set here again for the path right always again Using that same name so in our case ruby and then you’re going to make this a field with a colon here and this is going to be equal to a essentially a string which is the name that will appear in minecraft so you can use spaces here this will appear as the Actual item name in the game so you could put like you know shining cool ruby or whatever you want it to display in the game but i’m gonna just put ruby to keep it simple and yeah that is gonna set a custom name for the item okay so now that we are Done we can actually run the game again by going up to add configuration going to application selecting minecraft clients hitting okay and then making sure we have minecraft client here hit that green triangle and i will see you guys when the game has loaded alright so now that we are actually Inside of the game we can go to our creative inventory here and if you remember we actually set our creative tab for that object to the materials tab now in minecraft they have renamed the materials tab to the miscellaneous tab so if you click that tab there and you Scroll to the bottom you should see your item if that is the tab you set it in so you can see our ruby is right there you can also always go to the search items tab and scroll all the way down and your items should always appear at the bottom There and if we hold shift you can actually see that just like we set the max stack size to be 16 it is actually working the max stack size is in fact 16. and again because we set that rarity uh field to uncommon we have that yellow Name but again if you didn’t uh set that then it would just be a regular white name but that was just to show an example so we have our ruby object and if you throw it on the ground everything should be working great and yeah so we have our first custom item Working perfectly all right so that’s going to do it for this episode thank you guys so much for watching and i will see you in the next episode Video Information
This video, titled ‘Minecraft 1.19: Fabric Modding Tutorial – Items (#2)’, was uploaded by TechnoVision on 2022-07-19 20:48:16. It has garnered 5363 views and 132 likes. The duration of the video is 00:16:09 or 969 seconds.
This tutorial series will cover building a Minecraft Mod from scratch using the Fabric API! In this episode, we create a basic custom item with our own texture, name, and settings.
— Important Links —
● Item Model JSON: https://pastebin.com/ryPV5XGx ● Texture Tutorial: https://www.youtube.com/watch?v=Sg_znEXBD7k
● Support Discord: https://discord.gg/m5fjByfrKP ● Source Code: https://github.com/TechnoVisionDev/Fabric-Modding-Tutorial-1.19
— Timestamps —
0:00 – Intro 0:09 – Create Item 3:55 – Register Item 7:44 – Add Item Model 11:23 – Add Item Texture 13:02 – Language File 14:39 – Final Product Demo 15:50 – Outro
— My Channel —
● Subscribe: http://tinyurl.com/zbc7mwy ● Instagram: https://www.instagram.com/tomm.peters ● Twitter: https://twitter.com/TechnoVisionTV
#minecraft #modding #tutorial