本文整理匯總了Java中net.minecraft.network.packet.Packet.canProcessAsync方法的典型用法代碼示例。如果您正苦於以下問題:Java Packet.canProcessAsync方法的具體用法?Java Packet.canProcessAsync怎麽用?Java Packet.canProcessAsync使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraft.network.packet.Packet
的用法示例。
在下文中一共展示了Packet.canProcessAsync方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: processOrCachePacket
import net.minecraft.network.packet.Packet; //導入方法依賴的package包/類
/**
* acts immiditally if isWritePacket, otherwise adds it to the readCache to be processed next tick
*/
public void processOrCachePacket(Packet par1Packet)
{
if (par1Packet.canProcessAsync() && this.myNetHandler.canProcessPacketsAsync())
{
par1Packet.processPacket(this.myNetHandler);
}
else
{
this.readPacketCache.add(par1Packet);
}
}
示例2: readPacket
import net.minecraft.network.packet.Packet; //導入方法依賴的package包/類
/**
* Reads a single packet from the input stream and adds it to the read queue. If no packet is read, it shuts down
* the network.
*/
private boolean readPacket()
{
boolean flag = false;
try
{
Packet packet = Packet.readPacket(this.tcpConLogAgent, this.socketInputStream, this.theNetHandler.isServerHandler(), this.networkSocket);
if (packet != null)
{
if (packet instanceof Packet252SharedKey && !this.isInputBeingDecrypted)
{
if (this.theNetHandler.isServerHandler())
{
this.sharedKeyForEncryption = ((Packet252SharedKey)packet).getSharedKey(this.field_74463_A);
}
this.decryptInputStream();
}
int[] aint = field_74470_c;
int i = packet.getPacketId();
aint[i] += packet.getPacketSize() + 1;
if (!this.isServerTerminating)
{
if (packet.canProcessAsync() && this.theNetHandler.canProcessPacketsAsync())
{
this.field_74490_x = 0;
packet.processPacket(this.theNetHandler);
}
else
{
this.readPackets.add(packet);
}
}
flag = true;
}
else
{
this.networkShutdown("disconnect.endOfStream", new Object[0]);
}
return flag;
}
catch (Exception exception)
{
if (!this.isTerminating)
{
this.onNetworkError(exception);
}
return false;
}
}