I have an adventure map with restocking chests. The cycle I have them on are activated by a daylight sensor which is connected to a series of command blocks. The following will be my command example:
Redstone trail leads to first command block with the command:
/blockdata -54 135 191 {Items:[]}
Restone trail continues to next command block after a redstone repeater delay. The next command is:
/setblock -54 135 191 minecraft:air 0 destroy
Restone circuit finishes at a final command block after yet another redstone repeater delay. The final command is:
/setblock -54 135 191 chest 0 replace {LootTable:"mctools:chests/overworld lvl 1"}
(this is a custom loot table I created)
Also, here is a visual of my circuit. The current flows from right to left:
So, what happens is the chest that was previously placed has its items destroyed, then the chest itself is destroyed, and finally a new chest with new loot is placed. This is what I want. The problem here is that this only works when my character is relatively close to the chest targeted when the commands are activated. If I back away, and then come back, the loot that was in the chest before the new chest was placed is all over the ground! I want the items to be destroyed not on the ground. It appears /blockdata ~ ~ ~ {Items:[]}
doesn't work if the player is a distance away from the targeted chest. Like the items won't delete at a distance. Please explain this problem and how to fix it.