#Raycast System not detecting any entity (part 3)

1 messages · Page 1 of 1 (latest)

whole sky
#

as the title suggests , i asked this question multiple times but got no answer , so its my final thread since i cant figure out what is the problem , ill share the code right away

whole sky
#
  "criteria": {
    "loaded_resonant_crossbow": {
      "trigger": "minecraft:shot_crossbow",
      "conditions": {
        "item": {
          "items": ["minecraft:crossbow"],
          "components": {
            "minecraft:custom_data": {
              "resonance": true
            }
          }
        },
        "player": {
          "equipment": {
            "offhand": {
              "items": ["minecraft:echo_shard"]
            }
          }
        }
      }
    }
  },
  "rewards": {
    "function": "clockwork:echo/echo"
  }
}``` **this code is for triggering the raycast**
#
kill @e[type=arrow,distance=..2]
scoreboard players set @s ray_dist 0
execute anchored eyes positioned ^ ^ ^ run function clockwork:echo/echo2
clear @s minecraft:echo_shard 1```    **this code is for initialising the raycast**
#

execute positioned ^ ^ ^ if entity @e[type=!player,distance=..0.7,limit=1] run function clockwork:echo/echo3

execute unless block ~ ~ ~ air run return 0

scoreboard players add @s ray_dist 1

particle minecraft:sonic_boom ^ ^ ^ 0 0 0 0 1 force

execute positioned ^ ^ ^0.5 run function clockwork:echo/echo2```      **this part actually does the raycast**
#
return 0```      **this is what happens when it detects an entity**
#

so here i shared all relevant parts of this raycast system and now idk why its not detecting any entity

fading coyote
#

In what way does it not work?
You probably want to try debugging your datapacks

astral vortexBOT
wispy niche
#

you're only running the function as the player if the entity exists

whole sky
#

so what will be the fixed version of it

whole sky
whole sky
#

plz dont ghost this thread like the other ones , i genuinly require a fix at this point , what Silabear said does look like an appropriate answer but i just cannot understand it

whole sky
#

last time i was but the thread closed

#

last 2 times

kindred wadi
#

On line 2 of the function Silabear pointed out, just change if entity to as

whole sky
#

ok

#

and will that fix the issue?

kindred wadi