Started by
God_Of_Wood
on
Topic category: Help with Minecraft modding (Java Edition)
I need to shoot a fireball in the direction the player is looking with the press of a custom key bind, but I can't find the way to do it.
Topic category: Help with Minecraft modding (Java Edition)
I need to shoot a fireball in the direction the player is looking with the press of a custom key bind, but I can't find the way to do it.
For the x/y/z velocity of the projectile, use the 'x/y/z look-angle vectors' of the player. (There's a seperate x-look angle vector, z-look angle vector, and y look angle vector function.) These essentially get the individual components of the vector, (the arrow the player's looking at), which conveniently can be turned into velocities for your projectile to aim it as you desire.
If you want to increase or decrease the speed of the projectile, multiply each of the vectors, either by a decimal number, (for a slower speed), or a whole number, (for a greater speed.)
Thank you!
For anyone having the same problem, I also found that MCreator has a 'shoot in player direction' pre-made function.