Add mount edge case handling for dismount scenarios

- Player logout: Dismount from NPC mount before logout to prevent
  orphaned mount state (ServerTickHandler)
- Teleportation: Dismount before cross-dimension teleport to prevent
  mount being left behind in old dimension (NoppesUtilPlayer)
- Dead rider: Validate rider is alive, dismount dead/invalid riders
  to prevent stuck mount state (NPCMountUtil)
- Role disable: Dismount rider when mount role is disabled to prevent
  mounted player on non-mount NPC (RoleMount)
This commit is contained in:
Claude committed 2025-12-30 23:20:54 +00:00
1 parent 096c9b0a69
commit de8c317023
4 files changed
+31 -2

No files matched your search

@@ -123,8 +123,12 @@ public class NoppesUtilPlayer {
}
public static void teleportPlayer(EntityPlayerMP player, double posX, double posY, double posZ, int dimension) {
// Dismount from NPC mount before teleportation to prevent mount desync
if (player.ridingEntity instanceof EntityNPCInterface) {
player.mountEntity(null);
}
if (player.dimension != dimension) {
int dim = player.dimension;
MinecraftServer server = MinecraftServer.getServer();
WorldServer wor = server.worldServerForDimension(dimension);
if (wor == null) {
@@ -144,8 +148,12 @@ public class NoppesUtilPlayer {
}
public static void teleportPlayer(EntityPlayerMP player, double posX, double posY, double posZ, float yaw, float pitch, int dimension) {
// Dismount from NPC mount before teleportation to prevent mount desync
if (player.ridingEntity instanceof EntityNPCInterface) {
player.mountEntity(null);
}
if (player.dimension != dimension) {
int dim = player.dimension;
MinecraftServer server = MinecraftServer.getServer();
WorldServer wor = server.worldServerForDimension(dimension);
if (wor == null) {