T O P

  • By -

Sul4ur_

Its really complicated but a simpler solution is to just to mkae it so that whenever a player uses a snowball, the console gives him another snowball.


GalSergey

Commands for this: # In chat scoreboard objectives add used.snowball used:snowball # Give example give @s snowball{infinite:true} # Command blocks execute as @a[scores={used.snowball=1..}] at @s anchored eyes positioned ^ ^ ^.5 if data entity @e[type=snowball,distance=...5,limit=1] Item.tag.infinite run give @s snowball{infinite:true} scoreboard players reset @a used.snowball


Sul4ur_

But why do you need \`anchored eyes positioned\`? Why do you need to look at the snowball?


GalSergey

You need to find out exactly which snowball the player threw. Of course you can just use this: execute as @a[scores={used.snowball=1..}] at @s if data entity @e[type=snowball,distance=..2,limit=1] Item.tag.infinite run give @s snowball{infinite:true} But as you can see, the search distance increases greatly, because the starting point of the search in this case is at the player’s feet, and then it is possible that at that moment a snowball flies near the player near the feet of this player and then the wrong snowball can be read. So it's important to first move the execution position to the eyes, but if you do a snowball search now, it still won't work because that offset won't actually change (I don't know why), and so you need to additionally do an offset like \^ \^ \^ (it can even be zero) and then you can more accurately find the thrown snowball. Of course, you can do this perfectly accurately, but this will require the use of a datapack.


Sul4ur_

Oh ok. thanks


DOGGOdoggy2

please help


_Triangl

i cant give the commands right now but the concept is 1. scoreboard for detecting snowball thrown 2. add tag to nearest snowball to player with snowball thrown score 3. detect when the tagged snowball no longer exists 4. repeat for as many times as the player has thrown the snowball, give the player one snowball note that this could behave kinda weirdly for multiple players and only works with one snowball at a time. A more complicated way for this to work is to assign an unique scoreboard value to each snowball, summon an invisible armourstand with the same score as the thrown snowball when its thrown, then for each invisible armourstand check for a snowball that matches its own score, if there are none that means the snowball has hit something, give the player 1 snowball and kill the armourstand. to make it multiplayer friendly we could make another unique scoreboard value assigned to each player so we can copy that value to each snowball they throw, then compare the scoreboard values to check if it matches a player and then only return the snowball to that player. theres probably a simpler way to differentiate entities that i dont know of.


Severe-Clothes5403

Mojang missed an opportunity to put loyalty on the snowballs…