当前位置: 首页>>代码示例>>Java>>正文


Java Packet.canProcessAsync方法代码示例

本文整理汇总了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);
    }
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:15,代码来源:MemoryConnection.java

示例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;
    }
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:61,代码来源:TcpConnection.java


注:本文中的net.minecraft.network.packet.Packet.canProcessAsync方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。