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. Reading packet data?

Reading packet data?

Scheduled Pinned Locked Moved ScriptAPI
3 Posts 2 Posters 382 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.
  • P Offline
    P Offline
    Pi
    wrote on last edited by
    #1

    When breaking a carrot I capture two packets with the packet event, which I presume are the start breaking and end breaking packets.
    I need a way to differentiate between the start breaking and the end breaking packet. Is there a way to read the packet's contents?

    var packetDig = Java.type("net.minecraft.network.play.client.C07PacketPlayerDigging");
    module.on("packet", function(eventData) {
    	var packet = eventData.getPacket();
    	if (packet instanceof packetDig) {
    		Chat.print("Data: " + eventData);
    		//eventData.cancelEvent();
    	}
    });
    
    C 1 Reply Last reply
    0
    • P Pi

      When breaking a carrot I capture two packets with the packet event, which I presume are the start breaking and end breaking packets.
      I need a way to differentiate between the start breaking and the end breaking packet. Is there a way to read the packet's contents?

      var packetDig = Java.type("net.minecraft.network.play.client.C07PacketPlayerDigging");
      module.on("packet", function(eventData) {
      	var packet = eventData.getPacket();
      	if (packet instanceof packetDig) {
      		Chat.print("Data: " + eventData);
      		//eventData.cancelEvent();
      	}
      });
      
      C Offline
      C Offline
      commandblock2
      wrote on last edited by
      #2

      @pi
      If you are using the version before cross_version
      this and this.
      Eg. packetDig.getStatus() == packetDig.Action.START_DESTROY_BLOCK (didn't test).

      1 Reply Last reply
      1
      • P Offline
        P Offline
        Pi
        wrote on last edited by
        #3

        I've also come across a solution for this.

        Although I'm not quite sure if this is working properly because when breaking a carrot, I detect two packets both with the action of START_DESTROY_BLOCK, and nothing else.

        For now this seems to suffice.

        var packetDig = Java.type("net.minecraft.network.play.client.C07PacketPlayerDigging");
        module.on("packet", function(eventData) {
        	var packet = eventData.getPacket();
        	if (packet instanceof packetDig) {
        		Chat.print("Stat: " + packet.getStatus());
        		Chat.print("Pos: " + packet.getPosition());
        		Chat.print("Facing: " + packet.getFacing());
        		//eventData.cancelEvent();
        	}
        });
        
        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