-
@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!") } }
-
@ChocoPie_isme rip brian cels v2
now i don even hvae brian cels enough to tyoep pwoperly -
@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?
-
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(); } });
-
This post is deleted!
-
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) -
This post is deleted!