Only handle motion notify for current entity.

This commit is contained in:
gentlespoon 2022-05-09 01:43:32 -07:00 committed by Melledy
parent f0aa8c2c53
commit ccdc3d1214

View File

@ -243,15 +243,16 @@ public class StaminaManager {
cachedEntity = entity; cachedEntity = entity;
MotionInfo motionInfo = moveInfo.getMotionInfo(); MotionInfo motionInfo = moveInfo.getMotionInfo();
MotionState motionState = motionInfo.getState(); MotionState motionState = motionInfo.getState();
boolean isReliable = moveInfo.getIsReliable(); int notifyEntityId = entity.getId();
Grasscutter.getLogger().trace("" + motionState + "\t" + (isReliable ? "reliable" : "")); int currentAvatarEntityId = session.getPlayer().getTeamManager().getCurrentAvatarEntity().getId();
if (isReliable) { if (notifyEntityId != currentAvatarEntityId) {
currentState = motionState; return;
Vector posVector = motionInfo.getPos(); }
Position newPos = new Position(posVector.getX(), posVector.getY(), posVector.getZ()); currentState = motionState;
if (newPos.getX() != 0 && newPos.getY() != 0 && newPos.getZ() != 0) { Vector posVector = motionInfo.getPos();
currentCoordinates = newPos; Position newPos = new Position(posVector.getX(), posVector.getY(), posVector.getZ());
} if (newPos.getX() != 0 && newPos.getY() != 0 && newPos.getZ() != 0) {
currentCoordinates = newPos;
} }
startSustainedStaminaHandler(); startSustainedStaminaHandler();
handleImmediateStamina(session, motionInfo, motionState, entity); handleImmediateStamina(session, motionInfo, motionState, entity);