Heya! Looking for some help with a command for Minecraft 1.14
I've set up a clock that searches for dropped items in a specific location. If the item is paper, it will set a block elsewhere and begin a command chain.
However, I've found that it actually detects any items within a 4-5 block radius. Thrown, dropped from a chest, summoned in, doesn't matter., it still gets picked up from a ways away.
The command is as follows:
/execute if entity @e[type=item,x=316,y=209,z=-3,sort=nearest,nbt={Item:{id:"minecraft:paper",Count:1b}}] run setblock ~ ~-2 ~ minecraft:redstone_block keep
I tried adding in a distance tag:
/execute if entity @e[type=item,x=316,y=209,z=-3,sort=nearest,distance=0..2,nbt={Item:{id:"minecraft:paper",Count:1b}}] run setblock ~ ~-2 ~ minecraft:redstone_block keep
However, this results in the item not being registered at all.
As to why I'm not just using a hopper/pressure plate to detect an item, it's because I'm making a system that scans for key phrases on the paper. Ideally I can make a system that checks for hundreds of different names, and produces a result when a specific word is found.
Any insight would be a huge help. I'm hoping this is just me overlooking the way the code operates, and not an actual bug.
The x,y,z arguments require distance to work properly. I have tested your second command and it works as intended. Maybe you dropped more than one paper, entered wrong coordinates or the block can't be placed because there is a block already there. Also, the sort argument is no use without limit=1 because the command will detect all items in the specified area and not just the nearest one.
Oh wow. Goes to show why I should not try to code at night. Tried today and you are right, the code works fine with the distance argument in it. Must have just been me not exiting the command block right to save the command.
Good to know I always need the distance tag, thank you for your help!
Rollback Post to RevisionRollBack
Silent Narrator
Current Projects:
Above The Clouds | Floating Island Cooperative Survival | Abovetheclouds.beastmc.com [Server Host Pending]
Heya! Looking for some help with a command for Minecraft 1.14
I've set up a clock that searches for dropped items in a specific location. If the item is paper, it will set a block elsewhere and begin a command chain.
However, I've found that it actually detects any items within a 4-5 block radius. Thrown, dropped from a chest, summoned in, doesn't matter., it still gets picked up from a ways away.
The command is as follows:
I tried adding in a distance tag:
However, this results in the item not being registered at all.
As to why I'm not just using a hopper/pressure plate to detect an item, it's because I'm making a system that scans for key phrases on the paper. Ideally I can make a system that checks for hundreds of different names, and produces a result when a specific word is found.
Any insight would be a huge help. I'm hoping this is just me overlooking the way the code operates, and not an actual bug.
Thank you!
Silent Narrator
Current Projects:
Above The Clouds | Floating Island Cooperative Survival |
Abovetheclouds.beastmc.com[Server Host Pending]The x,y,z arguments require distance to work properly. I have tested your second command and it works as intended. Maybe you dropped more than one paper, entered wrong coordinates or the block can't be placed because there is a block already there. Also, the sort argument is no use without limit=1 because the command will detect all items in the specified area and not just the nearest one.
Command block engineer // Developer // #TeamTrees
Oh wow. Goes to show why I should not try to code at night. Tried today and you are right, the code works fine with the distance argument in it. Must have just been me not exiting the command block right to save the command.
Good to know I always need the distance tag, thank you for your help!
Silent Narrator
Current Projects:
Above The Clouds | Floating Island Cooperative Survival |
Abovetheclouds.beastmc.com[Server Host Pending]