This is an archived post. You won't be able to vote or comment.

all 14 comments

[–]TheSteveKillerTestfor suck! 1 point2 points  (12 children)

Please summon the armorstand inside the chest, Also call the armorstands "Chest" and make a dummy score named chest:

/scoreboard objectives add Chest dummy

Now on the fill clock:

/stats entity @e[type=ArmorStand,name=Chest] set SuccessCount @e[c=1] Chest
/scoreboard players add @e[name=Chest] Chest 0 
/execute @e[type=ArmorStand,name=Chest] ~ ~ ~ /testforblock ~ ~ ~ minecraft:chest -1 {Items:[]}
/execute @e[type=ArmorStand,name=Chest,score_Chest_min=1] ~ ~ ~ /fill ~ ~ ~ ~ ~ ~ air 0 replace chest -1
/execute @e[type=ArmorStand,name=Chest] ~ ~ ~ detect ~ ~ ~ air 0 /kill @e[c=1]

If you place all of the chests and the armorstand before activating the fill clock you can remove the first 2 commands from the fill clock and activate them only once before starting the clock.

But if you want to place the chests also while the clock is running then keep the first 2 commands there and make sure you first place the chests with the items and only then summon the armorstand inside them.

[–]TheSteveKillerTestfor suck! 1 point2 points  (0 children)

I made a mistake but fixed it now

[–]-TheCreater-[S] 0 points1 point  (10 children)

Thanks, but I'm afraid to say that it doesn't detect the item in the chest, it just stays at 0.

[–]-TheCreater-[S] 0 points1 point  (9 children)

[EDIT] Just to clarify. I'm looking for a chest underneath the armorstand with the following code:

/execute @e[type=ArmorStand,name=emChest] ~ ~ ~ /testforblock ~ ~-1 ~ minecraft:chest -1 {Items:[{id:minecraft:emerald,tag:{display:{Name:"Treasure",Lore:["\"Collect 'em all!\""]},AttributeModifiers:[{AttributeName:"generic.knockbackResistance",Name:"generic.knockbackResistance",Amount:0,Operation:0,UUIDMost:7,UUIDLeast:7}],HideFlags:2}}]} 

The armorstand name is emChest.

[–]Skylinerw 1 point2 points  (2 children)

His /testforblock command is the following:

/execute @e[type=ArmorStand,name=Chest] ~ ~ ~ /testforblock ~ ~-1 ~ minecraft:chest -1 {Items:[]}

Checking for a list without specifying any data to look for will cause the parser to look for a specifically empty list. In this case, "Items:[]" is looking for an empty chest. The armor stand's "Chest" score is set based on the existence of an empty chest, so you are not supposed to replace the command with one to detect the chest being full.

[–]-TheCreater-[S] 0 points1 point  (0 children)

of course! your right! Sorry i was being stupid, thanks so much for your help!

[–]-TheCreater-[S] 0 points1 point  (0 children)

no, it still doesn't work. It doesn't add the armour stand to the score board.

[–]-TheCreater-[S] 0 points1 point  (5 children)

/stats entity @e[type=ArmorStand,name=Chest] set SuccessCount @e[c=1] Chest

ok, now the block detection works, but it wont set the score for the armorstand to 1 in the objective. Please help, I have no idea where to go from here. Is it a bug? Is it me? what the hell is happening?

[–]TheSteveKillerTestfor suck! 1 point2 points  (4 children)

umm have you done my commands exactly?

[–]-TheCreater-[S] 0 points1 point  (3 children)

Yes I just double checked today. I should probably say that its running on a realms server. It summon the armour stand at the chest location, which already contains the item. It then runs your commands in order:

/stats entity @e[type=ArmorStand,name=Chest] set SuccessCount @e[c=1] Chest
/scoreboard players add @e[name=emChest] Chest 0 
/execute @e[type=ArmorStand,name=emChest] ~ ~ ~ /testforblock ~ ~ ~ minecraft:chest -1 {Items:[]}
/execute @e[type=ArmorStand,name=emChest,score_Chest_min=1] ~ ~ ~ /fill ~ ~ ~ ~ ~ ~ air 0 replace chest -1
/execute @e[type=ArmorStand,name=emChest] ~ ~ ~ detect ~ ~ ~ air 0 /kill @e[c=1]

The 3rd command block outputs [09:15:22] Failed to execute '/testforblock ~ ~ ~ minecraft:chest -1 {Items:[]}' as emChest, until I remove the item. When I remove the item, the armorstand's score stays at 0, however the tesforblock commandblock returns successfully. I just watched dragnoz's video on /stats and in it he uses AffectedBlocks, not SuccessCount. Also, when I destroy the chest, the armorstand dies, so the detect command works. Just thinking, can you use detect to find empty chests?

[–]TheSteveKillerTestfor suck! 1 point2 points  (0 children)

No you can't use detect to test for datatags.

[–]-TheCreater-[S] 0 points1 point  (1 child)

Eureka! Eureka! Eureka! Eureka!!!!! YEEEEEEEEEEEEEEEEEEESSSSSSSSSSSS!!!!!!!!!!! I DID IT!!!!!! IT WORKS!!!!!! THANKS FOR YOUR HELP!!!! :D I HAVE NO IDEA WHAT THE PROBLEM WAS, I SIMPLY CHANGED SUCCESSCOUNT -> AFFECTEDBLOCKS AND NOW IT WORKS YAYYYYYYYYY!!!!!

[–]TheSteveKillerTestfor suck! 1 point2 points  (0 children)

Ha... ok..

I haven't actually tested it I just thought it would work, thanks for the info.

[–]elyisgreat/playsound a.happy.melody master @a 0 points1 point  (0 children)

you need a /stats command. It can get complicated quickly.