Welcome to part two of how to create your own custom items in Minecraft today we’re gonna be going over how to give your new custom item its own unique ability okay so now that we have our item given to us now what we want to do Is work on the ability of the item so in order to make the ability of the item work our main goal is to be able to execute any kind of commands off of the entity that either is our custom item or is using our custom item so for example For the carrot on a stick we want to be able to detect when the player right clicks and we want to be able to run commands off of the player when the player right clicks and for entity detection these are these are relatively easy to do so for snowballs for example You want to be able to identify any custom item snowballs thrown into the air and execute commands off of them same thing goes for any custom item mobs that were summoned then we want to be able to execute commands off of them and same thing for an armor stand any custom Eider armor stands we want to be able to identify where their locations are and run commands off of them such as placing a custom block or anything like that or let’s say you’re trying to make something where you’re dropping an item onto the ground and that makes it Explode then you want to be able to identify where the item is and then summon TNT right on the item for these types of items it is very easy and for the carrot on a stick it’s relatively easy but you do have to do a bit of scoreboard stuff but if You’re going to do stuff with a bow or with a fishing rod it gets a little bit harder because you can’t directly detect the fish bobber and you can’t directly detect the arrow because with these the snowball an actual dropped item the armor stand or the creeper or any mob Spawn egg all you have to do is type in the tag that we did if you remember from my Stormbreaker all I had to do is type in Stormbreaker 1b right here and that’s really all you have to do to identify these types of items however when it Comes to these items since these are tools launching another entity out the entity itself does not have that tag so it makes it a little bit harder to actually be able to detect off of these so now I’ll go into my text editor and actually show you all the commands that you will Need to make custom items out of these specific items or any dropped item and this will also work for detecting any type of generic item such as the tank ammunition that I used in my data pack or the fuel I use in my data pack and It’s the same thing as these items where all you have to do is type in the tag and you should be able to detect it inside of any chest dispenser or anything like that okay so now I’m gonna show you the commands that you use to Get these running now if you’re doing a really small data pack or a really small custom item you don’t need a day to pack however if you want to make it into a data pack you can but you can start with just command blocks so I’ll start with The right-click so these are the commands you’ll need so first of all you will need this exact code except for example objective you can change that to whatever objective you want so basically you’re creating a scoreboard objective and add just means you’re creating it and this is the important part minecraft I used : minecraft carrot on a stick that’s basically detecting if you are using a carrot on a stick and if you right-click a cure on a stick then that scoreboard score will increase by one whatever scoreboard name it is is based off of whatever you name it right here So I just call it example objective for this example obviously and then now in order to detect the players who click it you want to execute on all players who have a score for this objective of at least one that’s what the one dot dot is So on all players that have a score of at least one so they’ve clicked a carrot on a stick then you want to also detect if they’re holding the correct one so selected item is carrot on a stick and then the tag is whatever you tagged your Carrot on a stick so for my example that I used for Stormbreaker I called a storm breaker one B so if I wanted to run my tags off of it I would do tag storm breaker 1 B and then at at S which is thus just the position of the player who write Holding that specific care on a stick and then run whatever command you want to run and then finally you need to be able to constantly reset the objective if the player clicks so that you can detect it again so you also need this looping scoreboard players remove and Then for all players who have a score of the right-click objective whatever you named it of at least one then you’re going to remove it from that example objective and you’re gonna remove one and this basically resets it so that you can detect it again so you only need Three commands to get it working but if you want it to be more advanced and you will probably need more so for example for a rocket launcher what I did once was here I ran another command that summoned the projectile and then I have another function file that creates the Velocity and the explosions for the actual projectile so now I’ll show you an example of the right-click so what it did here was I created the example objective and it’s for the carrot on a stick just like how I showed you and then here I’m basically executing on any One that right clicked and is holding the carrot on a stick that is Stormbreaker and then if so then I run off of the player anchored at the eyes summon a lightning bolt three blocks in front and one block down and then this is just a resetting it the exact command I showed you earlier so now if I right-click with this you can see that it summons lightning every time I click so now let’s move on to detecting entities such as snowballs mobs armor stands or dropped items so here is the set of commands you will need there’s Only really like two necessary to get it working for entities so for armored stands and mobs all you have to do is execute as all entities and then tag equals whatever tag you give it when you get give yourself the armor stand or the spawn egg and then at the position and Then run and then whatever command you want to run and then if it’s a mob what you want to do is just teleport it into the void so that it doesn’t die and drop its stuff on the surface so you do the same thing but teleporting down and if it’s An armor stand then you can just kill it and I’ll show you an example of this so what I did here’s the command it’s just I’m giving a spawn egg which for the entity tag has custom bat notice how it doesn’t have one B that’s because It’s an entity tagging not an item tag because I’m tagging the entity so now with this bat spawn egg you’ll see I just did a little example here which just says something places a block of stone and then teleports a bat into the void and as you can see it just works so You could have anything from this obviously it’s not just limited to placing blocks because that would be stupid but you could actually create other custom things so for example you could place this down and then I don’t know maybe a machine gun turret pops up that starts scanning for mobs but once You have your mob down you can basically execute whatever commands from here from that spot as long as you detected where that mob was placed and now for snowballs it’s a little bit different so it’s basically the same though so all you have to do is execute from the Entity but instead of just doing tag equals you actually have to do the item tag so NBT equals and then go into the item : and then curly brackets tag : curly brackets and then the tag 1b so here’s the snowball I just gave it custom ball 1b and then here is the snowball and so now if I throw it you’ll see that I just made it summon bats wherever it goes and as you can see it just leaves a trail of bats behind and if you wanted to only work on impact then you’ll need to do some more Specific commands there but this basically gives you the platform to start that and if you want to see an example of only executing commands on impact then you can see the throwable water data pack okay so when you’re trying to make a custom item by using a bow or fishing rod it’s Really going to be a little harder than using some sort of entity or a right-click detection because you’re not executing on the player with the custom item and you’re not executing on the custom item itself where you’re trying to execute on a projectile being launched out of your custom item and Depending on what you’re trying to do this can be very difficult but I’ll show you an example of just trying to execute directly on the projectile and then I’ll also explain what can make it harder to do so for this example it’s just a bow that shoots explosive arrows it’s just Five lines of commands so the first one is basically just creating the objective which detects if a player shoots about and the second one is basically detecting if a player has shot a bow and is holding the special tagged bow for this example the tag is custom bow 1b And if so then it will tag the nearest arrow to that player with the tag called boom and then it also is checking for any arrows with that specific tag called boom that is also stuck in the ground and it will summon a creeper that will explode instantly and then it will kill That arrow so it doesn’t just sit in the ground constantly summoning creepers for two minutes and then also there’s a reset here which is basically just like the reset for the right clicking which resets the scoreboard for the shooting the bow as you can see the bow is Summoning a creeper and the reason that doesn’t do damage is because I made it not do damage because they don’t want it to blow up my area but you could easily make a deal like now I’ll explain what makes this hard so if you’re trying to make something that Just the text the arrow or just the text the fishing bobber then it really isn’t a problem because you can just do the method I just showed you however if you want to do something like a grappling hook that will get a bit harder because you’re not just trying to detect which Projectile is being shot out of the custom item but you’re also trying to detect which player shot that specific projectile out of your custom item which can start to get tricky because you’re trying to match a player with a custom item and that player also with the Projectile that was shot out of the custom item and then especially if you have multiplayer stuff then that starts to get very complicated with players like swapping locations and getting closer to the projectile or whatever so depending on what you’re going to use if you’re trying to detect both the player And the projectile being shot out of the item and trying to match them together that can start to get complicated and I’m not going to go into that right now so the last thing I want to add before I end this video is that although the examples I’ve been using have been Pretty simple of like three to five commands I do want to explain that that is just a start and just an example of how it can be used but when you’re actually creating custom items they can be very complicated and they don’t have to be simple just like how I did here so I’ll give you an example with the right clicking of the carrot on a stick so for example if you want to do a gun you might be thinking well I can’t really do that all I could do is summon something off of the right click however that’s Actually usable for a gun because how I did it was when you right click it summoned an armor stand into the air and then there’s another function file that detects that specific type of armor stand and then it calculates the right trajectory to send it off on and it’s Also able to detect any blocks in the way or any entities to deal damage to and all that kind of stuff so keep in mind that you can use other function files to build off of your own custom item in order to give it more functionality because the examples here Are just executing directly off of the custom item or the user of the custom item and you can do a lot more by building off of that so I’ll see you guys in the next video where I will show you how to use block bench to give your items a custom model And I will also show you how to create some way of acquiring your custom item whether that be through crafting or a loot table with a custom mob in the last video Video Information
This video, titled ‘Create Custom Items PT2 UNIQUE ABILITIES 1.16✔️ || Minecraft Data Pack Tutorials’, was uploaded by Timber Forge on 2019-09-08 17:14:38. It has garnered 105823 views and 2709 likes. The duration of the video is 00:13:01 or 781 seconds.
This is the second episode of the 4 part series where I will go through the process of creating your very own unique custom items. In the last episode, I went over how to choose your item and give it to yourself with mcstacker.net. In this episode, I will go over how to give your item a custom ability if you chose some sort of usable custom item.
In the next episode, I will show you how to use Blockbench to create custom models and textures for your item, and in the last episode, I will show you ways to make your items obtainable by crafting or as a mob drop.
Check out my new website! https://tinyurl.com/timberforge
Join my discord! https://discord.gg/bwBsSbr If you have any questions, join my Discord and feel free to leave a Youtube comment.
#datapacks #minecraftmods #minecraftdatapacks