diff --git a/src/main/java/com/minelittlepony/unicopia/entity/Living.java b/src/main/java/com/minelittlepony/unicopia/entity/Living.java index 955f9c2c..5d4cf6a8 100644 --- a/src/main/java/com/minelittlepony/unicopia/entity/Living.java +++ b/src/main/java/com/minelittlepony/unicopia/entity/Living.java @@ -383,15 +383,17 @@ public abstract class Living implements Equine, Caste return Equine.>of(entity, e -> e instanceof Living).orElse(null); } - public static void updateVelocity(Entity entity) { - entity.velocityModified = true; - //if (entity instanceof ServerPlayerEntity ply) { - // ply.networkHandler.sendPacket(new EntityVelocityUpdateS2CPacket(ply)); - //} + public static void updateVelocity(@Nullable Entity entity) { + if (entity != null) { + entity.velocityModified = true; + //if (entity instanceof ServerPlayerEntity ply) { + // ply.networkHandler.sendPacket(new EntityVelocityUpdateS2CPacket(ply)); + //} + } } - public static void transmitPassengers(Entity entity) { - if (entity.world instanceof ServerWorld sw) { + public static void transmitPassengers(@Nullable Entity entity) { + if (entity != null && entity.world instanceof ServerWorld sw) { sw.getChunkManager().sendToNearbyPlayers(entity, new EntityPassengersSetS2CPacket(entity)); } } diff --git a/src/main/java/com/minelittlepony/unicopia/entity/player/Pony.java b/src/main/java/com/minelittlepony/unicopia/entity/player/Pony.java index da0d1d58..b311959f 100644 --- a/src/main/java/com/minelittlepony/unicopia/entity/player/Pony.java +++ b/src/main/java/com/minelittlepony/unicopia/entity/player/Pony.java @@ -312,6 +312,7 @@ public class Pony extends Living implements Copyable, Update if (isClient()) { if (entity.hasVehicle() && entity.isSneaking()) { + @Nullable Entity vehicle = entity.getVehicle(); if (vehicle instanceof Trap) { @@ -326,7 +327,9 @@ public class Pony extends Living implements Copyable, Update } else { setCarrier((UUID)null); entity.stopRiding(); - entity.refreshPositionAfterTeleport(vehicle.getPos()); + if (vehicle != null) { + entity.refreshPositionAfterTeleport(vehicle.getPos()); + } Living.transmitPassengers(vehicle); } }