How’s it going guys and finally we are back the 1.14 update came out and now I can turn my head just like it should be again so that’s freaking great that they got rid of that so without further ado today we are working on the second set Of the spells tutorial this is the thing that where you’re going to be creating let me enable the demo pack but yeah so we’re going to be going over the second spell and this is going to this one is going to have some ray casting involved it’s actually simpler than the fireball In terms of like well it’s a little bit complex but the spell itself is very short and it won’t take us very long to make it should take about 15 minutes 15 to 20 minutes but anyway we’re gonna have some really cool stuff this is what Its gonna do just so that you don’t have to wait your time so here we go we hit him and it shows how much damage we did – 10 – 10 and as you can see it makes sense because villagers have 20 health and also the bullet stops once I hit him So that’s also very useful so bullet stopped when I hit him and it shows how much damage I dealt and that is a variable value and it’s not something I have to hard code it will forcefully say how much damage I do let me just kill Him alright so and I right now in our spells pack there will be a download for the base spells pack in the description we’ve already done one video on this and and it covered a fireball but the base pack won’t have the fireball code so if You want to do it you just gotta go back to that video and just follow the steps doesn’t take it super long that’s just how you make the fireball but I just wanted to give you guys a base pack to start off with you just want to start Making your own spells we haven’t added a man a consumption but it’s super easy to add that you would just have to remove remove score and then check if they have enough when they want to do the spell anyways so let’s go ahead and disable this data pack that’s already Doing things and get into making this thing because just like normal I make it myself then we make it from scratch or from the base that we’re at alright so here we are and this is your functions data pack this is the functions so we covered this last time if we go to Spells directory so what happens when I right click area on a stick is it takes me to this directory and I’m gonna keep these other files open because I might need them anyway so the directory is going to have a thing where it grabs the element that It is off of the data tag from the item it grabs the spell ID from the data tag of the item and then based on that element and spell ID we figure out what to do so we’re gonna add another line here and call it light okay and this is Going to be element two so light will be element two and I’m only doing this kind of thing for organization because it helps so we’re gonna go light okay then inside light we’re going to do the same thing that fire does so fire has a directory so we’re gonna go lights there Were no fire directory I mean and this will play if the ID is one it will play light /h beam I’ll just call it beam that’s alright alright so then the we’re gonna need a folder for this because there’s more than one file and I don’t want to get Things out of hand so it’s gonna play beam slash in it so this means we start we start the beam alright so in the starting the beam so this is still stuff that’s going to play when the player has the item so what is it gonna play and we Get rid of these directories all right so what it’s gonna play is we’re going to have to start the raycast line okay so we’re gonna start the raycast line and we’re also going to set the damage because we want to make this damage variable because that’s a really cool Thing to do so you’re also going to want to pop into in it and create a new scoreboard called damage which will be able to adjust so scoreboard players sets a DES meaning the players who played it damage 10 and I’m actually gonna make me eight so that you know That there’s no mumbo-jumbo going on no magic this is all variable then we’re going to do execute positioned up 1.4 so this is gonna make it move the command play point to where my eye level is then run function spells : light sly spells : spells slash light slash beam slash ray Cast all right so now we’re gonna start doing the real ray cast which I’ve gone over before but I really gone over in depth like how to make it stop at certain points and hit things so now we’re going to actually do that so ray casting is pretty simple Let me grab do I don’t need that here we go I need this particle so we are going to play an end robbing particle alright then what we’re going to do is after we play that interval particle we are going to position it one direction that it’s Facing and we are going to play the command now we want it to stop when it hits blocks so we’re gonna go if block and then it’s going to play this thing unless block tilde tilde tilde hash tag minecraft : my air so if it’s in a block Called my air and I can put this if I put it before then it will allow the bullet to go one in the bullet it’ll allow my mana automatically demonetised it’ll allow the raycast to go one inside the block if we put it after then it Will stop right before it goes inside a block so that’s just a cool little thing that you can adjust depend on what you want to do okay so that’s gonna make it stop if it sees air all right so let’s make it go one deeper inside just Because we can I guess I prefer it that way alright now we need to make it do stuff constantly so you’re going to do execute if entity that you type equals and this is where I forget okay so this is where we have spells and do I Call it it has to be the file name so it’s ha hash tag spells tot colon has to be the folder name so make sure this is your folder name and then it’ll be enemy okay so it’ll hit an enemy and if there’s any within a distance of point Within 0.7 I think I did 0.01 point three five and we are also going to force this thing to be positioned down by like 0.7 because the origin of the hitbox is on the feet so this is just gonna give a big hitbox and you can go Into a lot of testing of like figuring out the perfect hitbox I have some nice hip boxes for tall creatures and it does head shot body shot leg shot but this is just a simple version for now guys so then if there is one then we’re gonna do Stuff now we also want to stop this when it hits something so we’ll add another case so unless there is something that it finds and what we need to do to make it do the exact same finding thing is we have to position the thing down negative 0.7 so that we’re consistent see how we find it after positioning down so we’re gonna position down and then after we check we’re gonna position back up so this is what we’re doing so here’s the bullet it’s right here the raycast right it’s right here we’re gonna temporarily move it down see If it see something then move it back up if it didn’t see something even if it did it’s it’s still gonna move it back up then if it didn’t see something that it’ll move forward in the direction it’s going for the check the other line we Just move it down and see if there’s something there all right so then we’re gonna go run function spells : generic slash damage all right so now we’re gonna create a new generic file which is for damaging entities so this is gonna be damaged okay let’s clear it so this Is based off of a another video that I’ve done where we grab the health of the entity we put it on a scoreboard then we put these so we’re gonna go let’s go through this where was our knit here’s our not this one or in it for the pack all right so we’re Gonna need another generic scoreboard called health alright so we go execute as ie type equals villager store result score how a s-health run data get entity is health so that will get their health and put it on the scoreboard so if I goo scoreboard objective a supper if I put the sidebar To be health you will see 2020 2010 for these villagers and I’m 51 that’s arbitrary because I use the scoreboard for other things in this world so first we are going to get their health right then we’re going to do and instead of all of them we’re just going to do this One this specific one so instead of doing every villager we just do this one all right and spells thought this is a entity tag and we’re going to be dealing with will add the entity tags afterwards but it’s basically a way of grouping a group of entities that you want to that You want the game to recognize so more than just one guy so I don’t have to put every case and I can change it up in the top level of my code rather than the bottom level so it’s not as annoying so first we do this then we go let’s Continue along this line scoreboard players operation that guy his health is gonna – equals are damaged so a dennis is still the player because we haven’t changed he’s pulling the command so the player is still playing the fan so add us will give us the damage of the player That shot and this is very multiplayer friendly so then it will remove it then we can do some checks here you can go execute if this guy if his if his score of health is less than zero then you know that he’s going to die so you can Do some checks in here to like do something on death but all I’m gonna do is I’m gonna go we are going to go it was here we say no one really cares about that I’m sorry if I have to look back here a little bit why don’t I have This okay I might have added a few things but sorry if I have to go back here a little bit I mean this other one is kind of messy anyway and it has some code from other things but I I made this thing like two months ago Or one month ago so I don’t have it perfectly memorized all right so we’re gonna play spells Tut : generic slash indicator so we’re gonna play that file okay and let me change this to spells underscore touch thanks forgetting to do that for you guys this word is going to Be whatever namespace you used – spells thought yours is something else alright so we need one more generic function and this one is gonna be indicator and this is something I’m not going to build here because it’s very complicated and I’ve gone over it previously not this specific thing but I’ve gone over Previously spells Tut : enemy yeah all right so I’ve gone over this before basically what we’re doing is we’ve put an oak sine 150 blocks in the sky the oak sign on it says the score of my damage then we summon an item that has a Name that’s red then we copy the data from the sign the words from the sign onto the item and then that is it and the item will have the name on it and then we make the item die by giving it a high age so this is all that you need And it will be linked in the description from the download because I have to copy/paste it of course so that’s fine that’s all you need for this indicator so back to the damage function so we play the indicator we play the indicator then we get the health we remove the Health then we can go scoreboard players operation no no you go execute store results execute store result entity and then you go health and this one is a float scale of 1 and then you go scoreboard players gets a TAS ok so we need this thing so it will Store on the health data their health score so whatever this new health is after removing it okay so grab health remove from the scoreboard put the scoreboard back on the health I’ve gone over this before there’s a tutorial on it on my channel now the last thing is I Just need to do this this part right here as so that that s is talking about the villager all right so that’s really all there is to it sorry if that took a while I’m trying to just get back into the groove of things but let’s refresh and let’s see so when We right click let’s go / function spells : light light beam light beam and nits so the thing that’s not working oh I forgot to add the tags let’s add the text so let me go to data packs the link that I have in the description will have This thing in it already so that’s good that what you have it so you got to go tags entity types and let me change it to enemy since that’s the convention we used all right so enemies are villager and if you want to add more things that This can hit you can go like that and then you like zombies so it hits a villager and a zombie alright so then that groups those entities together so if you ever want to change who you’re hitting it’s easier then also we have to add my air so let’s see tags locks let’s Copy glass and call this my air glass is just the demo thing so my air is going to include air this one is gonna include lever and that’s it just so that it can oh and we’ll also include that the type of glass just so that just for the hell of it so That it can go through a few things but not water all right I had a bunch of faces to make guys the anywhere you see that word spells needs to change the spells I mean any where you see the word spells underscore cut it needs to be spells I’m getting confused because my Namespaces are different and then one thing was in the raycast there was in the raycast you need to make it if block is air if it’s in the air then keep going right and that was really the only changes that need to be fixed now now The other thing is you have to go before you play the indicator you have to do this tag at us add damaging tag at us remove damaging and why do we do this so we do this because we do this so that what can happen is when the sign is Placed this is like a multiplayer compatibility thing to add so when it places the indicator sign it’s gonna pick the nearest player and there’s you can’t do a DES and the sign it has to be at least @p for the score so since it has to be @p then it won’t work for Multiplayer unless you specify what the nearest player you want so we add this tag to the player it picks the player with that tag and then it removes the tag so no two people can have the tag at the same time and I have tested this and It works so there you go ate ate ate ate ate ate ate ate ate ate damaging the hitbox kind of sucks on it it’s not very big and I also made it so barriers are not considered air so that’s why it’s not hitting the second guy as well I Didn’t add it to my air list but you can add it to the air list if you want anyways guys kind of longer one I’m gonna try and edit things out also quick update the several websites up I’m working to get the server out for 1.14 since it’s already released and it Thinks they’re coming along pretty cool you can check out the website many of them at CES peace Video Information
This video, titled ‘Light Beam Spell in Minecraft’, was uploaded by Cloud Wolf on 2019-04-27 18:37:51. It has garnered 10011 views and 258 likes. The duration of the video is 00:17:45 or 1065 seconds.
Raycasting, Custom Damage, and Damage Counters! We go over some fundamental aspects of a good raycasting system in this example of a custom spell.
💡 Important Code Used: Spell Tutorial Base Datapack: https://www.dropbox.com/s/ws9tthinog0xsw3/spells_base.zip?dl=1
🙏 Subscribe??? Pls? 🔥 Lit Discord Server: https://discord.gg/HyZPCTu 💻 Website: https://dtdeadpool.wixsite.com/cloudgames 🐺 Twitter: https://twitter.com/cloudwolfbane 📧 Email: [email protected]