3

I am trying to make an "impact grenade" command in Minecraft 1.13. I am trying to get it to work so that when an egg hits blocks or entities, a creeper will be summoned. I originally used the following command set up in 1.12 and tried to update it to current, 1.13:

Always active, repeat: /execute at @e[type=egg] run kill @e[tag=tracker,distance=2]

Chain unconditional: /execute at @e[tag=tracker] run summon creeper ~ ~ ~ {Silent:1b,Invulnerable:1b,CustomNameVisible:0b,Fuse:1,ignited:1b}

Chain unconditional: /kill @e[tag=tracker]

Chain unconditional: /execute at @e[type=egg] run summon area_effect_cloud ~ ~ ~ {Particle:"ambient_entity_effect",Duration:2,Tags:["tracker"]}

Instead, all that happens is the creepers are summoned constantly at the egg. Any help on this subject would be great!

1 Answer 1

1

You're in luck, because I have a function that does exactly this. I'll explain what it does then give you the commands. I'm not sure eggs are a good idea, though, because there is a chance a baby chicken could spawn.

First, a scoreboard objective is created that tracks players who have thrown eggs. Players who have thrown an egg and have held an egg (determined by tag commands at the end of the function) summons an armor stand at the closest egg without a certain tag, then tags the egg so it doesn't happen again. The armor stand is constantly teleported to the closest egg, but when it does not detect a nearby egg then it is tagged. You can then execute all armor stands who have that tag to summon creepers or whatever you want to happen, then kill the armor stand.

This is the function. I converted it into 1.13 because it was originally in 1.12, and I changed it from snowballs to eggs (named "Grenade"). Because of lack of time I haven't tested it, but I see no reason why it shouldn't work. If it doesn't work, just let me know.

scoreboard objectives add grenade minecraft.used:minecraft.egg
execute as @a[scores={grenade=1..},tag=grenade] at @e[sort=nearest,limit=1,type=egg,tag=!grenade] run summon armor_stand ~ ~ ~ {Small:1b,NoGravity:1b,CustomName:"\"grenade\"",Marker:1b,Invisible:1b}
execute as @e[type=egg,tag=grenade] at @s run tp @e[type=armor_stand,name=grenade,limit=1,sort=nearest,distance=..2] @s
tag @e[type=armor_stand,name=grenade] add boom
execute as @e[type=egg,tag=grenade] at @s run tag @e[type=armor_stand,name=grenade,limit=1,sort=nearest] remove boom
execute as @e[type=armor_stand,tag=boom] at @s run summon creeper ~ ~ ~ {Fuse:0.0b,CustomName:"\"a grenade\""}
kill @e[type=armor_stand,tag=boom]
scoreboard players reset @a grenade
tag @a remove grenade
tag @a[nbt={SelectedItem:{id:"minecraft:egg",tag:{display:{Name:"\"Grenade\""}}}}] add grenade
4
  • I typed the first command (scoreboard objectives add grenade minecraft.used:minecraft.egg) in chat, then I put the second command, (execute as @a[scores={grenade=1..},tag=grenade] at @e[sort=nearest,limit=1,type=egg,tag=!grenade] run summon armor_stand ~ ~ ~ {Small:1b,NoGravity:1b,CustomName:"\"grenade\"",Marker:1b,Invisible:1b}) in a repeating, always active command block. The remaining commands I put in chain, always active, unconditional command blocks connecting to the repeating one. For some reason, nothing happened when I threw an egg.
    – user212269
    Feb 11, 2019 at 0:31
  • @user212269 Is the egg named "Grenade"? To make the grenades work with any eggs, replace the last command with: tag @a[nbt={SelectedItem:{id:"minecraft:egg"}}] add grenade Feb 11, 2019 at 1:05
  • Ok, well I fixed that issue. However, a single creeper spawns as soon as the egg is thrown.
    – user212269
    Feb 17, 2019 at 23:13
  • Could we replace the creeper with a TNT?
    – WarpPrime
    Sep 4, 2020 at 16:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .