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


Java NetHandler类代码示例

本文整理汇总了Java中net.minecraft.network.packet.NetHandler的典型用法代码示例。如果您正苦于以下问题:Java NetHandler类的具体用法?Java NetHandler怎么用?Java NetHandler使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


NetHandler类属于net.minecraft.network.packet包,在下文中一共展示了NetHandler类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: handleNetworkMessage

import net.minecraft.network.packet.NetHandler; //导入依赖的package包/类
@Override
public void handleNetworkMessage(NetHandler source, boolean isClient, ByteArrayDataInput data) {
	if (isClient) return;
	
	int x = data.readInt();
	int y = data.readInt();
	int z = data.readInt();
	String sound = data.readUTF();
	
	World world = MiscPeripherals.proxy.getClientWorld();
	
	for (int i = 0; i < 50; i++) {
		MiscPeripherals.proxy.spawnSmoke(x + 0.5D + world.rand.nextFloat() - world.rand.nextFloat(), y + world.rand.nextFloat() - world.rand.nextFloat(), z + 0.5D + world.rand.nextFloat() - world.rand.nextFloat(), 0.0D, 0.0D, 0.0D);
	}
	
	world.playSoundEffect(x + 0.5D, y + 0.5D, z + 0.5D, sound, 0.8F, world.rand.nextFloat() * 0.2F + 0.9F);
}
 
开发者ID:austinv11,项目名称:PeripheralsPlusPlus,代码行数:18,代码来源:ModuleMystcraft.java

示例2: connectionOpened

import net.minecraft.network.packet.NetHandler; //导入依赖的package包/类
@Override
public void connectionOpened(NetHandler netClientHandler, String server, int port, INetworkManager manager)
{
	System.out.println("Hello !");
	if (netClientHandler instanceof NetClientHandler)
	{
		NetClientHandler nch = (NetClientHandler) netClientHandler;
		INetworkManager netmanager = nch.getNetManager();
		
		System.out.println("Hello 2 !");
		
		if (netmanager instanceof TcpConnection)
		{
			System.out.println("Hello 3 !");
			((TcpConnection) netmanager).setNetHandler(new WDLNetClientHandler(nch));
		}
	}
}
 
开发者ID:xurei,项目名称:forge_world_downloader,代码行数:19,代码来源:WDLConnectionHandler.java

示例3: execute

