Skip to content

Commit

Permalink
Fix npe for remove and rotateHead updates yaw and pitch
Browse files Browse the repository at this point in the history
  • Loading branch information
Tofaa2 committed Aug 8, 2024
1 parent 266e4e6 commit f24fdf6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,12 @@ public void setLocation(Location location) {
}

public void remove() {
parent.removeEntity(this, true);
if (parent != null) {
parent.removeEntity(this, true);
}
else {
despawn();
}
}

public void despawn() {
Expand Down Expand Up @@ -382,6 +387,8 @@ public void rotateHead(float yaw, float pitch) {
new WrapperPlayServerEntityRotation(entityId, yaw, pitch, onGround),
new WrapperPlayServerEntityHeadLook(entityId, yaw)
);
this.location.setYaw(yaw);
this.location.setPitch(pitch);
}

public void rotateHead(Location location) {
Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import java.io.ByteArrayOutputStream

val fullVersion = "2.4.5"
val fullVersion = "2.4.7"
val snapshot = true

group = "me.tofaa.entitylib"
Expand Down

0 comments on commit f24fdf6

Please sign in to comment.