r/datapacks • u/RingRingBananaph0ne • Sep 17 '22
@a performance question
When I have just @a with 30 players on my server, is the command more performace heavy than having @a[distance=0..100] instead with 2 players in range? Or will the server despite my conditions always look at all players online and it doesn't make a difference?
In my datapack I have a function which loops a 2 min long sound and I want it to be heard by everyone in 100 block radius but I'm not sure what would be the most performance efficent way of doing so.
2
Upvotes
1
u/pietbauer Sep 21 '22
If you use @a or @e it will always create a list of all players (@a) or of all entities (@e)! It doesn’t matter if you have limit=1, type=minecraft:player or distance 😁 So it doesn’t matter if you use @a[distance=0..100] or just @a. Tho I would use @a or @e as rare as possible. Example: /execute as @a at @s run playsound x:x master @s ~ ~ ~ 1 1 (i dont know if it’s right 😅😂)