mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-18 10:19:08 +00:00
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:
4 files changed
+31
-2
No files matched your search
@@ -177,6 +177,17 @@ public final class NPCMountUtil {
|
||||
|
||||
RoleMount mount = (RoleMount) npc.roleInterface;
|
||||
Entity currentRider = npc.riddenByEntity;
|
||||
|
||||
// Validate rider is alive and valid - dismount dead/invalid riders
|
||||
if (currentRider != null && !currentRider.isEntityAlive()) {
|
||||
currentRider.mountEntity(null);
|
||||
stabilizeDismountedRider(currentRider);
|
||||
haltMountedMotion(npc, state);
|
||||
applyUnriddenFlightDescent(npc, state, mount);
|
||||
currentRider = null;
|
||||
}
|
||||
|
||||
// Only allow EntityPlayer as riders
|
||||
if (currentRider != null && !(currentRider instanceof EntityPlayer)) {
|
||||
Entity dismount = currentRider;
|
||||
dismount.mountEntity(null);
|
||||
|
||||
Reference in new issue
Block a user