What is the method of sending packets(Or usage)
-
When I write my JS, I need to send a c0epacket, but I use the method in V1, that is, the mc.thePlayer.sendQueue.addToSendQueue method, but it doesn't work. It tells me that this method doesn't exist. So who can tell me how to send packet(Or usage .One possibility is that this function exists, but its method has changed)
-
Core
sendPacket(new C0EPacketClickWindow);
-
@plumer-man I found the sendpacket function from the core. The content is: function sendpacket (packet, trigger event){
_networkManager = mc.getNetHandler().getNetworkManager();
if (triggerEvent) _networkManager.sendPacket(packet);
else if (_networkManager.isChannelOpen()) {
_flushOutboundQueueMethod.invoke(_networkManager);
_dispatchPacketMethod.invoke(_networkManager, packet, null);
} else {
_readWriteLockField.get(_networkManager).writeLock().lock();
try {
_outboundPackets = _outboundPacketsQueueField.get(_networkManager);
_outboundPackets.add(new NetworkManager.InboundHandlerTuplePacketListener(packet, null));
_outboundPacketsQueueField.set(_networkManager, _outboundPackets);
} finally {
_readWriteLockField.get(_networkManager).writeLock().unlock();
}
}
-
@wowiesocl said in What is the method of sending packets(Or usage):
@plumer-man I found the sendpacket function from the core. The content is: function sendpacket (packet, trigger event){
_networkManager = mc.getNetHandler().getNetworkManager();
if (triggerEvent) _networkManager.sendPacket(packet);
else if (_networkManager.isChannelOpen()) {
_flushOutboundQueueMethod.invoke(_networkManager);
_dispatchPacketMethod.invoke(_networkManager, packet, null);
} else {
_readWriteLockField.get(_networkManager).writeLock().lock();
try {
_outboundPackets = _outboundPacketsQueueField.get(_networkManager);
_outboundPackets.add(new NetworkManager.InboundHandlerTuplePacketListener(packet, null));
_outboundPacketsQueueField.set(_networkManager, _outboundPackets);
} finally {
_readWriteLockField.get(_networkManager).writeLock().unlock();
}
}
Well, this is the silent way of sending a packet.