CCBlueX Forum

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups

    Solved How to detect if the player is crouching or jumping?

    ScriptAPI
    3
    4
    196
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • mq
      mq last edited by

      How to detect if the player is crouching or jumping?

      So I'm trying to redo the Vanilla Fly as the script:

      /// api_version=2
      var script = registerScript({
          name: "VanillaFly",
          version: "1.0.0",
          authors: ["kvuqq"]
      });
      
      // Imported classes
      var MovementUtils = Java.type("net.ccbluex.liquidbounce.utils.MovementUtils");
      script.registerModule({
          name: "VanillaFly",
          category: "Movement",
          description: "Built-in vanilla fly, but as script"
      }, function(module) {
          module.on("motion", function() {
              MovementUtils.strafe(1)
              mc.thePlayer.motionY = 0;
          });
      });
      

      and the original has that:

                  player.strafe(speed = 0.44)
                  player.velocity.y = when {
                      player.input.jumping -> 0.31
                      player.input.sneaking -> -0.31
                      else -> 0.0
                  }
      

      so I want to detect if the player is crouching/jumping.

      mq 1 Reply Last reply Reply Quote 0
      • mq
        mq @mq last edited by

        @mq ok nvm i found out how to check it

            if (mc.gameSettings.keyBindSneak.pressed == true) { /* If crouching */
                mc.thePlayer.motionY = -0.31; /* Go down */
            } else if (mc.gameSettings.keyBindJump.pressed == true) { /* If jumping */
                mc.thePlayer.motionY = 0.31; /* Go up */
            } else {
                mc.thePlayer.motionY = 0;
            }
        
        ? 1 Reply Last reply Reply Quote 1
        • mq
          mq @mq last edited by

          @mq ok nvm i found out how to check it

              if (mc.gameSettings.keyBindSneak.pressed == true) { /* If crouching */
                  mc.thePlayer.motionY = -0.31; /* Go down */
              } else if (mc.gameSettings.keyBindJump.pressed == true) { /* If jumping */
                  mc.thePlayer.motionY = 0.31; /* Go up */
              } else {
                  mc.thePlayer.motionY = 0;
              }
          
          ? 1 Reply Last reply Reply Quote 1
          • ?
            A Former User @mq last edited by

            @mq You can also do mc.thePlayer.movementInput.sneak

            END3R1355 1 Reply Last reply Reply Quote 0
            • END3R1355
              END3R1355 Banned @Guest last edited by

              @mimikyuin fart cheese moment

              1 Reply Last reply Reply Quote 0
              • First post
                Last post
              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