I'm trying to use the following command to make a dropped tnt item named Grenade explode. I'm using 1.12.2.
/execute @e[type=item] /testfor @e[type=Item] ~ ~ ~ {Item:{id:"minecraft:tnt",tag:{display:{Name:Grenade}}}} /summon creeper ~ ~ ~ {Fuse:0}
For some reason it won't summon the creeper and it outputs:
[16:40:26] Failed to execute '{Item:{id:"minecraft:tnt",Count:1b,tag:{display:{Name:"Grenade"}}}} /summon creeper ~ ~ ~ {Fuse:0}' as item.tile.tnt
SOLVED
/execute @e[type=item] /testfor @e[type=Item] ~ ~ ~ {Item:{id:"minecraft:tnt",tag:{display:{Name:Grenade}}}} /summon creeper ~ ~ ~ {Fuse:0}
For some reason it won't summon the creeper and it outputs:
[16:40:26] Failed to execute '{Item:{id:"minecraft:tnt",Count:1b,tag:{display:{Name:"Grenade"}}}} /summon creeper ~ ~ ~ {Fuse:0}' as item.tile.tnt
SOLVED
3
The way to do that is to scoreboard tag all tnt items named grenade with explode in a repeating command block:
scoreboard players tag @e[type=item] add explode {Item:{id:"minecraft:tnt",Count:1b,tag:{display:{Name:"grenade"}}}}
and then make them blow up in a chain command block:
execute @e[tag=explode] ~ ~ ~ summon tnt
HOWEVER: I think you want them to be able to land on the ground first before they explode, so they don't explode in the player's face immediately? Or, have a timer? To have a timer, do these:
To do that, first type this command:
/scoreboard objectives add explode dummy explode
Then, place a repeating command block and type in this command:
scoreboard players tag @e[type=item] add explode {Item:{id:"minecraft:tnt",Count:1b,tag:{display:{Name:"grenade"}}}}
Then put a chain command block after it and type this command into it:
scoreboard players add @e[tag=explode] explode 1
Then put another chain command block after the previous one and type this command into it:
execute @e[score_explode_min=60] ~ ~ ~ summon tnt ~ ~ ~
Or, if you want to have them explode when they hit the ground, tell me and i'll try. but its much harder to do that.
scoreboard players tag @e[type=item] add explode {Item:{id:"minecraft:tnt",Count:1b,tag:{display:{Name:"grenade"}}}}
and then make them blow up in a chain command block:
execute @e[tag=explode] ~ ~ ~ summon tnt
HOWEVER: I think you want them to be able to land on the ground first before they explode, so they don't explode in the player's face immediately? Or, have a timer? To have a timer, do these:
To do that, first type this command:
/scoreboard objectives add explode dummy explode
Then, place a repeating command block and type in this command:
scoreboard players tag @e[type=item] add explode {Item:{id:"minecraft:tnt",Count:1b,tag:{display:{Name:"grenade"}}}}
Then put a chain command block after it and type this command into it:
scoreboard players add @e[tag=explode] explode 1
Then put another chain command block after the previous one and type this command into it:
execute @e[score_explode_min=60] ~ ~ ~ summon tnt ~ ~ ~
Or, if you want to have them explode when they hit the ground, tell me and i'll try. but its much harder to do that.
There are multiple things wrong with that command, here's what they are and how to fix:
-after the execute @e[type=item] is an ~ ~ ~
-unfortunately, you can't do a testfor and then a command...
-I'm pretty sure you don't need the tag:{} part
-after the execute @e[type=item] is an ~ ~ ~
-unfortunately, you can't do a testfor and then a command...
-I'm pretty sure you don't need the tag:{} part
The tag is probably wrong. I'll look into it and see if I can fix it :)
