Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse

LiquidBounce Forum

  1. Home
  2. Scripts
  3. [SCRIPT] .Rotation 1.0.0

[SCRIPT] .Rotation 1.0.0

Scheduled Pinned Locked Moved Scripts
5 Posts 4 Posters 525 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • VonrV Offline
    VonrV Offline
    Vonr
    wrote on last edited by Vonr
    #1

    .Rotation
    aliases: .rotate

    .Rotation allows you to rotate to any yaw and pitch with much difficulty.
    By using reference magic and avoiding the use of return in external functions, I have overengineered a simple script that would normally be accomplished in 10 lines.

    Syntax

    .rotation [get/set <yaw> <pitch>/setYaw <yaw>/setPitch <pitch>]
    

    Thanks for coming to my TED Talk. Here's the download bye.
    rotation.js

    /// api_version=2
    var script = registerScript({
        name: "Rotation",
        version: "1.0.0",
        authors: ["Qther"]
    });
    
    script.registerCommand({
        name: "Rotation",
        aliases: ["rotation", "rotate"]
    }, function (command) {
        command.on("execute", function (args) {
            var yaw = {
                angle: mc.thePlayer.rotationYaw
            }
            var pitch = {
                angle: mc.thePlayer.rotationPitch
            }
    
            wrapAngleTo180_float(yaw);
            wrapAngleTo180_float(pitch);
    
            var wasSet = false;
            if (args.length > 1) {
                switch (args[1].toLowerCase()) {
                    case undefined:
                    case null:
                        Chat.print("Wrong arguments. (.rotation [get/set/setYaw/setPitch])");
                        break;
                    case "get":
                        Chat.print("[" + yaw.angle.toFixed(4) + " / " + pitch.angle.toFixed(4) + "] (truncated)");
                        break;
                    case "set":
                        if (args.length >= 4) {
                            yaw.angle = parseFloat(args[2]);
                            pitch.angle = parseFloat(args[3]);
                            if (yaw.angle.isNaN() || pitch.angle.isNaN()) {
                                Chat.print("Wrong arguments. (.rotation set <yaw> <pitch>)");
                                return;
                            }
                            wasSet = true;
                        } else {
                            Chat.print("Not enough arguments. (.rotation set <yaw> <pitch>)");
                            return;
                        }
                        break;
                    case "setyaw":
                        if (args.length >= 3) {
                            yaw.angle = parseFloat(args[2]);
                            if (yaw.angle.isNaN()) {
                                Chat.print("Wrong arguments. (.rotation setYaw <yaw>)");
                                return;
                            }
                            wasSet = true;
                        } else {
                            Chat.print("Not enough arguments. (.rotation setYaw <yaw>)");
                            return;
                        }
                        break;
                    case "setpitch":
                        if (args.length >= 3) {
                            pitch.angle = parseFloat(args[2]);
                            if (pitch.angle.isNaN()) {
                                Chat.print("Wrong arguments. (.rotation setPitch <pitch>)");
                                return;
                            }
                            wasSet = true;
                        } else {
                            Chat.print("Not enough arguments. (.rotation setPitch <pitch>)");
                            return;
                        }
                        break;
                }
    
                if (wasSet) {
                    unwrapAngleFrom180_float(yaw);
                    unwrapAngleFrom180_float(pitch);
                    mc.thePlayer.rotationYaw = yaw.angle;
                    mc.thePlayer.rotationPitch = pitch.angle;
                    Chat.print("Set rotation to [" + yaw.angle.toFixed(4) + " / " + pitch.angle.toFixed(4) + "] (truncated)");
                }
            }
        });
    });
    
    function wrapAngleTo180_float(angleRef) {
        angleRef.angle %= 360.0;
        if (angleRef.angle >= 180.0) angleRef.angle -= 360.0;
        if (angleRef.angle < -180.0) angleRef.angle += 360.0;
    }
    
    function unwrapAngleFrom180_float(angleRef) {
        if (angleRef.angle <= 180.0) angleRef.angle += 360.0;
        if (angleRef.angle > 180.0) angleRef.angle -= 360.0;
        angleRef.angle %= 360.0;
    }
    
    // public static float wrapAngleTo180_float(float value) {
    //     value %= 360.0f;
    //     if (value >= 180.0f) {
    //         value -= 360.0f;
    //     }
    //     if (value < -180.0f) {
    //         value += 360.0f;
    //     }
    //     return value;
    // }
    
    1 Reply Last reply
    0
    • yorik100Y Offline
      yorik100Y Offline
      yorik100
      wrote on last edited by
      #2

      That's not useful huh

      ? 1 Reply Last reply
      0
      • ? Offline
        ? Offline
        A Former User
        replied to yorik100 on last edited by
        #3

        @yorik100 everything is usefull

        1 Reply Last reply
        0
        • M Offline
          M Offline
          mems Moderator
          wrote on last edited by
          #4

          If it's Scaffold related then this script is actually useless. LiquidBounce already has a new turn speed, if you did not know.

          ? 1 Reply Last reply
          0
          • ? Offline
            ? Offline
            A Former User
            replied to mems on last edited by
            #5

            @mems its .rotation related

            1 Reply Last reply
            0

            About
            • Terms of Service
            • Privacy Policy
            • Status
            • Contact Us
            Downloads
            • Releases
            • Source code
            • License
            Docs
            • Tutorials
            • CustomHUD
            • AutoSettings
            • ScriptAPI
            Community
            • Forum
            • Guilded
            • YouTube
            • Twitter
            • D.Tube
            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups