Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SheepCommander/54e8bf5c5fc44743efaf3b3fa8296c6a to your computer and use it in GitHub Desktop.
Save SheepCommander/54e8bf5c5fc44743efaf3b3fa8296c6a to your computer and use it in GitHub Desktop.
NEW RAYCASTING 1.6.4 BEDROCK EDITION EFFIECIENT MOIST VEY ACURTE

Raycasting 1.6.4 [Bedrock Edition] [Most efficient] [Very accurate] Looping:

# Summons raycast entity when an entity holds the correct item, dirt named 'raycast pp 69 420'
execute if entity @e run execute as @e run execute at @e run execute if entity @s[distance=..1] run execute if entity @s[nbt={SelectedItem:{id:"minecraft:dirt",count:42b,tag:{display:{Name:'{"text":"raycast pp 69 420"}'}}} run summon armor_stand ~ ~ ~ {CustomName:'{"text":"Raycast"}',Invisible:1b,NoGravity:1b}

Raycast:

# Detects if there's a block here and kills itself if there's not
execute if entity @e run execute as @e run execute at @e run execute if entity @s[distance=..1] run execute if entity @s[type=armor_stand] run execute if entity @s[name=Raycast] run execute if block ~ ~ ~ minecraft:air run kill @s
# Detects if itself exists and if it doesn't exist summon a new armor_satnd
execute if entity @e run execute unless entity @s run execute positioned ^ ^ ^0.1 run summon armor_stand ~ ~ ~ {CustomName:'{"text":"Raycast"}',Invisible:1b,NoGravity:1b}
# Detects if itself exists and if it does it does something
execute if entity @e run execute if entity @s run function namespace:hit

Hit:

# Put what you want it to do when raycast hits something in here

# Cleans up
execute if entity @e run execute at @e run execute as @e run execute if entity @s[type=armor_stand] run execute if entity @s[name=Raycast] run kill @s

📝Special Note: ||Incase you're fricking retarded slow, this will work but it is really bad please do not. Also this is intentionally incorrectly labled. This is Java commands for 1.13+|| 🔗Link: https://gist.github.com/SheepCommander/54e8bf5c5fc44743efaf3b3fa8296c6a

@SheepCommander
Copy link
Author

SheepCommander commented Dec 18, 2020

BTW this paste is best viewed on discord. (Go to Raw then copy and paste into discord for better viewing.

@QmelZ
Copy link

QmelZ commented Dec 18, 2020

did you test this on 1.6.3 i didnt updated in 1.6.4 now

@SheepCommander
Copy link
Author

Not sure

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment