Help me how to convert?



  • C0FPacketConfirmTransaction packetConfirmTransaction = (C0FPacketConfirmTransaction)event.getPacket();
    

    From the above code, how to modify it into javascript code?



  • var C0FPacketConfirmTransaction = Java.type("net.minecraft.network.play.client.C0FPacketConfirmTransaction")
    module.on("packet",function(event){
            if(event.getPacket() instanceof C0FPacketConfirmTransaction){
                var packetConfirmTransaction = event.getPacket()
                //your codes
            }
    })
    


  • just remove the type C0FPacketConfirmTransaction then. Since JavaScript is a dynamically typed language, the type is determined at runtime. If the packet is a instance of a C0FPacketConfirmTransaction you can call getWindowId() and getUid() then if it is not, exceptions should be thrown.

    //if (event.getPacket() instanceof C0FPacketConfirmTransaction)
        packetConfirmTransaction = event.getPacket();
    

Log in to reply