Fix npe for remove and rotateHead updates yaw and pitch

This commit is contained in:
Tofaa 2024-08-08 14:21:49 +04:00
parent 266e4e6c4e
commit f24fdf6383
2 changed files with 9 additions and 2 deletions

View file

@ -121,8 +121,13 @@ public class WrapperEntity implements Tickable, TrackedEntity {
} }
public void remove() { public void remove() {
if (parent != null) {
parent.removeEntity(this, true); parent.removeEntity(this, true);
} }
else {
despawn();
}
}
public void despawn() { public void despawn() {
if (!spawned) return; if (!spawned) return;
@ -382,6 +387,8 @@ public class WrapperEntity implements Tickable, TrackedEntity {
new WrapperPlayServerEntityRotation(entityId, yaw, pitch, onGround), new WrapperPlayServerEntityRotation(entityId, yaw, pitch, onGround),
new WrapperPlayServerEntityHeadLook(entityId, yaw) new WrapperPlayServerEntityHeadLook(entityId, yaw)
); );
this.location.setYaw(yaw);
this.location.setPitch(pitch);
} }
public void rotateHead(Location location) { public void rotateHead(Location location) {

View file

@ -1,6 +1,6 @@
import java.io.ByteArrayOutputStream import java.io.ByteArrayOutputStream
val fullVersion = "2.4.5" val fullVersion = "2.4.7"
val snapshot = true val snapshot = true
group = "me.tofaa.entitylib" group = "me.tofaa.entitylib"