-
Recently Browsing
No registered users viewing this page.
-
Posts
-
By diesieben07 · Posted
1.12 is no longer supported on this forum. Please update to a modern version of Minecraft to receive support. -
By diesieben07 · Posted
1.8 is no longer supported on this forum. Please update to a modern version of Minecraft to receive support. -
By diesieben07 · Posted
1.14 is no longer supported on this forum. Please update to a modern version of Minecraft to receive support. -
The easiest solution is to change the position of the bullet before it is spawned. It will however slightly mess with your aim, so take that into consideration. An example code written in 1.15.2 (in 1.16.5 it is propably something similar): float rot = playerEntity.rotationYaw/180.f*3.14159f; //Converts the player rotation to radians float z = MathHelper.sin(rot) * 0.3f; //the multiplier (0.3f) defines how much is the bullet moved to the right float x = MathHelper.cos(rot) * 0.3f; //this and the former equation localizes the bullet to the rotation of the player //the subtrahend 0.5f controlls the height of the bullet //changing the minus sign before x and z to plus moves the bullet to the left anEntity.setPosition(playerEntity.getPosX() - x, playerEntity.getPosYEye() - (double)0.5f, playerEntity.getPosZ() - z); //add the bullet to the world after this
-
-
Topics
-
Who's Online (See full list)
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.