How to Optimize Your Datapack

  Рет қаралды 21,415

Cloud Wolf

Cloud Wolf

Күн бұрын

Пікірлер: 133
@IJAMinecraft
@IJAMinecraft 4 жыл бұрын
This is a very useful video, and a lot more in depth than I expected! Somehow I kind of overlooked the schedule command until now and forgot about its existence 😅
@Cl0udWolf
@Cl0udWolf 4 жыл бұрын
IJAMinecraft ya it is like a repeater in a datapack, and just as useful!
@pp8818
@pp8818 4 жыл бұрын
hello IJA
@liam8398
@liam8398 4 жыл бұрын
Using /schedule is like an addiction, things are so much easier when you need a pause between functions.
@cubedeveloper9504
@cubedeveloper9504 4 жыл бұрын
Yeah same for me, I always used scoreboard timers 😅
@redpug5042
@redpug5042 4 жыл бұрын
@@Cl0udWolf i didnt even know /schedule existed
@trilo_boy
@trilo_boy 4 жыл бұрын
i thibk, this is the only video in youtube how to optimize ur datapack
@Cl0udWolf
@Cl0udWolf 4 жыл бұрын
haha cool
@boltstrikes429
@boltstrikes429 4 жыл бұрын
didn't know i should be using AEC's instead of armor stands... that explains why one of my maps with 250 armor stands was unplayable :P
@Cl0udWolf
@Cl0udWolf 4 жыл бұрын
would probs go from unplayable to full speed XD
@fishybusiness1149
@fishybusiness1149 4 жыл бұрын
mumbo: *sees tip 1* mumbo has left the chat
@gingerdude3666
@gingerdude3666 2 жыл бұрын
this saved me from a very laggy datapack. the 'chunking' of functions has helped me immensely, especially with bosses.
@liam8398
@liam8398 4 жыл бұрын
Great video! Something I learned that is useful when you need to check entities/items is to give them a specific tag, so they won't be checked again and this will improve performance, since the selectors checked every tick will decrease.
@NOPEnameMC
@NOPEnameMC 4 жыл бұрын
Me: *makes a virtual computer using a datapack that runs extremely fast* Also me: *likes to use redstone in his adventure map*
@Cl0udWolf
@Cl0udWolf 4 жыл бұрын
hehe ya i actually use 0 command blocks nowadays and its super awkward feeling at first but very satisfying
@NOPEnameMC
@NOPEnameMC 4 жыл бұрын
​@@Cl0udWolf Yeah, most of the time I like having a datapack as well. Another big advantage next to performance is, you can find your stuff a lot easier! But sometimes I just want to build a small redstone contraption xD
@TristanPopken
@TristanPopken 4 жыл бұрын
@@NOPEnameMC Same! i love to make small redstone/command block contraptions like an elevator or something normally but when i make a huge datapack like my Custom Stronghold generator i really do need to use datapacks
@hlibprishchepov322
@hlibprishchepov322 3 ай бұрын
@@Cl0udWolf sounds painful. i hate including datapack and rename each time
@mattomanx77
@mattomanx77 3 жыл бұрын
Thank you for these! Immediately started noticing the performance improvements.
@NOPEnameMC
@NOPEnameMC 4 жыл бұрын
Function trees is basically how I made the MC64. The datapack is >90% function trees xD
@Beetless
@Beetless 4 жыл бұрын
what does function tree mean
@NOPEnameMC
@NOPEnameMC 4 жыл бұрын
This video -> 2:41
@Beetless
@Beetless 4 жыл бұрын
@@NOPEnameMC thank you
@kayathemaya8971
@kayathemaya8971 4 жыл бұрын
Thank👏you👏so👏much👏!
@elygolden
@elygolden 4 жыл бұрын
Great points! A few things worth mentioning: Take care when using the /execute command to run functions. executing a function as multiple entities multiplies the number of commands the function uses by the number of entities executing it. This means that doing this could cause the chain length to grow beyond the limit, which could have unintended consequences. AECs have a maximum lifetime, so if you have entities that your datapack requires to be persistent, it is usually better to use armour stands (2,147,283,648 ticks is about 3.5 years, but it's always good to be prepared). Otherwise, AECs are indeed better.
@Cl0udWolf
@Cl0udWolf 4 жыл бұрын
Ely Golden ya I agree but that doesn’t really hav to do with optimization. Doing execute and using a sub function if operating properly will save u space, sure it runs the function once per entity that matches requirements But if that was ur intended purpose then it’s better than doing the same thing but making it multi lines like: execute as @a run say hi execute as @a run say yo execute as @a run say ye Still says hi for each player But if u made it execute as @a run function say hi say yo say ye Would still be way faster cause u don’t use the selector twice and runs the same amount of commands + 1 to start the function. Basically what I mean is under 0 circumstance is it better to break lines that run the same selector and what u suggest seems to oppose that, if not then it suggests the user doesn’t understand how their code works and probs didn’t optimize selectors
@rewindcat7927
@rewindcat7927 4 жыл бұрын
Amazing thank you so much. That AEC tip is priceless. Thanks again.
@Izzy.256
@Izzy.256 8 ай бұрын
just realized i'm gonna have to rewrite my ENTIRE datapack... oh shit...
@misode
@misode 4 жыл бұрын
Thanks for making this video :)
@SAMEER_99
@SAMEER_99 2 жыл бұрын
Thank you so much. It really helped me.
@Inspirator_AG112
@Inspirator_AG112 4 жыл бұрын
I had a *Datapack* where [I was making "invulnerable blocks" (-This was not what it was about.) by putting *Falling Blocks* in the location of *Barriers* so these blocks are impossible to mine.], but I noticed the *TPS* slowly lowering if I got far away from these "invulnerable blocks". If I got close again after having low *TPS,* the *FPS* would spike to zero. Using *"say @e",* the *chat* would return "Falling Block, Falling Block, Falling Block ...". Using *"/kill @e[type=falling_block]",* the *chat* would return "Killed [A 5-digit number of] entities.". I thought *Falling Blocks* _always_ lasted 1 *tick* (-Or 0.05 seconds).
@0x2480
@0x2480 4 жыл бұрын
I would make it kill the falling blocks then spawn them, It should reduce lag.
@cubedeveloper9504
@cubedeveloper9504 4 жыл бұрын
Thanks for the useful tips :D
@novopotato
@novopotato 4 жыл бұрын
Underrated
@supericeg5913
@supericeg5913 Жыл бұрын
There is a bunch of stuff I will definitely try. I think me letting all my timings scoreboards do their own thing falls in two of these categories.
@koorikitsune38
@koorikitsune38 3 жыл бұрын
To see AECs I normally use the "composter" particle on repeat, but it's just for debugging and stuff.
@talwat321
@talwat321 3 жыл бұрын
why the composter particle? why not something like flame or whatever
@koorikitsune38
@koorikitsune38 3 жыл бұрын
@@talwat321 It's so they vanish faster than the other ones... in 1.17 I believe another could be electrical sparkle or whatever
@Beetless
@Beetless 4 жыл бұрын
One of your best videos I think
@Cl0udWolf
@Cl0udWolf 4 жыл бұрын
Beetless thx I put more time into the recording aspect
@sajeucettefoistunevaspasme
@sajeucettefoistunevaspasme 4 ай бұрын
Top 10 useful advices
@coolcat2656
@coolcat2656 2 жыл бұрын
Wish I found this earlier, will recc to friends
@Reqaug
@Reqaug 4 жыл бұрын
Thanks for this very informative video!
@kazii_the_avali
@kazii_the_avali Жыл бұрын
i would love to see an update to this. i know a few things has change such as the new entity for markers is the marker entity (witch will mark a posision)
@julianthaler2741
@julianthaler2741 4 жыл бұрын
Could you please make a whole video on "how to check blocks" because I am tired of checking all different blocks in Minecraft to find out what block it is and I don't know how to do the method you told me in this video
@Cl0udWolf
@Cl0udWolf 4 жыл бұрын
what do u mean like execute if block air ? or checking an area of blocks thats too vague
@aerbon
@aerbon 4 жыл бұрын
@@Cl0udWolf i think he is asking about how to fing out what exact block is at a given position
@superalvin7208
@superalvin7208 4 жыл бұрын
@@aerbon Data get?
@aerbon
@aerbon 4 жыл бұрын
@@superalvin7208 that only works on tile entities (dispensers, furnaces, etc.)
@themcscripter2111
@themcscripter2111 4 жыл бұрын
0:53 mumbo jumbo please look away.
@Cl0udWolf
@Cl0udWolf 4 жыл бұрын
TheMC Scripter ya I did that on purpose to prove a point
@themcscripter2111
@themcscripter2111 4 жыл бұрын
Cloud Wolf indeed. I’ve always thought mumbo should make minecraft coding videos. I personally think redstone is now outdated. Sure use redstone in survival worlds but creative worlds. Data packs are the way to go.
@-penguinify
@-penguinify 2 жыл бұрын
Thank you!
@rewindcat7927
@rewindcat7927 4 жыл бұрын
I have stayed away from using schedule for repeating commands because I am concerned that if a tick goes wrong somehow, the whole repeating functionality is ruined. Never been able to really test its reliability, so my question is: have you ever had issues with the schedule not working? Thanks!!!
@Cl0udWolf
@Cl0udWolf 4 жыл бұрын
Rewind Cat schedule will always schedule lol the function is thrown on a stack even if u lag it is coming
@rewindcat7927
@rewindcat7927 4 жыл бұрын
Cloud Wolf that’s enough for me. Scheduled functions from now on! Thanks again!
@connerduncan7411
@connerduncan7411 4 жыл бұрын
Due to the short circuiting of selector conditions, would you not need to place the type at the front instead of the back of the list in order to prevent the processing of tags or is this a special case based on the nature of the particular condition? What I wouldn't give for comprehensive documentation on details such as this.
@Cl0udWolf
@Cl0udWolf 4 жыл бұрын
Conner Duncan yes order matters I was just bulk recording stuff
@themeninwhite195
@themeninwhite195 2 жыл бұрын
The problem with the schedule command is that if the player quit during the delay between a function and another, the delay will reset. Idk if it's intended or it's a bug, but it's a serious problem. For exemple, i want a falling_block to not despawn after 30 seconds, so i could schedule a function every 25 or so seconds to optimize, but if the player just join the world for a few second the commend cannot run, and the falling_block will despawn the next time the palyer join. Also, now they added the marker entity which is really lag friendly, but it misses a lot of useful things like the possibility of having passengers, so area cloud effect could still be useful. The problem? It seems a spawned cloud area effect cannot be teleported, in any way
@slightlyniceron
@slightlyniceron 9 ай бұрын
Markers are another great solution instead of AECs
@roei900
@roei900 4 ай бұрын
in 1.16 and over you can use marker entity instade of AEC
@tischregal9678
@tischregal9678 2 жыл бұрын
I got a quick question, I have a function for sound repition in my Dp which executes 20/s every tick. It's basically like: -execute playsound if score=1 -execute if score @s =1 put score @s 200(lenght of the sound) -scoreboard player remove @s score 1 Would Making a schelude for that be much more Performance efficient or negligible?
@stanferrolino12
@stanferrolino12 Жыл бұрын
if the length of your sound (in ticks) can be divided by some kind of dividend (without any remainder), say, a sound length of 200 ticks can be divided by 20, then you can set both the scoreboard limit and a scheduling loop to follow that kind of formula. example: [200 tick sound = 20 tick loop * 10 scoreboard timer] Although oddly timed sounds might get cut off in the end. Depends on you though, some efficiency for just a tiny bit of overlap within your sound.
@AgentM124
@AgentM124 4 жыл бұрын
I remember mojang saying that selectors parse and interpret orderedly. So tag, then type @e[tag=x,type=y] would still test tag first then type, however @e[type=y, tag=x] would do type then tag. Is that true?
@Cl0udWolf
@Cl0udWolf 4 жыл бұрын
Agent M probably I was just typing it out for visual
@maelstrom-mecharena-livest8078
@maelstrom-mecharena-livest8078 4 жыл бұрын
Cloud Wolf So is filtering on tag first faster because it reduces the total possibilities first, or should the type selector be used first? I guess ideally you’ll want to use just a tag so you don’t have to use type.
@MrHatoi
@MrHatoi 4 жыл бұрын
@@maelstrom-mecharena-livest8078 No, everything you said is the exact other way around. You put the type first because the game stores entities based on type, so it immediately throws out the 90% of entities that don't match the type without checking them at all. If you put the tag first, or only the tag, then it has to go through every entity in the world and check if the tag matches.
@maelstrom-mecharena-livest8078
@maelstrom-mecharena-livest8078 4 жыл бұрын
MrHatoi Thank you, that makes sense.
@BisUm3
@BisUm3 4 жыл бұрын
How to Optimize Your Datapack? Learn Scarpet and use it!
@Cl0udWolf
@Cl0udWolf 4 жыл бұрын
Scarpet is useful but not maximally optimized. Like it isnt as free to adjust as doing it urself with actual datapacks and most people dont want to learn something new when they already know commands
@Beetless
@Beetless 4 жыл бұрын
What is scarpet
@Cl0udWolf
@Cl0udWolf 4 жыл бұрын
@@Beetless kinda like a coding language / program for mc stuff
@Beetless
@Beetless 4 жыл бұрын
Cloud Wolf but it needs a mod to use?
@Cl0udWolf
@Cl0udWolf 4 жыл бұрын
Beetless it is a mod in a way it’s a language that I think compiles to a datapack
@AgentM124
@AgentM124 4 жыл бұрын
Which sublime syntax highlighter are you using? I got one through the package manager called MCC or something, but it's outdated.
@Cl0udWolf
@Cl0udWolf 4 жыл бұрын
Agent M function syntax highlighter
@simonbigras8915
@simonbigras8915 4 жыл бұрын
Do redstone blocks affect the proformance in my world, because i have a couple redstone blocks that appear/disapear once a player is in a zone?
@Cl0udWolf
@Cl0udWolf 4 жыл бұрын
Simon Bigras not really
@Inspirator_AG112
@Inspirator_AG112 4 жыл бұрын
If I summon ~10000 *Area Effect Cloud entities,* it still lowers, the TPS _severely._
@Cl0udWolf
@Cl0udWolf 4 жыл бұрын
AG112 VIDEOS well sure 1000 lbs of feathers weighs the same as 1000lbs of rocks
@clancysleepovergetyourblankies
@clancysleepovergetyourblankies 3 жыл бұрын
Why would you summon 1000 AEC tho?
@Inspirator_AG112
@Inspirator_AG112 3 жыл бұрын
@@clancysleepovergetyourblankies: It was resulting from an infinite loop.
@kindred408
@kindred408 3 жыл бұрын
Really love your videos and your tips are very useful. But how can you summon area effect cloud that don't disappear like 8:14?
@Cl0udWolf
@Cl0udWolf 3 жыл бұрын
Mostly irrelevant given marker entities r better placeholders
@kindred408
@kindred408 3 жыл бұрын
@@Cl0udWolf wow Thanks for the reply. I was not expecting to be that fast. When I summon area effect cloud it disappear. Is there a way to stop it from disappearing?
@Cl0udWolf
@Cl0udWolf 3 жыл бұрын
@@kindred408 use mcstacker.net but don’t use an area effect cloud unless u need it for potion stuff otw use a marker
@kindred408
@kindred408 3 жыл бұрын
@@Cl0udWolf Ok Thanks!
@gravitowl
@gravitowl 4 жыл бұрын
/schedule doesnt really seem to work, its weird but it doesnt execute the commands...
@Cl0udWolf
@Cl0udWolf 4 жыл бұрын
gravitowl it does just it plays at the world spawn and @s won’t do anything. I have a tutorial on it
@gravitowl
@gravitowl 4 жыл бұрын
@@Cl0udWolf oh ok
@panr4in
@panr4in 3 жыл бұрын
So in essence, if I plan to have dozens of carrot on a stick items that will do abilities on right-clicks, just making a function with this long list of detections for all the various items and then adding a if entity @a[scores={active=1..}] (where "active" is the right-click detection) to my tick function, that will already help a lot yes? Since I'm only executing the long list of detections if a player right-clicked the carrot on a stick?
@Cl0udWolf
@Cl0udWolf 3 жыл бұрын
Yes and another bigger improvement Is making all info of what item it is on the same nbt tag which u use execute store to put on a score then do dozens of scoreboard checks instead of dozens of nbt checks so like {type:7} put 7 on the score if it’s 7 then do what it does
@panr4in
@panr4in 3 жыл бұрын
@@Cl0udWolf thx for the tips, also a side question, does it matter how many dummy scoreboard objectives are there in the world or should I not fear just making new ones for whatever I think is useful, even if it's for a small thing?
@Cl0udWolf
@Cl0udWolf 3 жыл бұрын
@@panr4in scoreboards do have an impact on performance and file size but it isn’t too big, just try not to store player specific scoreboard values too often especially if it’s for a server
@Taruyroiii
@Taruyroiii 4 жыл бұрын
Hi! Thanks for the tips! I have a question, is there an easier way to make custom blocks than armor stands? Thanks!
@Cl0udWolf
@Cl0udWolf 4 жыл бұрын
Roi John Belmonte nope
@RewindNoob
@RewindNoob 3 жыл бұрын
try item frames
@lolicanadian
@lolicanadian Жыл бұрын
There is _now_
@pp8818
@pp8818 4 жыл бұрын
How did you now always what i need?
@daizzer
@daizzer 2 жыл бұрын
i need to know what are your plugins for Sublime text, i need that syntax highlighter
@Cl0udWolf
@Cl0udWolf 2 жыл бұрын
Arcensoth’s Mc function
@isaacrobinson683
@isaacrobinson683 4 жыл бұрын
whats your outro? its fire
@Cl0udWolf
@Cl0udWolf 4 жыл бұрын
Isaac Robinson ? The song is werq by Kevin mcleod
@thesuperemeraldboat6194
@thesuperemeraldboat6194 2 жыл бұрын
Why not use markers instead of area of affect clouds
@kzkaa.
@kzkaa. 2 жыл бұрын
This video is made before markers are added
@bredcataw
@bredcataw Жыл бұрын
Also with selectors i use this lines in tick.mcfunction: execute as @a at @s run function test:as2a execute as @e[type=!player] at @s run function test:as2e In as2a you run commands as players In as2e you run commands as entities So you dont must to do in tick: As @a[tag=1] run function 1 As @a[tag=2] run function 2 As @a[tag=3] run function 3 Etc... You just use if entity @s[...] run ... in all this files) CloudWolf, is this good?
@Cl0udWolf
@Cl0udWolf Жыл бұрын
If you are using similar selectors multiple times it will be better to sub function it, but for a case like this the difference isn’t much. If you can filter before the sub function you will get better performance too. Like @e[type=marker] then @s[tag=1,2,3
@bredcataw
@bredcataw Жыл бұрын
@@Cl0udWolf @e[type=#tmp:in_use,tag=tmp-in_use] run function tmp:as2e I just want to ask, is it difference with: execute as @e[tag=1] at @s run say 1 execute as @e[tag=2] at @s run say 2 execute as @e[tag=3] at @s run say 3 ... Or: execute if entity @s[tag=1] run say 1 execute if entity @s[tag=2] run say 2 execute if entity @s[tag=3] run say 3 ... What better to use, or what better way to do this?
@Cl0udWolf
@Cl0udWolf Жыл бұрын
@@bredcataw ofc second one is better because u use less @e
@bredcataw
@bredcataw Жыл бұрын
@@Cl0udWolf Okey, got ya. Thanks for responding :)
@sofar2218
@sofar2218 4 жыл бұрын
i'm completely new to making datapacks, like i've never touched a function how do i transfer command blocks to a data pack, like i'm making a kit, for example, if a player sneaks for five seconds, they become invisible but as soon as they stopped sneaking, or they moved an inch, the invisibility goes away and you have to sneak again for five seconds to be invisible
@Cl0udWolf
@Cl0udWolf 4 жыл бұрын
owo u could just copy and paste repeating commands into the tick function but that wouldn’t be utilizing the advantages of datapacks and the things discussed in this vid
@sofar2218
@sofar2218 4 жыл бұрын
Cloud Wolf thanks♡
@wichtelchen
@wichtelchen 4 жыл бұрын
My opinion: That "programming language" of DataPacks is terrible and unnecessarily chews up lot of performance by its nature. You have to constantly hack the system to get more than a "another 10 useless crafting recipes"-pack out of it. - The execute command, which is some kind of a for loop expensively iterating through the entity array most of time, checking each entity against a given condition. - No proper if...else command (you have to abuse the execute command for that, probably two times if you need an else branch) - No { and no }. The only way to have blocks with multiple comands is cramming them into another mcfunction file (which leads to lots of them with more or less unnameable subroutines) - No feasible way to have function parameters, making Interacting between two different entities sometimes is a nightmare. - No proper variables. You have to run execute again and again or abuse the scoreboard or the nbt data for that. - The code becomes unreadable quickly. Using brainfuck is easier. I prefer the good old redstone way over this whereever possible. Mojang, please add at least these features, even the first computers had at least these: if/else, goto/gosub, variables and block statements ({} or python-like indentation)... and please: custom nbt for the crafting result and a way to add custom blocks without sacrificing existing blocks or abusing amor stands and mobspawners (which increases the entity array where the execute command frequently queries from).
@Cl0udWolf
@Cl0udWolf 4 жыл бұрын
dont have the time to go through everything but u can easily do if/else and it doesnt need to exist u sound like ur trying to do programming in minecraft commands which is the wrong state of mind. its like trying to do C programming in Verilog. Totally different systems not the same thing. As for variables fake players on scoreboards are int variables and strings are handled with storage and nbt. Its not perfect but its very powerful if u know what ur doing and not just observing from a perspective of C/Java programming
@wilebgingy669
@wilebgingy669 4 жыл бұрын
How to optimize loot tables for score based loot replacement
@Cl0udWolf
@Cl0udWolf 4 жыл бұрын
WileBGingy scoreboard checks with execute and loot are not that different with performance
@fuzzyL16
@fuzzyL16 3 жыл бұрын
Mhhhh.... welll let’s just restart....
@moonmoonis87
@moonmoonis87 4 жыл бұрын
How do I create a permanent invisible AEC?
@Cl0udWolf
@Cl0udWolf 4 жыл бұрын
/summon minecraft:area_effect_cloud ~ ~ ~ {Age:-2147483648,Duration:-1,WaitTime:-2147483648} this will last for like 27 years
@Beetless
@Beetless 4 жыл бұрын
Thanks
@sonicrushXII
@sonicrushXII 2 жыл бұрын
Well I've been using this thing for a while. And I wanted to ask if it was a good idea or not. I run a scoreboard on a fake player that goes from 1-20 Then I run any command(that i don't need to be instantly checked) if it matches 1. Then for my next command i check if it matches 2 Then for my next command I check if it matches 3 and so on... Until I reach 20 (I use way more than 20 commands so it cycles over a few times) This way, the work done per tick is not super intensive. Each task done is different per tick every 20 ticks pretty much what is done in this video kzbin.info/www/bejne/gKPTpJJplMmonLM
@FADEDElement
@FADEDElement 4 жыл бұрын
third
@derpderp4603
@derpderp4603 3 жыл бұрын
Spooky 666 likes
@si6585
@si6585 4 жыл бұрын
1st and 4th
@si6585
@si6585 4 жыл бұрын
Totally first.
/attribute Command Tutorial [Minecraft 1.16+]
4:57
Cloud Wolf
Рет қаралды 111 М.
Coding Adventure: Portals
16:06
Sebastian Lague
Рет қаралды 1,3 МЛН
Players vs Pitch 🤯
00:26
LE FOOT EN VIDÉO
Рет қаралды 127 МЛН
Ice Cream or Surprise Trip Around the World?
00:31
Hungry FAM
Рет қаралды 16 МЛН
Motorbike Smashes Into Porsche! 😱
00:15
Caters Clips
Рет қаралды 23 МЛН
Data Storage Tutorial in Minecraft [1.15+]
8:48
Cloud Wolf
Рет қаралды 35 М.
How to Optimize A Datapack!
5:17
TheMoneyRaider
Рет қаралды 1,2 М.
Cutscenes in Minecraft 1.18 | Datapack
13:13
JDawgtor
Рет қаралды 9 М.
Easy Pathfinding Datapack [Map-Maker's Toolbox]
10:54
Cloud Wolf
Рет қаралды 14 М.
How to Load Custom Structures in Minecraft [Datapack Tutorial]
25:20
Minecraft Right Click Detection [1.19] Several Ways
13:11
Legitimoose
Рет қаралды 137 М.
How to Make a Datapack [w/ Demo Download]
14:04
Cloud Wolf
Рет қаралды 74 М.
Players vs Pitch 🤯
00:26
LE FOOT EN VIDÉO
Рет қаралды 127 МЛН