mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-21 04:32:39 +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
@@ -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) {
|
||||
|
||||
Reference in new issue
Block a user