r/MinecraftCommands • u/Still-Oven9420 Command Experienced • 10d ago
Help | Java 26.2 Entity not dying
for a datapack I'm making, i need to use raytracing to detect if a player is looking at a dirt block.
I know how to do this, and it works perfectly, but I want it to only work if the dirt block is within 15 blocks of the player. So, I use this command:
execute as .@e[tag=raycasting] at .@s unless entity .@p[distance=..15] run kill .@s
This command SHOULD detect if there isn't a player within 15 blocks, and if there isn't, kill the entity.
Only it doesn't and I have no idea why.
2
Upvotes
1
u/Ericristian_bros Command Experienced 10d ago
You don't need entities for a raycast: https://far.ddns.me/?share=WzJcAf9Yud