final Entity entityInHex = game.getEntity(step.getPosition()); if (entityInHex != null && !entityInHex.equals(entity)
final Entity violation = stackingViolation(game, entityId, step.getPosition()); if (violation != null
    private static void compileStackingViolations(Game game, int entityId, MovementData md) {        final Entity entity = game.getEntity(entityId);                boolean lastMoveLegal = false;        for (int i = md.length() - 1; i >= 0; i--) {            final MovementData.Step step = md.getStep(i);                        // find the last legal step            if (lastMoveLegal || step.getMovementType() == Entity.MOVE_ILLEGAL) {                continue;            }                        final Entity entityInHex = game.getEntity(step.getPosition());            if (entityInHex != null && !entityInHex.equals(entity)                    && step.getType() != MovementData.STEP_CHARGE                    && step.getType() != MovementData.STEP_DFA) {                // can't move here                step.setMovementType(Entity.MOVE_ILLEGAL);            } else {                lastMoveLegal = true;            }        }    }