import net.minecraft.network.packet.NetHandler; //导入依赖的package包/类
@Override
public void execute(INetworkManager network, FMLNetworkHandler handler, NetHandler netHandler, String userName)
{
    NetworkModHandler nmh = handler.findNetworkModHandler(networkId);
    ModContainer mc = nmh.getContainer();

    EntityRegistration registration = EntityRegistry.instance().lookupModSpawn(mc, modEntityId);
    if (registration == null || registration.getEntityClass() == null)
    {
        FMLLog.log(Level.WARNING, "Missing mod entity information for %s : %d", mc.getModId(), modEntityId);
        return;
    }


    Entity entity = FMLCommonHandler.instance().spawnEntityIntoClientWorld(registration, this);
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:17,代码来源:EntitySpawnPacket.java

示例4: execute

import net.minecraft.network.packet.NetHandler; //导入依赖的package包/类
@Override
public void execute(INetworkManager network, FMLNetworkHandler handler, NetHandler netHandler, String userName)
{
    byte[] allData = Bytes.concat(partials);
    GameData.initializeServerGate(1);
    try
    {
        NBTTagCompound serverList = CompressedStreamTools.func_74792_a(allData);
        NBTTagList list = serverList.func_74761_m("List");
        Set<ItemData> itemData = GameData.buildWorldItemData(list);
        GameData.validateWorldSave(itemData);
        MapDifference<Integer, ItemData> serverDifference = GameData.gateWorldLoadingForValidation();
        if (serverDifference!=null)
        {
            FMLCommonHandler.instance().disconnectIDMismatch(serverDifference, netHandler, network);

        }
    }
    catch (IOException e)
    {
    }
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:23,代码来源:ModIdMapPacket.java

示例5: getWorld

import net.minecraft.network.packet.NetHandler; //导入依赖的package包/类
/**
 * Retrieves the world object with NetHandler parameters.
 * 
 * @return Minecraft world object.
 */
@Override
public World getWorld(NetHandler handler) {
    if (handler instanceof NetClientHandler) {
        return ((NetClientHandler) handler).getPlayer().worldObj;
    }
    return null;
}
 
开发者ID:SlimeVoid,项目名称:WirelessRedstone-Addons,代码行数:13,代码来源:PowerDirectorClientProxy.java

示例6: playerLoggedIn

import net.minecraft.network.packet.NetHandler; //导入依赖的package包/类
@Override
public void playerLoggedIn(Player player, NetHandler netHandler, INetworkManager manager)
{
    Packet250CustomPayload[] fluidPackets = ForgePacket.makePacketSet(new FluidIdMapPacket());
    for (int i = 0; i < fluidPackets.length; i++) {
        PacketDispatcher.sendPacketToPlayer(fluidPackets[i], player);
    }
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:9,代码来源:ForgeConnectionHandler.java

示例7: TcpConnection

import net.minecraft.network.packet.NetHandler; //导入依赖的package包/类
public TcpConnection(ILogAgent par1ILogAgent, Socket par2Socket, String par3Str, NetHandler par4NetHandler, PrivateKey par5PrivateKey) throws IOException
{
    this.sendQueueLock = new Object();
    this.isRunning = true;
    this.readPackets = new ConcurrentLinkedQueue();
    this.dataPackets = Collections.synchronizedList(new ArrayList());
    this.chunkDataPackets = Collections.synchronizedList(new ArrayList());
    this.terminationReason = "";
    this.chunkDataPacketsDelay = 50;
    this.field_74463_A = par5PrivateKey;
    this.networkSocket = par2Socket;
    this.tcpConLogAgent = par1ILogAgent;
    this.remoteSocketAddress = par2Socket.getRemoteSocketAddress();
    this.theNetHandler = par4NetHandler;

    try
    {
        par2Socket.setSoTimeout(30000);
        par2Socket.setTrafficClass(24);
    }
    catch (SocketException socketexception)
    {
        System.err.println(socketexception.getMessage());
    }

    this.socketInputStream = new DataInputStream(par2Socket.getInputStream());
    this.socketOutputStream = new DataOutputStream(new BufferedOutputStream(par2Socket.getOutputStream(), 5120));
    this.readThread = new TcpReaderThread(this, par3Str + " read thread");
    this.writeThread = new TcpWriterThread(this, par3Str + " write thread");
    this.readThread.start();
    this.writeThread.start();
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:33,代码来源:TcpConnection.java

示例8: TcpConnection

import net.minecraft.network.packet.NetHandler; //导入依赖的package包/类
public TcpConnection(ILogAgent p_i1398_1_, Socket p_i1398_2_, String p_i1398_3_, NetHandler p_i1398_4_, PrivateKey p_i1398_5_) throws IOException {
   this.field_74478_h = new Object();
   this.field_74475_m = true;
   this.field_74473_o = new ConcurrentLinkedQueue();
   this.field_74487_p = Collections.synchronizedList(new ArrayList());
   this.field_74486_q = Collections.synchronizedList(new ArrayList());
   this.field_74481_v = "";
   this.field_74464_B = 50;
   this.field_74463_A = p_i1398_5_;
   this.field_74479_i = p_i1398_2_;
   this.field_98215_i = p_i1398_1_;
   this.field_74476_j = p_i1398_2_.getRemoteSocketAddress();
   this.field_74485_r = p_i1398_4_;

   try {
      p_i1398_2_.setSoTimeout(30000);
      p_i1398_2_.setTrafficClass(24);
   } catch (SocketException var7) {
      System.err.println(var7.getMessage());
   }

   this.field_74477_k = new DataInputStream(p_i1398_2_.getInputStream());
   this.field_74474_l = new DataOutputStream(new BufferedOutputStream(p_i1398_2_.getOutputStream(), 5120));
   this.field_74482_u = new TcpReaderThread(this, p_i1398_3_ + " read thread");
   this.field_74483_t = new TcpWriterThread(this, p_i1398_3_ + " write thread");
   this.field_74482_u.start();
   this.field_74483_t.start();
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:29,代码来源:TcpConnection.java

示例9: handleTinyPacket

import net.minecraft.network.packet.NetHandler; //导入依赖的package包/类
@Override
public void handleTinyPacket(NetHandler handler, Packet131MapData mapData)
{
    ((NetClientHandler)handler).fmlPacket131Callback(mapData);
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:6,代码来源:FMLClientHandler.java

示例10: connectionOpened

import net.minecraft.network.packet.NetHandler; //导入依赖的package包/类
@Override
public void connectionOpened(NetHandler netClientHandler, String server, int port, INetworkManager manager)
{
}
 
开发者ID:Maxwolf,项目名称:MC-MineAPI.Java,代码行数:5,代码来源:CustomConnectionHandler.java

示例11: clientLoggedIn

import net.minecraft.network.packet.NetHandler; //导入依赖的package包/类
@SuppressWarnings("unused")
@Override
public void clientLoggedIn(NetHandler clientHandler, INetworkManager manager, Packet1Login login)
{
    if (hasSeenMessage == false)
    {
        if (FMLCommonHandler.instance().getSide().isClient())
        {
            Minecraft mc = FMLClientHandler.instance().getClient();
            int maxTries = 30;
            while (mc.thePlayer == null && maxTries > 0)
            {
                maxTries--;
            }

            if (mc.thePlayer != null && ModMetadata.VBUILD != "@[email protected]")
            {
                // Ensure both numbers are proper for comparing.
                long runningBuild = new Long( ModMetadata.VBUILD );

                // Tell the user how many builds behind they are.
                if (jenkinsLastBuild > runningBuild)
                {
                    long buildDiff = jenkinsLastBuild - runningBuild;

                    if (buildDiff > 1)
                    {
                        mc.thePlayer.addChatMessage( ModMetadata.NAME +
                                                     ": You're " +
                                                     String.valueOf( buildDiff ) +
                                                     " versions behind." );
                    }
                    else
                    {
                        mc.thePlayer.addChatMessage( ModMetadata.NAME +
                                                     ": You're " +
                                                     String.valueOf( buildDiff ) +
                                                     " version behind." );
                    }
                }
            }
        }

        hasSeenMessage = true;
    }
}
 
开发者ID:Maxwolf,项目名称:MC-MineAPI.Java,代码行数:47,代码来源:CustomConnectionHandler.java

示例12: func_73279_a

import net.minecraft.network.packet.NetHandler; //导入依赖的package包/类
public void func_73279_a(NetHandler p_73279_1_) {
   p_73279_1_.func_72491_a(this);
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:4,代码来源:Packet29DestroyEntity.java

示例13: getWorld

import net.minecraft.network.packet.NetHandler; //导入依赖的package包/类
@Override
public World getWorld(NetHandler handler) {
    return null;
}
 
开发者ID:SlimeVoid,项目名称:WirelessRedstone-Addons,代码行数:5,代码来源:WRemoteCommonProxy.java

示例14: func_73279_a

import net.minecraft.network.packet.NetHandler; //导入依赖的package包/类
public void func_73279_a(NetHandler p_73279_1_) {
   p_73279_1_.func_72490_a(this);
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:4,代码来源:Packet103SetSlot.java

示例15: func_73279_a

import net.minecraft.network.packet.NetHandler; //导入依赖的package包/类
public void func_73279_a(NetHandler p_73279_1_) {
   p_73279_1_.func_72462_a(this);
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:4,代码来源:Packet61DoorChange.java


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