Started by
Kvngsavage118
on
Topic category: Help with Minecraft modding (Java Edition)
I am making a mod that uses a living entity for an attack, and I made a keybind procedure that when I hold the button, said entity spawns and looks around, and when I release the button, it attacks. The entity moves around, but not in the exact position of my mouse (around 1-2 blocks away from my mouse). I've done the Look X,Y,Z raytrace procedure blocks but that hasn't been working for me. Any help would be appreciated.
If the raytrace blocks aren't working, and, (if I understand correctly), you want the entity to teleport in the direction the player is looking at, you could try setting its position to the player's x/y/z, plus the player's x/y/z look angle vectors. (Which range from -1 to 1, based on the direction the player is looking at.) You can then multiply the vectors by a decimal number, (if you want the entity to be closer than one block), or by a whole number, (if you want it to be further than one block.) Since look angle vectors are always out of one, whatever you multiply will be the exact distance from the player the entity teleports.
Im trying to basically aim an entity like an arrow. So I want the entity directly in front of me where I look.
Oh, okay, that's actually a pretty cool idea! You want to sort of have it hover in front of you until you fire it? You would need to do something like this:
Thank you so much for helping me! I've been trying to figure this out for a while before you came along.