1

Need Help on Dectecting Mined Items and Executing a Command

ThorTheHunter's Avatar ThorTheHunter1/3/15 8:58 pm
1 emeralds 445 2
1/4/2015 12:09 pm
hokage3211's Avatar hokage3211
So what I am attempting to accomplish is every time a person mines a certain block, say stone, the cobble that drops is destroyed and the block is replaced. So I've set up a Scoreboard for the stat mined stone and have a clock running the /testfor command testing for mined stone blocks. A comparator leads to another command block, and this is where I am having the problem. I am attempting to use the /execute command to detect any dropped item within a couple of blocks to the player. If it detects any then that entity will get destroyed and a stone block will get placed where the entity was at. Unfortunately I cannot get the command to work, so any help would be great.

Also can you detect a specific entity name? I am not sure if you can add a tag to @e Item to specify cobblestone.
Posted by ThorTheHunter's Avatar
ThorTheHunter
Level 1 : New Miner
0

Create an account or sign in to comment.

2

1
01/04/2015 12:09 pm
Level 49 : Master Engineer
hokage3211
hokage3211's Avatar
You may also want to increase the range of the second /execute by one block, because it's sortof a moving target, but it may work fine with the same range, it's your preference
1
01/04/2015 11:58 am
Level 49 : Master Engineer
hokage3211
hokage3211's Avatar
if the entity has no spaces in their names, you can do @e[name=<insert name>] ; if the entity has a name with a space, you need to creat a scoreboard dummy thing to monitor it, and use this to apply that to any mob with that name:
scoreboard players set @e <insert dummy scoreboard name> 1 {CustomName:"<insert custom name>"},
then you can use tesfor @e[score_(<bjective name>_min=1] or anywhere one uses @e can input the score minimum requirement.

for the execute, you can try doing this,
/execute @a ~ ~ ~ /execute @e[type=Item,r=<range from player>] ~ ~ ~ setblock ~ ~ ~ minecraft:stone 0
(may need to modify setblock at the end for how the syntax works, but I think it goes that way)
then, directly attach to this command block so it runs second, as in placing it in top of the command block for the previous one when the previous one is attached to a repeater:
/execute @a ~ ~ ~ /execute @e[type=Item,r=<range from player>] ~ ~ ~ kill @e[type=Item,r=0]

I hope this helps!
Planet Minecraft

Website

© 2010 - 2024
www.planetminecraft.com

Welcome