I am currently trying to make a repeating command block continuously check if the player is holding a specific item (in this case, a fishing rod named "Snowball Bazooka"), and if the player is holding said fishing rod, then it will summon a snowball or some other projectile above all the mobs except for the player in a radius of about 10 blocks.

It seemed a bit more feasible before the /execute command was changed, but now, trying to get it to somehow work in 1.14, I don't exactly see a clear way to do this (I haven't used command blocks too much, so maybe I don't know too much about them yet to understand how to make this work.)

This is what my attempt was at coming up with a solution:

/execute if entity @a[nbt={Inventory:[{id:"minecraft:fishing_rod",Slot:-106b,tag:{display:{Name:"\"Snowball Bazooka\""}}}]}] run execute at @e[type=!player,distance=10] run summon snowball ~ ~10 ~
  • 2
    Try replacing if with at. That should already do the trick, if there isn't another mistake that I've not spotted. Edit: Also, you probably want to use SelectedItem:{…} instead of Inventory:[{…}], otherwise you just check if you have that item anywhere. Also, nothing got made impossible in 1.13 commands, only more things became possible or easier. Mar 31 '20 at 22:53
  • I'll give that a go. Also, it's good to know that 1.13 didn't make anything impossible, I thought some commands were removed or just merged with other commands. Apr 19 '20 at 16:40
  • Some commands were removed. /toggledownfall was removed, because /weather already did what people used it for anyway (clearing rain), /stats was removed, because you can now do the same and more much easier with /execute store, /testfor was removed, because it basically did nothing anyway (instead you now say "do X if condition matches" in one command, which was already recommended since 1.9), /testforblock and /testforblocks were removed for the same reason and /blockdata and /entitydata were removed in favour of /data. Apr 19 '20 at 20:04

it is pretty simple to make it but i have no idea how to make so you need to hold an item with an specific name… this command works so you need to hold any fishing_rod with any type of name to summon arrows over near entitys

put this command in a reapet command block and have it on always active or power it manually when you want to activate the thing

execute as @p[nbt={SelectedItem:{id:"minecraft:fishing_rod",Count:1b}}] run execute at @p run execute at @e[distance=0..10,type=!minecraft:player,type=!minecraft:arrow,type=!minecraft:item] run summon minecraft:arrow ~ ~3 ~

then put this command in a second command block on chain, always active and conditional

kill @e[type=minecraft:arrow,nbt={inGround:1b}]

now when you holding in a fishing_rod it will summon arrows over all near mobs! enjoy

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.