mojira.dev
MC-74087

Testforblock command with nbt tag doesnt work in an Execute command.

Running an testforblock in an execute command with nbt tags always causes error message.

[19:35:20] Failed to execute 'testforblock ~ ~1 ~ minecraft:dropper 1 {Items:[0:{Slot:1b,id:minecraft:prismarine_crystals,Count:1b,Damage:0s},{Slot:3b,id:minecraft:blaze_rod,Count:1b,Damage:0s},{Slot:4b,id:minecraft:leather_chestplate,Count:1b,Damage:0s},{Slot:5b,id:minecraft:blaze_rod,Count:1b,Damage:0s},{Slot:7b,id:minecraft:prismarine_crystals,Count:1b,Damage:0s}]}' as entity.ItemFrame.name

What I expected to happen was...:
Describe what you thought should happen here

I can run the testforblock just fine on it self it detects what i want but as soon as i put it in the execute command i get the above error.

Aslong as i run the testforblock without nbt tags it works fine.
I used it to test for a nearby chest it works just fine.

To reproduce try this.
first put this command into commandblock.

execute @e[Type=Zombie] ~ ~ ~ testforblock ~ ~1 ~ minecraft:dropper 1 {Items:[0:{Slot:1b,id:minecraft:prismarine_crystals,Count:1b,Damage:0s},{Slot:3b,id:minecraft:blaze_rod,Count:1b,Damage:0s},{Slot:4b,id:minecraft:leather_chestplate,Count:1b,Damage:0s},{Slot:5b,id:minecraft:blaze_rod,Count:1b,Damage:0s},{Slot:7b,id:minecraft:prismarine_crystals,Count:1b,Damage:0s}]}

In the above case i used to detect a zombie doesnt work.

Does not work with players also.
I hope it isnt just me or my comp why it doesnt work as it should.

then run it, error message should pop up.

Comments 6

Try testing for the dropper 2 blocks above the zombie instead. I'm not sure if all entities were changed, but at some point, the y position of the player became the feet position rather than the eye position.

This command works in 1.8-pre4:
execute @e[type=Zombie] ~ ~ ~ testforblock ~ ~2 ~ dropper 1 {Items:[0:{Slot:1b,id:"minecraft:prismarine_crystals",Count:1b,Damage:0s},{Slot:3b,id:"minecraft:blaze_rod",Count:1b,Damage:0s},{Slot:4b,id:"minecraft:leather_chestplate",Count:1b,Damage:0s},{Slot:5b,id:"minecraft:blaze_rod",Count:1b,Damage:0s},{Slot:7b,id:"minecraft:prismarine_crystals",Count:1b,Damage:0s}]}

If you were using execute @e[Type=Zombie] instead of execute @e[type=Zombie], it will search for any entity.

Is this still an issue in the current Minecraft Snapshot 15w46a or later? If so, please update the affected versions in order to best aid Mojang ensuring bugs are still valid in the latest releases/pre-releases.

This is an issue in 15w51b using this command:

execute @e[type=ArmorStand,name=GM4_CustomCrafter] ~ ~ ~ testforblock ~ ~ ~ minecraft:dropper -1 {Items:[0:{id:"minecraft:stone",Damage:6s,Count:1b,Tags:["Test"],tag:{ench:[],display:{Lore:[0:"It seems Magnetic"],Name:"Mag Stone"}},Slot:0b},1:{id:"minecraft:stone",Damage:6s,Count:1b,Tags:["Test"],tag:{ench:[],display:{Lore:[0:"It seems Magnetic"],Name:"Mag Stone"}},Slot:1b},2:{id:"minecraft:stone",Damage:6s,Count:1b,Tags:["Test"],tag:{ench:[],display:{Lore:[0:"It seems Magnetic"],Name:"Mag Stone"}},Slot:2b},3:{id:"minecraft:stone",Damage:6s,Count:1b,Tags:["Test"],tag:{ench:[],display:{Lore:[0:"It seems Magnetic"],Name:"Mag Stone"}},Slot:3b},4:{id:"minecraft:nether_star",Damage:0s,Count:1b,Slot:4b},5:{id:"minecraft:stone",Damage:6s,Count:1b,Tags:["Test"],tag:{ench:[],display:{Lore:[0:"It seems Magnetic"],Name:"Mag Stone"}},Slot:5b},6:{id:"minecraft:stone",Damage:6s,Count:1b,Tags:["Test"],tag:{ench:[],display:{Lore:[0:"It seems Magnetic"],Name:"Mag Stone"}},Slot:6b},7:{id:"minecraft:stone",Damage:6s,Count:1b,Tags:["Test"],tag:{ench:[],display:{Lore:[0:"It seems Magnetic"],Name:"Mag Stone"}},Slot:7b},8:{id:"minecraft:stone",Damage:6s,Count:1b,Tags:["Test"],tag:{ench:[],display:{Lore:[0:"It seems Magnetic"],Name:"Mag Stone"}},Slot:8b}]}

