Started by
sqweems
on
Topic category: Help with Minecraft modding (Java Edition)
hi, i'm trying to make a sword that lets you teleport 8 in the direction you are looking blocks but not through blocks. i already have the code to teleport but i can't make it stop if you hit blocks.
pleas tell me how ty<3
I assume you're using the player's look angle vectors and multiplying by eight. You could simply check if the block at that position, and the block directly above it aren't solid, (and cancel the teleport if it is). You could also change the amount your multiplying the vectors by to smaller numbers each time there's a solid collision, in order to make the teleport stop before it hits a wall instead of straight up canceling it.
tysm <3 thats rlly helpful