Hey guys and today I have another kind of technical video this is going to cover slow casting now it may be a bit panned antic by the title but it’s pretty clear what’s going on so essentially I’m able to cast a ray in a slower rate and detect when I hit a Villager and then also detect what happens at the very end and this is going to be in the form of a module that you guys can kind of mess with a few things that I have designated so if you want to install it go ahead and go to The link in the description it’ll be a zip folder drag it into here it will say unzip me so then you unzip the zip folder because it will be in this format so it’s going to be in a compressed zip folder and you need to extract the files And then when you open the folder the first thing you see should say data impact that’s an important thing that sometimes gets mixed up with different computers anyways so hopping into it it’s a very lightweight pack it really has maybe I think 12 functions so it’s not even a Part of the mapmakers toolbox because it doesn’t do things for you necessarily it’s something for you to manipulate and take a look at so the principle is pretty some simple you have a ray that you’re able to do like ray casting but it’s in a slower rate and it’s in a much Better way than your traditional TP @ s4 right so this will move me forward but if I went if I’m right here and i TP forward I just went through the villager so I’m no longer able to detect him so this basically offers the same crystal clear protect detection as Ray casting But in a slower or more noticeable format and you can control how fast it is so in the example file under example and this is just a system that I use in my packs anything that is not inside zi private is something that you can mess With zi private is supposed to be kept intact unless you know what you’re doing or you really know what you’re doing but this is the stuff that you can safely mess with as long as it still does what it’s supposed to now this is a pretty simple convention so I made the Raycast function for this by default have a precision of 0.5 blocks so when you’re inputting these numbers you just take the number that you put here or whatever number you want and divide it by 0.5 or multiply by 0.5 and that’ll show you how far it’ll travel so with a Value of 4 the array travels in two blocks per tick if I put the value of 1 that means it will travel half a block per tick but then it’s really like you could have just done TP forward by 0.5 so I don’t know why you’re using this Now so you usually don’t want to use one so let’s go with 2 or 4 4 is good we can make this thing faster but we’ll look at that later then the DST slow cast so DST per is how many per it travels so related to the speed and DST is the Total distance so this is going to be 12 blocks because we are in half block steps so 24 oh so I can change this to let’s say let’s really dramatis eyes it 248 now if I type reload and I play the example I’m going to align myself so I’m Looking straight you can really see that there is a delay there between the start and the finish there’s a lot of cool properties about this delay so we can actually mess with a the raycast thing that happens along the way and this is something you would definitely want to Mess with by default I’ve loaded it with a nice preset of a perfect hitbox here where it says hit but you can play a function here and the context of this is that anything after this run statement is something that you hit with a pretty accurate hitbox for any entity in the Game and a test will refer to the thing that you hit and at E with a tag of this at eat I equals this refers to the player so not only is this allow you to detect entities but also keeps context of who is playing this keep in mind that If you use this there will be two things that the tag of this the player and I think the area effect cloud that has a tag of slow cast so you may see something pop up where you see this is applying to two things and that’s just because there is Two things associated with this this is the area effect cloud and this is the player now I use that to make sure that you don’t accidentally hit the ray caster in the ray casting which is a common problem you accidentally hit your leg because you shoot looking down Demonetized anyways so then all this stuff is actually kind of important to the system I wouldn’t touch it thick the only thing that you could touch is the 0.5 value so you can make it more or less accurate and then changing from air to some kind of block tag actually I Think by default I’ll make it slow cast air I’ll just change it to that and slow cast air I’ll have a couple things in and you can mess with that we’ll just hop over there real quick but I think that’s for the best and then you can change the particle you can have No particle or you can change what particle it is so one of the things that you’ll be able to edit is going to be right here we will call this air and this will just be air so for now slow cast air goes through air and K there Because K Bayer is also air and if you want to add a new thing use add a new line make sure there’s a comma type in the name of the block that it can go through but anyways this basically I’ll explain how the system works later but I’m explaining how to use it for now now as for the functions so that’s how you mess with Ray cast you can change what happens right now it just says hit and the entity it hit you can change what that does with a function and keep in Mind anything tagged with this is both the player and the area effect cloud called with the tag of ray cast slow cast so once you reach if you hit a block that you’re not supposed to go through it will cause an end to update and you don’t mess with this but you can Mess with what happens at the end right here so this will cause the end to happen there’s another system that will cause the end to happen and that’s if you’ve traveled the maximum distance which we’ve already seen an example of the context here for the end this is what happens at the end So the function title to end is what happens at the end and for you it won’t have the diamond block thing because that might get annoying but it resets the slow ID score this kind of needs to be there but you can change what this is So this just doesn’t say command you can do any command you want you can play a function in your own pack so this can just be a namespace in your pack and you can do whatever then start is basically what happens when you start it And I left it out here because maybe you want to do something but really you shouldn’t I just left it out here so it’s a shorter slash function command to type now if we go up into example really all you need to do to activate this is Set some global score here set a global score here and play the start function and when you play the start function it’ll go don’t worry these global scores can change while another one is already going the global score just gets immediately transferred on to the dummy Area factor out now as for kind of a background as to how it’s working it’s fairly simple and also complicated at the same time right but it summons an area of that cloud and the area that cloud gets the same score as the player now the area of that cloud gets the same Score as the player Darry if that clock is the same scores that were on the global score before it was spawned which is why it still maintains some stuff you don’t want to touch these scoreboards because they’re kind of like just for the system you just mess with the slope a scoreboard Now that entity then gets to face the same way the player is and then it is started with the launch so the launch code the launch code tags anything that has the same score as the area effect cloud that’s this command with this so that you know like who the player is to Make sure that you don’t accidentally hit the person who cast it and then it loads the distance that it’s supposed to travel in one raycast it plays the raycast then it subtracts the distance that it did travel from the total distance so if the total distance reaches less than zero From this subtraction then it decides to end and then it removes the tag of this afterwards to maintain the context of how this works and how this is not persistent so keep in mind how we give the tag and when you remove it at the end so the next entity that plays this Function will see nobody in the world with the tag of this just itself it’s just you immediate you add it and remove it before even the next execution line alright so that’s pretty much it now we go in the main and what this does is just at all of the area effect clouds You just run the launch command so it’ll do launch it’ll give the tag it will do the right cast it will remove the tag and then it will do it again for the next one that’s in the world if you have multiple it plays this every tick and Then and simply locates the play the entity it this works for non players as well which it could be optimized if you changed the @e here to @p that’ll be a little bit better but I wanted to make it so you can use this on anything but It finds the entity that is not that is linked to it and it runs the true end and kills the area effect cloud to delete the middleman that way effectively giving you an output of and similar to how you would see in a raycast in a ray cast when reycraft cast is over Your context is you’re at the position of the end of the ray cast but still as the original caster and that is the point of this data pack to maintain ray cast consistencies but with this slow caste system now if I were you what I Would do is I would go to slow cast see this I would just drag this into my own data pack this whole namespace believe it or not you can have more than just Minecraft in your namespace you can have your own as well but throw this into Your data pack go ahead and go into your own load and tick functions and add this to your tick function with a comma just like that on to your own data packs tick function and this into your own data packs load function and if you do that Then you don’t have to mess with any of the namespaces and all you do is you just access my own functions the way that I just described them to you and you can edit this tag to edit what blocks you can go through anyways that’s pretty much it let’s just go Ahead and throw the example out and you can see that it just kind of keeps traveling and the way that I have this the raycast configured it stops inside the block so it does that as well and let’s hit this guy and it doesn’t stop When it hits an entity then it says hit villager it says it twice because it doesn’t stop when it hits an entity and you can see cloud wolf has ended so it maintains context of the original entity anyways guys it’s pretty much it kind of highly technical but this thing is very Useful for certain situations in fact I’m going to use it on my server for stuff like rocket launchers RPGs things that you don’t want hitscan to happen but anyways other than that if you guys have any suggestions let me know I’ve personal side note I have an interesting Kind of Q&A video coming up but I’ve been really busy so that’s why this video is out at a weird time and kind of like I missed my weekly – uploads and that’s because I’m writing literally 315 page essays in the span of a week but anyways thanks for watching and I’ll see You the next one peace Video Information
This video, titled ‘Slow Raycasting in Minecraft [Datapack + Tutorial]’, was uploaded by Cloud Wolf on 2020-05-07 01:10:08. It has garnered 8218 views and 270 likes. The duration of the video is 00:12:31 or 751 seconds.
A small but useful datapack for doing raycasting over multiple ticks while still keeping the consistency of raycasting.
New version! https://www.youtube.com/watch?v=6iwiIez8VlA 📦 Download: https://www.dropbox.com/s/fxwg3wssi6js55u/slowcastingv1.1%28unzip%20me%29.zip?dl=1
⚔️ Server IP: cloudgames.ml 🔵 Discord Server: https://discord.gg/HyZPCTu 💻 Website: https://dtdeadpool.wixsite.com/cloudgames 🐺 Twitter: https://twitter.com/cloudwolfbane 📧 Email: [email protected]
Music: “Werq” Kevin MacLeod (incompetech.com) Licensed under Creative Commons: By Attribution 4.0 License
All Songs Used under fair copyright. Lincenses Below: License for commercial use: Creative Commons Attribution 4.0 Unported “Share Alike” (CC BY-SA 4.0) License. Full License HERE – https://creativecommons.org/licenses/by-sa/4.0/legalcode