Posted November 13, 20222 yr Heya, So I'm trying to create a condition that, when activated, forces my entity to face the closest direction they're looking. For example, if they're looking between north and east and the condition triggers, they'll face north. Here's how I tried to do it (I did this in the tick() method in the entity class): if (this.isPetrified()) { if (this.getYRot() >= 0 && this.getYRot() < 90) { this.setYRot(0.0F); } else if (this.getYRot() >= 90 && this.getYRot() < 180) { this.setYRot(90.0F); } else if (this.getYRot() >= 180 && this.getYRot() < 270) { this.setYRot(180.0F); } else if (this.getYRot() >= 270 && this.getYRot() < 359) { this.setYRot(270.0F); } else { this.setYRot(0.0F); } } This causes the entity to face the certain direction, but if I walk near it, it will occasionally turn and face separate directions. Any idea what could be causing this?
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.