Posted October 21, 20231 yr Hi there! I am making a mob that summons an entity on spawn. I rotate this entity around the mob every tick. To do this, I wrote this function that is called from aiStep(). Entity shield_0; // this is summoned onSpawn private void rotateShields() // this is called every tick from aiStep { rotation_0 = rotate(rotation_0, 5f); rotation_1 = rotation_0 + 90.0f; if (this.shield_0 != null) { double shieldX = this.getX() + Math.cos(Math.toRadians(rotation_0)) * 2; double shieldZ = this.getZ() + Math.sin(Math.toRadians(rotation_0)) * 2; this.shield_0.setPos(shieldX, this.getY() + 2, shieldZ); this.shield_0.setYRot((rotation_0 - 90.0f)); } } private float rotation_0; float rotate(float rot, float timePerLoop) { timePerLoop = 360.0f / (20 * timePerLoop); if (rot < 360) rot += timePerLoop; else { rot = 0; } return rot; } For some reason, the rotation of the entity works just fine while the y-pos of the entity slowly falls down until it hits the ground and jumps back up to where it is supposed to go. I even did a "System.out.println(this.shield_0.getY());" and that prints out the correct y-value at a stable rate while the actual entity position in-game is wonky. This strange behavior is leading me to believe that there is some weird syncing issue, but I have no idea how to solve it or why it's happening. Edited October 21, 20231 yr by Koi I figured it out
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.