The slash data command is your main way of interacting with nbt data in minecraft you can use this to quickly copy inventories into chests make furnaces cook at warp speed or make pigs fly the limits are limitless it’s used to get merge modify and remove Nbt data what is nbt data some of you may be thinking legitimace i already know how nbt works but do you know what it stands for no seriously do you i literally do not know uh let’s google it named binary tag okay when you type slash data and look at the Autocomplete we get four sub commands slash data unsurprisingly works with data nbt data to be specific the nbt format allows you to store all these different types of data which boil down to numbers text true or false values aka booleans lists where everything in the list is the same type Arrays which are so similar to lists that you will almost never use them and compound which is a thing that can contain more things for grouping and organization purposes it sounds like a lot but it’s really not let’s take a look at an example of slash data slash data Merge we are going to merge some data into an entity and then we select our entity let’s choose the nearest pig so at e type equals pig sort equals nearest limit equals one then you can see we just put in some nbt data let’s say we want to make this Little fella fly up into the air we can just add a motion tag here and for the motion set it to zero on the x one on the y and zero on the z hold still little man hold still Oh such fun oh oh oh oh no to prevent this from happening in the future we can set the pig’s invulnerable tag to one rendering him immune to all damage except the void and creative mode players attacks now using a command block mine cart i know right i can finally create my pig Archery range oh i suck but there’s a lot more you can do with the data command isn’t there merge is very simple it just sets the tags you tell it to in the command very direct and convenient but what about modify well let’s make a basic command Let’s just see what this bad boy does slash data modify and let’s modify an entity you can modify any of these three things we’ll get to that later at e let’s use the nearest pig again type equals pig limit equals one sort equals nearest so that’s our target and now the Target path this is where modifying diverges from merging using modify we can only modify one tag chosen using the target path so here we’ll write the name of the tag just the name if we want to modify the health of this pig we’ll write health no curly brackets no colon just Health then we get to choose what we want to do with the pigs health tag since health is a float which is a type of number the only thing we can do is set the number to something i’ll get to these other options later with a number Anything other than set will give you an error now we choose whether we want to set the health tag from another tag or just an arbitrary value if we choose value we can specify a number like one and running the command will set the tag to that number We can set the health to one and the pig will have half a heart zero and the pig will die this is exactly what the merge command did but with different syntax and more limitations but what about from now that’s enticing now we can set the Pig’s health from any other nbt tag we can access be it stored in a block entity or just floating in the ether of storage we can do all sorts of fun things with this let’s choose from entity and then ourselves at f now we choose the path we want to check in ourselves In this case how about our food level now when this command is run it will set the nearest pig’s health to be equal to our hunger bar so if we starve the pig dies this says a lot about our society this opens up the potential for so much weird Stuff the options are truly limitless here and we’re not even done learning sub commands speaking of sub commands i command you to s append prepend and insert are all used specifically to modify lists and arrays these are pretty simple first make sure the tag you’re targeting is actually an array it won’t Work if it’s not then you can add new values to the lists just like with set you can add a value to the beginning with prepend at the end with append or somewhere in the middle with insert when using insert you also have to choose the index aka Where in the list you want to insert to if you’re doing something complicated enough to need these i’m just gonna assume you can figure out how that works and we’ll move on to the next thing merge is the last one and it works exactly like data merge except it merges With the compound tag of your choosing instead of with the entire nbt structure while writing this i really couldn’t immediately think of a widely applicable use for this but there’s definitely some specific cases where you’ll find it helpful the main thing it does is function like set but without Overwriting data that already exists like if you wanted to change an item’s id and count without changing its custom name or enchantments i i’m really drawn a blank here guys i’m sorry merge is there when you need it moving on slash data remove deletes a tag entirely just joins it from existence Great its syntax is just like all the rest you give it the name of a tag and it deletes it now let’s finally talk about slash data get and also a little bit more about nbt paths slash data get the simplest of them all gets data and puts it into the chat but Wait it’s actually useful keep watching first of all you can use it to test your commands and check nbt data to make sure everything’s working the syntax is quite simple data get and then let’s get some data from our self entity at s and let’s get the item that we’re Holding so the selected item tag you can see that i am holding a diamond sword with a count of one and some tags like the enchantments but what if we want to get just the count just all on its own let’s talk about nvt paths for a Second though yes they’re often just the name of a tag but they can be more than that let’s say you want to access the number of items you’re holding you can use selected item to get the whole item tag but what about just one tag from Inside it well you can access that with a period selected item dot count easy we can get our enchantments using selecteditem.tag.enchantments and yes items just have a tag called tag that stores all their non-standard tags you just learn to accept these things so this gets us our enchantments if we want To access a specific enchantment we need to access it as an array using square brackets and an index like so this will get us the zeroth item in the ray but remember everyone arrays start at zero so the zeroth value is actually the first the first is the second and so on Let’s give this a try yep that gives us our first enchantment sharpness 30 000. man wouldn’t it have been easy to start with slash data get literally does nothing on its own but it’s secretly the most powerful one of all because while yes you can use it to Test your commands and check nbt data to make sure everything’s working more than that it can be used in conjunction with slash execute store and yeah you’re gonna have to watch my other tutorial for me to explain that one it’s a whole thing basically it lets you put Nbt data into a scoreboard and then do math with it which is very useful okay maybe it’s not as unique as slash data modify but i certainly use it more often execute store that is storing values i got from flash data get so that’s why i said it’s more useful alright for your Homework this time try and figure out how to do all the things i listed at the beginning of this video in case you forgot that is copying inventories into chests making furnaces cook at warp speed and well we already did the making pigs fly thing so uh just mess around Subscribe now i’m hungry Video Information
This video, titled ‘Minecraft Data Command [1.19] Tutorial’, was uploaded by Legitimoose on 2022-03-17 13:00:31. It has garnered views and [vid_likes] likes. The duration of the video is or seconds.
In this tutorial, learn the /data command and all it’s many subcommands. The data command is used to modify NBT data in a block, …