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. Kotlin/Java
  3. I need some help with Mixin

I need some help with Mixin

Scheduled Pinned Locked Moved Kotlin/Java
5 Posts 3 Posters 253 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.
  • VanillaMirrorV Offline
    VanillaMirrorV Offline
    VanillaMirror
    wrote on last edited by
    #1

    As title
    i wanna find a way to do it but failed :<
    So if some one can give an helping hand for make boolean flag2 = d0 * d0 + d1 * d1 + d2 * d2 > 9.0E-4D || this.positionUpdateTicks >= 20;
    to true
    btw. flag2 is in EntityPlayerSP.onUpdateWalkingPlayer() and in EntityPlayerSP's 221
    Please added it with valid

    M 1 Reply Last reply
    0
    • M Offline
      M Offline
      mems Moderator
      replied to VanillaMirror on last edited by
      #2

      @vanillamirror said in I need some help with Mixin:

      So if some one can give an helping hand for make boolean flag2 = d0 * d0 + d1 * d1 + d2 * d2 > 9.0E-4D || this.positionUpdateTicks >= 20;
      to true

      ALWAYS set to true though?

      VanillaMirrorV 1 Reply Last reply
      0
      • VanillaMirrorV Offline
        VanillaMirrorV Offline
        VanillaMirror
        replied to mems on last edited by
        #3

        @mems yes

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

          @vanillamirror said in I need some help with Mixin:

          @mems yes

          Alright, this is my method to solve this, even though there are probably a few more:

          First, you use the ModifyVariable injection, with STORE as the annotation type, then we make use of the name parameter, or whatever it's called. In your case, you are looking to target the flag2 variable's value that exists in the onUpdateWalkingPlayer function.

          This is how it's done in code:

          @ModifyVariable(method = "onUpdateWalkingPlayer", at = @At("STORE"), name = "flag2")
          

          Then you add the required function (boolean type as the variable is a boolean type):

          private boolean nameThatYouWouldLike(boolean value) {
          
          }
          

          boolean value contains the default value result that is from the flag2 variable.

          This: d0 * d0 + d1 * d1 + d2 * d2 > 9.0E-4D || this.positionUpdateTicks >= 20; in case you ask.

          Replace the nameThatYouWouldLike with whatever you want, or keep it like that, as long as it has a name.

          Finally, you add your custom code inside and in your case again it's to set the value to true. Remember, you must also use return to the new value you set, whether it's false or true, or something else. An example:

              private boolean nameThatYouWouldLike(boolean value) {
                  if (LiquidBounce.moduleManager.getModule(XRay.class).getState()) {
                      return true;
                  }
                  
                  return value;
              }
          

          return value this will return the value result from the original code, which is this: d0 * d0 + d1 * d1 + d2 * d2 > 9.0E-4D || this.positionUpdateTicks >= 20;

          return true is your modified code. (it just returns true, it won't change, as long as the statement is also true)

          This is how the full version of the example looks like:

              @ModifyVariable(method = "onUpdateWalkingPlayer", at = @At("STORE"), name = "flag2")
              private boolean nameThatYouWouldLike(boolean value) {
                  if (LiquidBounce.moduleManager.getModule(XRay.class).getState()) {
                      return true;
                  }
          
                  return value;
              }
          

          And now, I assume you know how to code, so replace this:

                  if (LiquidBounce.moduleManager.getModule(XRay.class).getState()) {
                      return true;
                  }
          

          with something of your own.

          Long ass post, but I want to make sure you understand. If you have any questions regarding that, don't hesitate to ask.

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

            @mems wow, a very long post with no grammar errors, 😳

            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