From 19f9cb156f3e47299c6626977f20e881eaf16d75 Mon Sep 17 00:00:00 2001 From: steve <50219120+steveb05@users.noreply.github.com> Date: Sun, 23 Feb 2025 09:13:16 +0100 Subject: [PATCH] fix: initialize velocity variable for new wrapper entity The velocity variable is never set in the class construction, resulting in null pointer exception if the getVelocityPacket method try to change it when is called, and the variable is not set before-hand using the setVelocity method. --- api/src/main/java/me/tofaa/entitylib/wrapper/WrapperEntity.java | 1 + 1 file changed, 1 insertion(+) diff --git a/api/src/main/java/me/tofaa/entitylib/wrapper/WrapperEntity.java b/api/src/main/java/me/tofaa/entitylib/wrapper/WrapperEntity.java index 794f2fe..a0c211f 100644 --- a/api/src/main/java/me/tofaa/entitylib/wrapper/WrapperEntity.java +++ b/api/src/main/java/me/tofaa/entitylib/wrapper/WrapperEntity.java @@ -52,6 +52,7 @@ public class WrapperEntity implements Tickable { this.passengers = ConcurrentHashMap.newKeySet(); this.location = new Location(0, 0, 0, 0, 0); this.viewerRules = new CopyOnWriteArrayList<>(); + this.velocity = Vector3d.zero(); } public WrapperEntity(int entityId, EntityType entityType) {