-1

I've made a datapack for an 'enderwand' which allows you to teleport using raycasting. Everything works fine except I've put exceptions so the ray goes through water, lava, and the end gateway, however when I attempt to go through an end gateway my game freezes and I have to close it. Does anyone know why this is? Here's my recursive raycasting function:

execute if block ~ ~ ~ minecraft:air positioned ^ ^ ^1 run function enderwand:raycast
execute if block ~ ~ ~ minecraft:water positioned ^ ^ ^1 run function enderwand:raycast
execute if block ~ ~ ~ minecraft:lava positioned ^ ^ ^1 run function enderwand:raycast
execute if block ~ ~ ~ minecraft:end_gateway positioned ^ ^ ^ run function enderwand:raycast
execute unless block ~ ~ ~ minecraft:end_gateway unless block ~ ~ ~ minecraft:lava unless block ~ ~ ~ minecraft:water unless block ~ ~ ~ minecraft:air positioned ^ ^ ^ as @s run function enderwand:enderwandtp

And here's the teleportation function enderwand:enderwandtp :

tp @s ~ ~1 ~
scoreboard players set @s ewReload 80

where ewReload is a scoreboard keeping track of someone's reload. The water and lava exceptions work fine.

  • the only thing i can imagine is that the game attempts to port you normally, but can't do so because of your command. – EarthToAccess Apr 20 at 5:17
  • @EarthToAccess The thing is it isn't only when the teleport is successful...if the ray goes into unloaded chunks it does nothing and no teleport occurs. If I shoot through the gateway with or without a background for the beam to hit it has issues either way, which makes me think it's something having to do with the actual ray rather than the teleport. – Nik3141 Apr 20 at 6:37
  • can we possibly see the function enderwand:raycast and enderwand:enderwandtp? i can't see if it's a raycast issue, a teleport issue, or a hitbox issue without seeing everything. – EarthToAccess Apr 20 at 8:35
  • First thing I notice: positioned ^ ^ ^ as @s does nothing. – Fabian Röling Apr 20 at 13:44
  • Otherwise the function works fine for me, it executes a command (in my case summoning an armour stand) at the first position that is not air, water, lava or end gateway. – Fabian Röling Apr 20 at 13:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.