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. General
  3. BlockBBEvent in scripts?

BlockBBEvent in scripts?

Scheduled Pinned Locked Moved Solved General
27 Posts 5 Posters 7.2k Views
  • 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.
  • CzechHekC CzechHek

    @idk-my-name

    This is what I came up with without seeing @commandblock2's solution.
    I had to reverse engineer a bunch of stuff and then put all together and it worked.

    I was wondering what the hell was annotation in Nashorn and it turns out that

    print(annotation.class)

    literally returns
    d828c6df-270d-452a-8db2-b751195f7d54-image.png

    I'll try to simplify it and automize it via Core.

    ///api_version=2
    (script = registerScript({
        name: "Test",
        authors: ["CzechHek"],
        version: "1.0"
    })).import("Core.lib");
    
    module = {
        onClickGuiLoaded: function () {
            listener = new (Java.extend(Listenable, Consumer, { 
                handleEvents: function() { return TestModule.state }, 
                accept: function(e) { 
                    print(e)
                }
            }));
    
            method = getMethod(listener, "accept");
            annotation = getMethod(TestModule, "onUpdate").getDeclaredAnnotations()[0];
            
            AeventManager = new Reflector(LiquidBounce.eventManager)
            invocableEventTargets = AeventManager.registry.getOrDefault(BlockBBEvent.class, new ArrayList());
            invocableEventTargets.add(new EventHook(listener, method, annotation));
            AeventManager.registry[BlockBBEvent.class] = invocableEventTargets;
        }
    }
    
    Listenable = Java.type("net.ccbluex.liquidbounce.event.Listenable");
    Consumer = Java.type("java.util.function.Consumer");
    BlockBBEvent = Java.type("net.ccbluex.liquidbounce.event.BlockBBEvent");
    EventHook = Java.type("net.ccbluex.liquidbounce.event.EventHook");
    ArrayList = Java.type("java.util.ArrayList")
    
    I Offline
    I Offline
    idk my name
    wrote on last edited by idk my name
    #21

    @czechhek my problem was too stupid: i forgot to create new instance of my listener (and i had some shitcode in listener prob)

    ? CzechHekC 2 Replies Last reply
    0
    • I idk my name

      @czechhek my problem was too stupid: i forgot to create new instance of my listener (and i had some shitcode in listener prob)

      ? Offline
      ? Offline
      A Former User
      wrote on last edited by
      #22

      @idk-my-name you forgor 💀

      I 1 Reply Last reply
      0
      • ? A Former User

        @idk-my-name you forgor 💀

        I Offline
        I Offline
        idk my name
        wrote on last edited by
        #23

        @fartcheese i forgor 💀

        ? 1 Reply Last reply
        0
        • I idk my name

          @fartcheese i forgor 💀

          ? Offline
          ? Offline
          A Former User
          wrote on last edited by
          #24

          @idk-my-name we forgor 💀

          I 1 Reply Last reply
          0
          • ? A Former User

            @idk-my-name we forgor 💀

            I Offline
            I Offline
            idk my name
            wrote on last edited by
            #25

            @fartcheese Wait... I rember😀

            ? 1 Reply Last reply
            0
            • I idk my name

              @fartcheese Wait... I rember😀

              ? Offline
              ? Offline
              A Former User
              wrote on last edited by
              #26

              @idk-my-name same

              i rember 😳😳😳

              1 Reply Last reply
              0
              • I idk my name

                @czechhek my problem was too stupid: i forgot to create new instance of my listener (and i had some shitcode in listener prob)

                CzechHekC Offline
                CzechHekC Offline
                CzechHek
                wrote on last edited by CzechHek
                #27

                @czechhek said in BlockBBEvent in scripts?:

                I'll try to simplify it and automize it via Core.

                @idk-my-name https://forums.ccbluex.net/topic/94/script-base-core-3-28-simple-yet-powerful-scriptapi-base/30 and here it is

                You can use all events if you import Core base, no need to do any of this stuff.
                For more info, look at my comment on Core post.

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                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