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. ScriptAPI
  3. onPlaceBlock , onSendPacket event

onPlaceBlock , onSendPacket event

Scheduled Pinned Locked Moved ScriptAPI
13 Posts 7 Posters 2.1k 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.
  • Senk JuS Senk Ju

    Why would you need a onPacketSend event? Packet names either start with a C or an S. Packets whose name begins with a C are client packets, those that begin with an S are server packets.

    ChocoPie_ismeC Offline
    ChocoPie_ismeC Offline
    ChocoPie_isme
    Banned
    wrote on last edited by
    #4

    @Senk-Ju said in onPlaceBlock , onSendPacket event:

    Why would you need a onPacketSend event? Packet names either start with a C or an S. Packets whose name begins with a C are client packets, those that begin with an S are server packets.

    i mean i want to execute sth when sending a packet, example:

    this.onSendPacket = function(event) {
          if(event.sendPacket() instanceof C03PacketPlayer) {
         Chat.print("you send a c03 packet!")
          }
    }
    
    infAuraI 1 Reply Last reply
    0
    • AzureA Offline
      AzureA Offline
      Azure
      wrote on last edited by
      #5

      learn english, kid. You used send....

      1 Reply Last reply
      0
      • Senk JuS Offline
        Senk JuS Offline
        Senk Ju
        Admin
        wrote on last edited by
        #6

        Why not do it like this?

        module.on("packet", function(event) {
            var packet = event.getPacket();
        
            if (packet instanceof Java.type("net.minecraft.network.play.client.C03PacketPlayer")) {
                Chat.print("you send a c03 packet!");   
            }
        });
        
        ChocoPie_ismeC 1 Reply Last reply
        0
        • ChocoPie_ismeC ChocoPie_isme

          @Senk-Ju said in onPlaceBlock , onSendPacket event:

          Why would you need a onPacketSend event? Packet names either start with a C or an S. Packets whose name begins with a C are client packets, those that begin with an S are server packets.

          i mean i want to execute sth when sending a packet, example:

          this.onSendPacket = function(event) {
                if(event.sendPacket() instanceof C03PacketPlayer) {
               Chat.print("you send a c03 packet!")
                }
          }
          
          infAuraI Offline
          infAuraI Offline
          infAura
          wrote on last edited by
          #7

          @ChocoPie_isme rip brian cels v2
          now i don even hvae brian cels enough to tyoep pwoperly 😞

          1 Reply Last reply
          0
          • Senk JuS Senk Ju

            Why not do it like this?

            module.on("packet", function(event) {
                var packet = event.getPacket();
            
                if (packet instanceof Java.type("net.minecraft.network.play.client.C03PacketPlayer")) {
                    Chat.print("you send a c03 packet!");   
                }
            });
            
            ChocoPie_ismeC Offline
            ChocoPie_ismeC Offline
            ChocoPie_isme
            Banned
            wrote on last edited by
            #8

            @Senk-Ju said in onPlaceBlock , onSendPacket event:

            Why not do it like this?

            module.on("packet", function(event) {
                var packet = event.getPacket();
            
                if (packet instanceof Java.type("net.minecraft.network.play.client.C03PacketPlayer")) {
                    Chat.print("you send a c03 packet!");   
                }
            });
            

            i thought the code will be execute when i RECEIVE (not send) a packet?

            LolMCL 1 Reply Last reply
            0
            • Senk JuS Offline
              Senk JuS Offline
              Senk Ju
              Admin
              wrote on last edited by
              #9

              In the documentation it says the following:

              Event Name Has event data? Description
              packet Yes Called every time a packet is processed.

              Packet event

              Method Description Type
              eventData.getPacket() Returns the packet which triggered this event. Packet
              event.cancelEvent() Cancels the event. void
              Example:
              var C00Handshake = Java.type("net.minecraft.network.handshake.client.C00Handshake");
              
              ...
              
              module.on("packet", function(eventData) {
                  var packet = eventData.getPacket();
              
                  if (packet instanceof C00Handshake) {
                      Chat.print("Cancelling handshake.");
                      eventData.cancelEvent();
                  }
              });
              
              ? 1 Reply Last reply
              0
              • ChocoPie_ismeC ChocoPie_isme

                @Senk-Ju said in onPlaceBlock , onSendPacket event:

                Why not do it like this?

                module.on("packet", function(event) {
                    var packet = event.getPacket();
                
                    if (packet instanceof Java.type("net.minecraft.network.play.client.C03PacketPlayer")) {
                        Chat.print("you send a c03 packet!");   
                    }
                });
                

                i thought the code will be execute when i RECEIVE (not send) a packet?

                LolMCL Offline
                LolMCL Offline
                LolMC
                wrote on last edited by
                #10
                This post is deleted!
                1 Reply Last reply
                0
                • Senk JuS Senk Ju

                  In the documentation it says the following:

                  Event Name Has event data? Description
                  packet Yes Called every time a packet is processed.

                  Packet event

                  Method Description Type
                  eventData.getPacket() Returns the packet which triggered this event. Packet
                  event.cancelEvent() Cancels the event. void
                  Example:
                  var C00Handshake = Java.type("net.minecraft.network.handshake.client.C00Handshake");
                  
                  ...
                  
                  module.on("packet", function(eventData) {
                      var packet = eventData.getPacket();
                  
                      if (packet instanceof C00Handshake) {
                          Chat.print("Cancelling handshake.");
                          eventData.cancelEvent();
                      }
                  });
                  
                  ? Offline
                  ? Offline
                  A Former User
                  wrote on last edited by
                  #11

                  @Senk-Ju
                  My Opinion:
                  CxxPacket only sends by Client and won't receive from Server
                  SxxPacket only receives from Server

                  1 Reply Last reply
                  0
                  • ? Offline
                    ? Offline
                    A Former User
                    wrote on last edited by
                    #12

                    As for "onPlaceBlock", I think you can check C08PacketPlayerBlockPlacement in onPacket.
                    (I don't code with mcp918 so If it's wrong way plz remind me, thanks)

                    1 Reply Last reply
                    0
                    • skiddermaster412S Offline
                      skiddermaster412S Offline
                      skiddermaster412
                      wrote on last edited by
                      #13
                      This post is deleted!
                      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