Skip to main content

getYaw

 float yawDelta1 = Math.abs(user.from.getYaw() - user.to.getYaw()), pitchDelta1 = Math.abs(user.from.getYaw() - user.to.getYaw());
            float yaw = convertToMouseDelta(yawDelta1), pitch = convertToMouseDelta(pitchDelta1);
            float smoothing = ((float) Math.cbrt((yawDelta1 / 0.15f) / 8f) - 0.2f) / .6f;
            float smooth1 = user.smooth.smooth(yaw, pitch * 0.05f);
            boolean b = (Math.abs(smooth1 - yaw) < 0.04 || yawDelta1 > 40);
            boolean smoothing1 = (Math.abs(user.lastSmoothingRot - smoothing) < 0.1);
            boolean smoothing2 = (Math.abs(smooth1 - smoothing) > 0.2 && smoothing > 1.2);
            if ((smoothing1 || smoothing2) && MathUtil.looked(e.getFrom(),e.getTo())) {
                if (MathUtil.looked(e.getFrom(), e.getTo()) && e.getFrom().getYaw() != e.getTo().getYaw() && e.getFrom().getPitch() != e.getTo().getPitch()) {
                    if (user.optifineSmoothSens < 20) user.optifineSmoothSens++;
                } else {
                     if (user.optifineSmoothSens > 0) user.optifineSmoothSens--;
                }
            } else {
                if (user.optifineSmoothSens > 0) user.optifineSmoothSens--;
            }
            //user.player.sendMessage("Client Smoothing: " + (user.smoothingCounter) + " | " + Math.abs(user.smoothingCounter - user.LastSmoothingCounter) + " || " + user.optifineSmoothing);
            if (Math.abs(user.smoothingCounter - user.LastSmoothingCounter) > 0) {
                user.smoothingCounter = 0;
            }
            //  user.player.sendMessage("Same: "+user.optifineSameCount);
            if (user.optifineSameCount > 2) {
                user.optifineSmoothing = 0;
            }
            if (user.smoothingCounter > 4) {
                if (user.lastClientSmoothingValue == user.smoothingCounter) {
                    user.optifineSameCount += 2;
                } else {
                    if (user.optifineSameCount > 0) user.optifineSameCount--;
                }
                user.lastClientSmoothingValue = user.smoothingCounter;
                user.lastOptifine = System.currentTimeMillis();
                if (user.optifineSmoothing < 30) user.optifineSmoothing++;
            } else {
                if (user.optifineSmoothing > 0) user.optifineSmoothing -= 2;

            }


            if (smoothing1 || smoothing2) {
                if (MathUtil.looked(e.getFrom(), e.getTo()) && e.getFrom().getYaw() != e.getTo().getYaw() && e.getFrom().getPitch() != e.getTo().getPitch()) {
                    user.smoothingCounter++;
                } else {
                    if (user.smoothingCounter > 0) user.smoothingCounter--;
                }
                user.LastSmoothingCounter = user.smoothingCounter;
            } else {
                user.smoothingCounter = 0;
            }

            user.lastSmoothingRot = smoothing;