Hey guys it’s Thomas here techno vision and welcome to the next episode of our minecraft modding tutorial series for 1.15 in this episode we’re going to be creating some custom basic tools and we can just get right into it so every tool in minecraft has what is called an item Tier or an eye item tier which is essentially a material tier that has basic values like a harvest level the maximum amount of uses and efficiency speed based attack damages enchant ability all those different attributes are all put into an item tier and that is shared across all items like all iron Items have an iron item tier so we’re gonna create a basic one of those for ourselves a custom one first and then we’re going to make our tools so in order to make that item to here we want to go to our package Explorer right click on tutorial or whatever you named Your your mod here your mod folder package and we want to name this tools and this will house more stuff later but for now we’re just gonna right click new Java class and we want to make sure this is an enum not a Java class so once you Have enum selected name this mod item tier you can also replace mod with the name of your mod like tutorial although it doesn’t really matter what you name it and add the two repositories okay so the first thing you want to do make sure this implements item tier and that is Going to give us all of the methods so we can import class and hover over this implement methods and select all of them and hit OK so this is gonna let us get all these basic values that I was talking about earlier so we need to make A couple items and you can make multiple over time but I’m just gonna show you how to make one I just seen your the process so first thing you want to type up here right in front of this semicolon or I guess we can get rid of this for Now just so it’s easier to understand so first you want to type the name of your enum so this material that we’re gonna make this material tier is going to be the Ruby tier it’s basically gonna include everything that all Ruby tier Ruby tools rather are gonna have so I’m Going to name it Ruby in all capitals add some parentheses here and it’s going to pass in a few so the first value is going to be the harvest level so the harvest level is essentially the level at which a tool needs to be to harvest a specific or so For example diamond tools are able to mine diamonds but if you were to try and mine a diamond ore with say a wooden tool it doesn’t have a high enough harvest level to to mine those blocks same sort of idea so if you go to the website in the description here you will See a MC creator wiki and I know we’re not using MC creator but this information here is really useful because it’s all in place and we can go to harvest level here and you can see these are the vanilla harvest levels so zero is would want a stone and so on so I want my Ruby tools to act like diamond in terms of harvest level so we’re gonna put three as you can see there all right so three is our harvest level now next we want to put in the maximum amount of uses that a tool has so we can also go Back to this link here and see that for vanilla items the where is it enchant ability number of uses here we go so diamond tools have 1561 uses that means after you use the the tool 150 1561 times the tool will break just because of durability so I want mine to Be in between iron and diamond as you can see here so I’m gonna make mine 800 so 800 so that means that all Ruby tools will have about 800 uses in them now the next thing we’re gonna pass in is the efficiency this is how fast a tool mines A block so again go to that link in the description and we can see the vanilla and efficiency values here iron is about 6 and diamond is 8 so if we want to be in between those two I would put mine as 7 and I think it has to be a float value So putting 7.0 F so next we have to put the attack damage now this is really important this is the base attack damage so pretty much every tool that has this item tier is gonna have this as a base damage and then any damage values you add on top of this Which you’ll see later on in a sec is gonna be added on top so to avoid confusion I would say the best thing is probably to set it as zero but it really depends on if you’re gonna have multiple item tiers here so just to sort of Display this feature I’m gonna set this as three point zero F just so you guys can see what this does so that means that all Ruby tools are gonna have at least minimum three base damage and then I believe the second to last thing is enchant ability so if you don’t know What enchant ability is these are the vanilla values right here essentially in Minecraft different tiers of tools like iron and gold and diamond all have different abilities to get high level enchants so you can see here that gold has 22 whereas diamond has about ten and That means that gold has a much higher chance to get good valuable and chance then say something like diamond or stone so I’m gonna put mine as a little bit higher than diamond so diamond is ten so I’m gonna put twelve and that means that we’re gonna get some pretty good Enchants hopefully if we were to put it in an enchantment table now this last value we can’t actually pass in just yet because we don’t have the item we’ll do it in a second but just know that this is the repair material and we will just put this note Here just so we know to come back in a second it will give you an error while we wait but this is going to be the material that you use to repair these items and an anvil pretty much so before we you know come back to this repair Material we need to make some data members and a constructor so we can actually pass all these things in so let’s first make a privates final int harvest level and we pretty much just need to do this with all the values so next one would be a private final int max pieces Then a private final float this time efficiency privates final floats attack damage next one would be enchants ability so privates final int enchants ability hope forgot a semicolon their privates final and then the last one is a supplier actually for the repair material so we need a supplier parameterize around ingredients and We’re just going to name this repair material all right and make sure you import supplier as well from Java util dot function it’s very important alright so inside of or the reason we’re making these final rather is because we don’t really want anyone to change them out From outside the class is really no reason to but we do need to make it constructors so mod items here I mean to pass in all of these so int harvest level comma int max uses comma int efficiency comma oh sorry I believe that’s float float efficiency floats attack damage int and chance Ability and then supplier ingredients repair material and then add some curly braces and inside of here last thing we have to really push through is that we need to assign the variables so this dot harvest level is equal to harvest level and we’re just going to be doing this pretty much for All of them so this thought max uses is equal to max uses this dot efficiency is equal to efficiency this dot attack damage is equal to attack damage this dot and chant ability Oh enchant ability there we go I knew something was off there is equal To enchant ability and then last one is enemy repair this dot repair material is equal to repair material okay so we’ve assigned all the variables we need to make sure that we have a semicolon on the end of this enum here and last thing we need to do pretty much Before we get to repair material is we need to set up all of these what do they call it methods so first our get max uses is just going to return what you would assume the max sees is then efficiency is gonna return an efficiency attack damage it’s going to return an Attack damage harvest level harvest level and so on enchant ability and chance ability and for the repair material it’s going to be the repair material dot get so that we get the actual ingredient we can come up here and file save all now to get this repair Material we actually need to create the item first which sounds a little weird because we’re actually using this class to create an item that we use to create this class I know super weird but just follow along and I promise it’ll make a little bit more sense so go to your Registry handler class and we’re gonna create a new section down here called slash slash tools and this is gonna hold all of our tools they are just items but they are going to use a different class than just item so we’re gonna create our first tool which is a sword and we’re Gonna do public static final registry objects and this is going to be parameterized around sword item because it is a sword sword item and the name is going to be Ruby underscore sword as you would expect this is gonna equal items dot register now we’re gonna pass in the Name first so Ruby underscore sword pretty much same thing we’re used to comma except this time instead of just passing in a base class we’re gonna actually make the item right in this class so it’s gonna be a lambda statement so two parenthesis a dash and An arrow and a curly brace or I guess we don’t need to clearly brace this time because we’re just creating a new sword item so bring this privacy down to the second line because it is gonna be a lot of code and it’s going to go off screen If you don’t so we’re going to create you let me get rid of this thing there we go noose or item and this is gonna pass in I think it’s for different values or three values and then just the properties so first thing we need to Pass in this sort item is the the actual tear this is what we just made in our mod item tear so mod item tear dots Ruby you can see it right there dot Ruby comma and then next we need to pass in is the damage so this is how much damage The sword is gonna do to a to a mob or a player now remember if we go to our mod item to you here we have this attack damage right this is the base attack damage so anything damage you add here any value is going to be added on top of The space damage so because this is three if we were to put for example two for this value you can see it pops up attack damage in what this means is it’s going to be adding two to the base damage here of 3 for a total damage Amount of six now you might think well two plus three is five yes that’s true but all items have a base attack damage of one I know this is like really crazy to follow but just think of it like this so base items have an attack damage of 1 Plus the base damage which is equal to in this case three plus the added damage which in our case is two that’s what we’re setting here so hopefully that makes a little bit more sense the one is automatic by vanilla minecraft this 3 here is what we set here as a base Attack damage and you can set that to whatever you’d like and the added damage is what we’re setting over here in our registry handler class with the item so I’ll just delete this but hopefully that makes a little bit more sense so setting this to two will actually cause This sword to do six damage every time it hits which I believe is only about three hearts in Minecraft because you divide it by two now the next value is going to be the attacks this is also honestly just as confusing and I really don’t know why it’s this Way but all items and Minecrafts for whatever reasons start with a base of attack value of four and this is like a pre 1.8 sort of combat so there will be no cooldown if that’s what you want then you can just leave this as 0.0 F but in My case I do want to cool down because I want the vanilla cooldown mechanics for 1.15 if you don’t know what I’m talking about I’m talking about how when you hit something with a sword it takes a second for it to sort of get ready to attack Again so what you actually have to do is subtract from the main value of for the base value so if I were to actually type in negative two point four F into this this value here attack speed what this is doing is subtracting two point four From the base value of four so again all the type is appear four is the base minus two point four so what we’re getting here when we set this value as negative two point four is an attack speed of one point six and that’s actually the vanilla attack speed I Think of all Swords if I’m correct or at least all iron swords so just remember that if you want a cool down on your sword or your tool you have to subtract from before and I believe if you set it I mean setting it to zero like zero point zero that will Just you know have no cooldown if you set it to something like 1 or like five or something I don’t actually think that’ll do anything but you’re free to try that if you’d like so I’m gonna set a cool-down with negative two point four comma and then last thing we need to set Is the properties so we can just type new item properties group and we’re gonna set the group here to our tutorial tab this is that custom tab you made or you can set it to a vanilla tab whatever you’d like and I should mention when you’re making these tools this is Actually this tool is finished but if you want to add new things to it new interesting properties you could do after this dot group method dots and you could check out all the other properties you can set for example you could set know repair this would make it so that You cannot repair this item in a and an anvil which is super interesting and there’s a few others you can actually make your tool a food item if that’s you know for whatever reason something you wanted and there’s a few others in here but for now I’m just Going to keep it like this because this is all I need so we’ve finished our sword item and what we need to do is go back to mod items here and set our repair material to that actual sword item and we can do that by making a lambda statement with An arrow and a curly brace and inside of these curly braces we’re actually gonna type return return ingredients dots from items and inside of here we’re gonna pass in the registry handler dots and then a ruby sword and then dot gets so you might be wondering in a semi-colon Of course you might be wondering why are we passing in our sword into this value so you can pass in any of the items that use this this tear and the reason this kind of makes sense basically we’re getting the ingredient of this this item here this tool and that way the game Sort of knows what item to use in the anvil to repair you know to repair your your tools I know that’s a little confusing but just think of it like Oh a ruby sword needs another like ruby item to repair so that’s what it’s it’s getting here is that another ruby item All right so we’re actually done with our mod item to you here if you wanted to add new tears you can see we’re using this Ruby tear right here mod item tear doc Ruby if you wanted to add new unique tears you could just copy this paste it Below and then just rename it to like something new like court if you wanted like a courts here and then you could literally just rename all or sorry not rename you could change all of these values here just make sure that instead of a semicolon you add a comma after the Ones above that way this is included in the the actual class but we’re not going to make a second one but just know that’s how you make a second one and then if you have like a second tier when you made a new item you could do instead of Rubi dots and you can see there’s quartz so you can suck quartz instead we’re gonna keep ruby but just you know that’s what you would do get rid of this enter in the comma into a semicolon all right so we have our sword here next thing you Need to do is actually create some Jason’s so if we go into our resources assets tutorial models item we can see we have our Jason’s from the previous tutorials what you want to do is go to the description of this video go to the second link or I believe it might be the Third it will take you to a paste bin this is the the Jason you need so copy it all right click copy and then you want to right-click on item new file and again name this exactly what you have here Ruby underscore sword Jason hit enter add to the repository and you can Just paste this in and the only thing you need to change is the mod ID into your mod ID like this tutorial and the item name again the item name is just what you’ve got right here Ruby underscore sword you can just copy that and paste it in alright so this is Pretty much it for the JSON you can actually see if we open up our Ruby Jason it’s pretty much exactly the same except instead of item generated it’s item handheld and that’s because it’s a handheld tool so we’re actually done all we need to do is add the texture and I Guess add the name but that’s not super important so go to your desktop here and I actually have some tools here but you want to make a texture for your your sword name it exactly what you have named here Ruby underscore sword and open up your minecraft modding folder Tutorial mod source main resources assets tutorial textures items and inside of here just drop it into there and we can close out here and you can actually see in our textures folder have Ruby underscore sword and we can go to laying as well yen underscore us JSON And we can just copy this item give up here make sure to add a comma because we are adding a new entry and instead of item that’s tutorial Ruby it would be item Dell tutorial Ruby underscore sword because again this name here should match with this one right Here this name we set and we want to set this name to ruby sword okay so file save all and i believe if we launch the game now we should have our sword in the game so i will see you in a second inside of the game Okay so we’re inside of the game and if we go to our creative inventory and go to our custom tab there is our sword and it does say ruby sword and thankfully we can actually see the attack speed and the attack damage and it is 6 and 1.6 Exactly what we wanted and sets and we can test this out with a spider here so it should do there we go three hearts we can see that right there so it should take about four hits or three hits to kill and you can see here that when we hit our our sword It does have that cooldown it’s taking a second there and it does have the same cooldown as something like a diamond sword you can see same length cooldown as our ruby sword here and I do believe yeah you can see here it’s exactly like a diamond sword in like stats except it Is a little less effective it has one less damage but again you can see that it is working so we do have a perfectly working sword that’s custom alright so that’s pretty much all you need to do to create a custom tool but I’m going to go through all the different tool types Just so we can see them for example purposes but just to know that it’s pretty much the same process so we can actually copy this whole two lines here and then right below paste it in and instead of sword item we’re gonna make a pickaxe next so it would be pickaxe item We can rename Ruby underscore sword to Ruby underscore pickaxe same with this name here instead of underscore sword underscore pickaxe and instead of sword item it would also be again a pickaxe item and this also takes in the same value so you can actually leave all this The same if you want or change it up I want my pickaxe to do much less damage the sword so I’m gonna said it’s a zero and that will cause the pickaxe to have a damage value of four because again we’ve got that base damage of three plus The vanilla damage of one so that will give us a damage of four and for the attack speed we’re gonna set this to negative two point eight so that it has a less or sorry a higher cooldown and that’s pretty much it you’ve got your Ruby pickaxe we just need to make the Jason we can copy the Ruby underscore sword Jason and paste it back in and just name it Ruby underscore pickaxe refactor add and instead of Ruby underscore sword just name it Ruby underscore pickaxe and we should also add the what is it called the PNG the texture so dota minecraft modding Your mod source main resources assets mod ID textures items and I’m going to throw all of them in there right now just because I don’t want to keep coming back to this folder but you’re just gonna throw them all in there again making sure that the names of the the PNG files are the exact same as the name of your item and they should pop up there we go oh they did pop up so we also want to go to ian’s underscore us Jason once again copy this line paste it below change from sword to pickaxe and changes To pickaxe there we go so if we file save all this will now actually make a pickaxe in the game so once again just to show if we go to our custom tab we do have the Ruby pickaxe here again it does show the attack speed and attack damage And let’s just go into game mode survival real quick this is like a regular pickaxe so it doesn’t do very well against dirt or against wooden objects and it does have that cool down we can see where it takes a while to come up but of course it is going to Work super well stone objects things that a pickaxe normally would do very well breaking so our pickaxes work and let’s go do the rest of the items okay so hopefully you’re sort of seeing that this is pretty much the same process just repeated so we’re gonna do speed around This time I think we’re gonna do three or four objects at once now just so we can really get through this so copy this and let’s make a paste below instead of pickaxe items and this next one is gonna be a shovel so it’s gonna be a shovel item rename pickaxe to Shovel rename pickaxe once again to shovel and then again shovel item and the values are gonna stay mostly the same I want the attack damage to be 0.5 F and I want the attack speed at this time to just be negative 3.0 and we can keep the Rest the same then we’re gonna make another entry this time you guessed it an axe axe item rename pickaxe to axe once again same thing renamed axe and axe item now this damage value I’m gonna keep this sort of vanilla we’re gonna make this damage value 5 because we do Want it to be higher than the sword at least if we’re keeping with vanilla trends but the cooldown is going to be much higher with negative 3.1 cool down and then I think last one is a hell so we can create a hoe item and again instead of pickaxe hoe instead of Pickaxe here we put home and then lastly instead of pickaxe item hoe item and a hoe actually is the only tool that has a different constructor so instead of there’s no attack speed I believe it’s just oh sorry there is a tax speed there’s no damage value so you can get Rid of this damage value here just have our mod items here our attack speed and the the Builder the tap so for our tax speed I’m gonna put negative one point out because that’s what most of Anila hoes are I believe so that’s pretty much it For all of these these items now we just need to make all of their Jason’s so once again you can copy the sword JSON copy paste it in and instead of sword we’re gonna call it now let’s do shovel next and add to repository once again instead of sword shovel file save all And then we’re just gonna keep doing this for every item so instead of sword next is the axe and we can rename a sword axe in here as well and then one more instead of store we’re gonna put Howe and instead of sword again put home Okay so if we close all these files here close close close we should have now for Jason’s a sword pickaxe a shovel and axe and a hoe so every tool type in the game now and we have all of the textures as well remember you put those in earlier so Last thing to do is just go to en underscore us Jason and once again we need to make more of these entries instead of pickaxe we want shovel and we need this to shovel as well instead of pickaxe here we’re gonna put X and X again and then lastly our Hoe there we go yeah Ruby home alright so and remember no no comma on the last entry here so that’s pretty much it for all tools I think yeah so and if you want to clean this up by the way I’m gonna keep it like this and the github Repositories you can see it better but you can actually move this back up if you’d like to have everything on one line and then move them all together oh that brought me all the way out there we go there we go so you can organize it like that if you’d like them all Together I just so it’s easier for you to see all of them but yeah let’s run the game and check them out and once again we’re in the game let’s open up our tab and there are items the axe the shovel the hoe and let’s really quickly just test them out by Going to game-mode survival so the hoe does what a hoe does I guess um in Minecraft the axe is going to work on wood there we go and you can see that it obviously doesn’t work on like grass as well and the shovel is just gonna you Know do what a shovel does so all of our tools are working perfectly and you now have some custom tools in the game and that is gonna wrap things up for the video today thanks guys so much for watching I hope you learned a lot and make some really cool tools and once Again I really hope you check out this wiki page down here I’ll leave a link to it it has so many great vanilla values that you can use as well as this damaged page which will show you all the different damage values and base damage values as well as attack speeds that you Can sort of mess around with yourself but other than that thanks guys so much for watching and I will see you in the next episode Video Information
This video, titled ‘Minecraft 1.15.2: Forge Modding Tutorial – Custom Tools (#7)’, was uploaded by TechnoVision on 2020-07-06 06:00:28. 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 some custom tools, each …