Contents of the Dropper - http://puu.sh/moPZI.png

Position of Armor Stand in Dropper - http://puu.sh/moQ4E.jpg

@@unknown Your NBT data is invalid. You've specified a Tags list at the root of the item format, in which no tag of that name exists at that depth. The Tags tag is an entity data tag, not part of the item format except when used as custom item data within the tag compound. Fixed command:

execute @e[type=ArmorStand,name=GM4_CustomCrafter] ~ ~ ~ testforblock ~ ~ ~ minecraft:dropper -1 {Items:[{id:"minecraft:stone",Damage:6s,Count:1b,tag:{ench:[],display:{Lore:["It seems Magnetic"],Name:"Mag Stone"}},Slot:0b},{id:"minecraft:stone",Damage:6s,Count:1b,tag:{ench:[],display:{Lore:["It seems Magnetic"],Name:"Mag Stone"}},Slot:1b},{id:"minecraft:stone",Damage:6s,Count:1b,tag:{ench:[],display:{Lore:["It seems Magnetic"],Name:"Mag Stone"}},Slot:2b},{id:"minecraft:stone",Damage:6s,Count:1b,tag:{ench:[],display:{Lore:["It seems Magnetic"],Name:"Mag Stone"}},Slot:3b},{id:"minecraft:nether_star",Damage:0s,Count:1b,Slot:4b},{id:"minecraft:stone",Damage:6s,Count:1b,tag:{ench:[],display:{Lore:["It seems Magnetic"],Name:"Mag Stone"}},Slot:5b},{id:"minecraft:stone",Damage:6s,Count:1b,tag:{ench:[],display:{Lore:["It seems Magnetic"],Name:"Mag Stone"}},Slot:6b},{id:"minecraft:stone",Damage:6s,Count:1b,tag:{ench:[],display:{Lore:["It seems Magnetic"],Name:"Mag Stone"}},Slot:7b},{id:"minecraft:stone",Damage:6s,Count:1b,tag:{ench:[],display:{Lore:["It seems Magnetic"],Name:"Mag Stone"}},Slot:8b}]}

The OP's command is correct apart from the selector (@e[Type=Zombie]), so their dropper simply does not match the desired data.

I copied in the wrong command, the Tags was something I was testing and forgot to revert it. The command given still doesn't work, as it's the same as what I meant to post.

This is the output of a blockdata command on the dropper:

[12:55:20] The data tag did not change: {CustomName:"Mastercraftsman's Bench",x:-58,y:2,z:9972,Items:[0:{Slot:0b,id:"minecraft:stone",Count:1b,tag:{ench:[],display:{Lore:[0:"It seems Magnetic"],Name:"Mag Stone"}},Damage:6s},1:{Slot:1b,id:"minecraft:stone",Count:1b,tag:{ench:[],display:{Lore:[0:"It seems Magnetic"],Name:"Mag Stone"}},Damage:6s},2:{Slot:2b,id:"minecraft:stone",Count:1b,tag:{ench:[],display:{Lore:[0:"It seems Magnetic"],Name:"Mag Stone"}},Damage:6s},3:{Slot:3b,id:"minecraft:stone",Count:1b,tag:{ench:[],display:{Lore:[0:"It seems Magnetic"],Name:"Mag Stone"}},Damage:6s},4:{Slot:4b,id:"minecraft:nether_star",Count:1b,Damage:0s},5:{Slot:5b,id:"minecraft:stone",Count:1b,tag:{ench:[],display:{Lore:[0:"It seems Magnetic"],Name:"Mag Stone"}},Damage:6s},6:{Slot:6b,id:"minecraft:stone",Count:1b,tag:{ench:[],display:{Lore:[0:"It seems Magnetic"],Name:"Mag Stone"}},Damage:6s},7:{Slot:7b,id:"minecraft:stone",Count:1b,tag:{ench:[],display:{Lore:[0:"It seems Magnetic"],Name:"Mag Stone"}},Damage:6s},8:{Slot:8b,id:"minecraft:stone",Count:1b,tag:{ench:[],display:{Lore:[0:"It seems Magnetic"],Name:"Mag Stone"}},Damage:6s}],id:"Dropper",Lock:""}

@@unknown The data from the dropper exactly matches the command I've provided, which did try and does work perfectly fine. Ensure the armor stand is positioned correctly, is being targeted correctly, and that the commands are running to begin with. Your issue is not with the NBT data matching.

Zassi12

(Unassigned)

Unconfirmed

Minecraft 1.8

Retrieved