當前位置: 首頁>>代碼示例>>Java>>正文


Java NetworkManager類代碼示例

本文整理匯總了Java中net.minecraft.network.NetworkManager的典型用法代碼示例。如果您正苦於以下問題:Java NetworkManager類的具體用法?Java NetworkManager怎麽用?Java NetworkManager使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


NetworkManager類屬於net.minecraft.network包,在下文中一共展示了NetworkManager類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: clearPendingNetworks

import net.minecraft.network.NetworkManager; //導入依賴的package包/類
public void clearPendingNetworks()
{
    synchronized (this.pingDestinations)
    {
        Iterator<NetworkManager> iterator = this.pingDestinations.iterator();

        while (iterator.hasNext())
        {
            NetworkManager networkmanager = (NetworkManager)iterator.next();

            if (networkmanager.isChannelOpen())
            {
                iterator.remove();
                networkmanager.closeChannel(new TextComponentString("Cancelled"));
            }
        }
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:19,代碼來源:ServerPinger.java

示例2: pingPendingNetworks

import net.minecraft.network.NetworkManager; //導入依賴的package包/類
public void pingPendingNetworks()
{
    synchronized (this.pingDestinations)
    {
        Iterator<NetworkManager> iterator = this.pingDestinations.iterator();

        while (iterator.hasNext())
        {
            NetworkManager networkmanager = (NetworkManager)iterator.next();

            if (networkmanager.isChannelOpen())
            {
                networkmanager.processReceivedPackets();
            }
            else
            {
                iterator.remove();
                networkmanager.checkDisconnected();
            }
        }
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:23,代碼來源:OldServerPinger.java

示例3: clearPendingNetworks

import net.minecraft.network.NetworkManager; //導入依賴的package包/類
public void clearPendingNetworks()
{
    synchronized (this.pingDestinations)
    {
        Iterator<NetworkManager> iterator = this.pingDestinations.iterator();

        while (iterator.hasNext())
        {
            NetworkManager networkmanager = (NetworkManager)iterator.next();

            if (networkmanager.isChannelOpen())
            {
                iterator.remove();
                networkmanager.closeChannel(new ChatComponentText("Cancelled"));
            }
        }
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:19,代碼來源:OldServerPinger.java

示例4: removeAll

import net.minecraft.network.NetworkManager; //導入依賴的package包/類
public void removeAll()
{
    synchronized (this.connections)
    {
        Iterator<NetworkManager> iterator = this.connections.iterator();

        while (iterator.hasNext())
        {
            NetworkManager networkmanager = (NetworkManager)iterator.next();

            if (networkmanager.isChannelOpen())
            {
                iterator.remove();
                networkmanager.closeChannel(new ChatComponentText("Cancelled"));
            }
        }
    }
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:19,代碼來源:RealmsServerStatusPinger.java

示例5: tick

import net.minecraft.network.NetworkManager; //導入依賴的package包/類
public void tick()
{
    synchronized (this.connections)
    {
        Iterator<NetworkManager> iterator = this.connections.iterator();

        while (iterator.hasNext())
        {
            NetworkManager networkmanager = (NetworkManager)iterator.next();

            if (networkmanager.isChannelOpen())
            {
                networkmanager.processReceivedPackets();
            }
            else
            {
                iterator.remove();
                networkmanager.checkDisconnected();
            }
        }
    }
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:23,代碼來源:RealmsServerStatusPinger.java

示例6: initializeFakePlayer

import net.minecraft.network.NetworkManager; //導入依賴的package包/類
private void initializeFakePlayer() {
    fakePlayer = new DroneFakePlayer(
            (WorldServer) world,
            new GameProfile(UUID.fromString(getOwnerUUID()), playerName),
            this);
    fakePlayer.connection = new NetHandlerPlayServer(FMLCommonHandler.instance().getMinecraftServerInstance(), new NetworkManager(EnumPacketDirection.SERVERBOUND), fakePlayer);
    fakePlayer.inventory = new InventoryFakePlayer(fakePlayer);
}
 
開發者ID:TeamPneumatic,項目名稱:pnc-repressurized,代碼行數:9,代碼來源:EntityDrone.java

示例7: onDataPacket

import net.minecraft.network.NetworkManager; //導入依賴的package包/類
@Override
public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity pkt)
{
    onChunkUnload();
    readFromNBT(pkt.getNbtCompound());
    onLoad();
}
 
開發者ID:iChun,項目名稱:GeneralLaymansAestheticSpyingScreen,代碼行數:8,代碼來源:TileEntityGlassBase.java

示例8: NetHandlerPlayClient

import net.minecraft.network.NetworkManager; //導入依賴的package包/類
public NetHandlerPlayClient(Minecraft mcIn, GuiScreen p_i46300_2_, NetworkManager networkManagerIn, GameProfile profileIn)
{
    this.gameController = mcIn;
    this.guiScreenServer = p_i46300_2_;
    this.netManager = networkManagerIn;
    this.profile = profileIn;
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:8,代碼來源:NetHandlerPlayClient.java

示例9: GuiProgressDisconnected

import net.minecraft.network.NetworkManager; //導入依賴的package包/類
public GuiProgressDisconnected(GuiScreen screen, String reasonLocalizationKey, ITextComponent chatComp, NetworkManager lastNetworkManager)
{
    this.parentScreen = screen;
    this.ourReason = I18n.format(reasonLocalizationKey);
    this.ourMessage = chatComp;
    this.lastNetworkManager = lastNetworkManager;
    this.lastConnectAttempt = System.currentTimeMillis();
    if (lastNetworkManager != null)
    {
        InetSocketAddress address = (InetSocketAddress) lastNetworkManager.getRemoteAddress();
        ip = address.getHostName() + ":" + address.getPort();
    }
}
 
開發者ID:CreeperHost,項目名稱:CreeperHostGui,代碼行數:14,代碼來源:GuiProgressDisconnected.java

示例10: decode

import net.minecraft.network.NetworkManager; //導入依賴的package包/類
protected void decode(ChannelHandlerContext p_decode_1_, ByteBuf p_decode_2_, List<Object> p_decode_3_) throws IOException, InstantiationException, IllegalAccessException, Exception
{
    if (p_decode_2_.readableBytes() != 0)
    {
        PacketBuffer packetbuffer = new PacketBuffer(p_decode_2_);
        int i = packetbuffer.readVarIntFromBuffer();
        Packet packet = ((EnumConnectionState)p_decode_1_.channel().attr(NetworkManager.attrKeyConnectionState).get()).getPacket(this.direction, i);

        if (packet == null)
        {
            throw new IOException("Bad packet id " + i);
        }
        else
        {
            packet.readPacketData(packetbuffer);

            if (packetbuffer.readableBytes() > 0)
            {
                throw new IOException("Packet " + ((EnumConnectionState)p_decode_1_.channel().attr(NetworkManager.attrKeyConnectionState).get()).getId() + "/" + i + " (" + packet.getClass().getSimpleName() + ") was larger than I expected, found " + packetbuffer.readableBytes() + " bytes extra whilst reading packet " + i);
            }
            else
            {
                p_decode_3_.add(packet);

                if (logger.isDebugEnabled())
                {
                    logger.debug(RECEIVED_PACKET_MARKER, " IN: [{}:{}] {}", new Object[] {p_decode_1_.channel().attr(NetworkManager.attrKeyConnectionState).get(), Integer.valueOf(i), packet.getClass().getName()});
                }
            }
        }
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:33,代碼來源:MessageDeserializer.java

示例11: sendPacket

import net.minecraft.network.NetworkManager; //導入依賴的package包/類
@Override
public void sendPacket(Packet packet, PlayerConnection connection) {
    if(connection instanceof NetworkManager) {
        ((NetworkManager)connection).sendPacket((net.minecraft.network.Packet)packet);
    } else if(connection instanceof NetHandlerPlayServer) {
        ((NetHandlerPlayServer)connection).sendPacket((net.minecraft.network.Packet)packet);
    } else {
        sendPacket(packet, connection.getPlayer());
    }
}
 
開發者ID:Guichaguri,項目名稱:PacketControl,代碼行數:11,代碼來源:PacketControlService.java

示例12: onDataPacket

import net.minecraft.network.NetworkManager; //導入依賴的package包/類
@Override
@SideOnly(Side.CLIENT)
public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity pkt)
{
    super.onDataPacket(net, pkt);
    setOpened(pkt.getNbtCompound().getBoolean("opened"));
}
 
開發者ID:PearXTeam,項目名稱:PurificatiMagicae,代碼行數:8,代碼來源:TileCodeStorage.java

示例13: NetHandlerPlayClient

import net.minecraft.network.NetworkManager; //導入依賴的package包/類
public NetHandlerPlayClient(Minecraft mcIn, GuiScreen p_i46300_2_, NetworkManager p_i46300_3_, GameProfile p_i46300_4_)
{
    this.gameController = mcIn;
    this.guiScreenServer = p_i46300_2_;
    this.netManager = p_i46300_3_;
    this.profile = p_i46300_4_;
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:8,代碼來源:NetHandlerPlayClient.java

示例14: encode

import net.minecraft.network.NetworkManager; //導入依賴的package包/類
protected void encode(ChannelHandlerContext p_encode_1_, Packet p_encode_2_, ByteBuf p_encode_3_) throws IOException, Exception
{
    Integer integer = ((EnumConnectionState)p_encode_1_.channel().attr(NetworkManager.attrKeyConnectionState).get()).getPacketId(this.direction, p_encode_2_);

    if (logger.isDebugEnabled())
    {
        logger.debug(RECEIVED_PACKET_MARKER, "OUT: [{}:{}] {}", new Object[] {p_encode_1_.channel().attr(NetworkManager.attrKeyConnectionState).get(), integer, p_encode_2_.getClass().getName()});
    }

    if (integer == null)
    {
        throw new IOException("Can\'t serialize unregistered packet");
    }
    else
    {
        PacketBuffer packetbuffer = new PacketBuffer(p_encode_3_);
        packetbuffer.writeVarIntToBuffer(integer.intValue());

        try
        {
            p_encode_2_.writePacketData(packetbuffer);
        }
        catch (Throwable throwable)
        {
            logger.error((Object)throwable);
        }
    }
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:29,代碼來源:MessageSerializer.java

示例15: NetHandlerPlayClient

import net.minecraft.network.NetworkManager; //導入依賴的package包/類
public NetHandlerPlayClient(Minecraft mcIn, GuiScreen p_i46300_2_, NetworkManager p_i46300_3_,
		GameProfile p_i46300_4_) {
	this.gameController = mcIn;
	this.guiScreenServer = p_i46300_2_;
	this.netManager = p_i46300_3_;
	this.profile = p_i46300_4_;
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:8,代碼來源:NetHandlerPlayClient.java


注:本文中的net.minecraft.network.NetworkManager類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。