Java 类net.minecraft.network.packet.NetHandler 实例源码

项目:PeripheralsPlusPlus    文件:ModuleMystcraft.java   
@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);
}
项目:forge_world_downloader    文件:WDLConnectionHandler.java   
@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));
        }
    }
}
项目:RuneCraftery    文件:EntitySpawnPacket.java   
@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);
}
项目:RuneCraftery    文件:ModIdMapPacket.java   
@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)
    {
    }
}
项目:WirelessRedstone-Addons    文件:PowerDirectorClientProxy.java   
/**
 * 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;
}
项目:WirelessRedstone-Addons    文件:CamouClientProxy.java   
/**
 * 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;
}
项目:RuneCraftery    文件:ForgeConnectionHandler.java   
@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);
    }
}
项目:RuneCraftery    文件:TcpConnection.java   
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();
}
项目:RuneCraftery    文件:TcpConnection.java   
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();
}
项目:RuneCraftery    文件:ForgeConnectionHandler.java   
@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);
    }
}
项目:RuneCraftery    文件:FMLClientHandler.java   
@Override
public void handleTinyPacket(NetHandler handler, Packet131MapData mapData)
{
    ((NetClientHandler)handler).fmlPacket131Callback(mapData);
}
项目:MC-MineAPI.Java    文件:CustomConnectionHandler.java   
@Override
public void connectionOpened(NetHandler netClientHandler, String server, int port, INetworkManager manager)
{
}
项目:RuneCraftery    文件:Packet29DestroyEntity.java   
public void func_73279_a(NetHandler p_73279_1_) {
   p_73279_1_.func_72491_a(this);
}
项目:WirelessRedstone-Addons    文件:WRemoteCommonProxy.java   
@Override
public World getWorld(NetHandler handler) {
    return null;
}
项目:RuneCraftery    文件:Packet103SetSlot.java   
public void func_73279_a(NetHandler p_73279_1_) {
   p_73279_1_.func_72490_a(this);
}
项目:RuneCraftery    文件:Packet61DoorChange.java   
public void func_73279_a(NetHandler p_73279_1_) {
   p_73279_1_.func_72462_a(this);
}
项目:RuneCraftery    文件:ForgeTinyPacketHandler.java   
@Override
public void handle(NetHandler handler, Packet131MapData mapData)
{

}
项目:RuneCraftery    文件:Packet23VehicleSpawn.java   
public void func_73279_a(NetHandler p_73279_1_) {
   p_73279_1_.func_72511_a(this);
}
项目:WikiLink    文件:ConnectionHandler.java   
@Override
public void clientLoggedIn(NetHandler clientHandler, INetworkManager manager, Packet1Login login)
{
}
项目:RuneCraftery    文件:TcpConnection.java   
/**
 * Sets the NetHandler for this NetworkManager. Server-only.
 */
public void setNetHandler(NetHandler par1NetHandler)
{
    this.theNetHandler = par1NetHandler;
}
项目:RuneCraftery    文件:ModLoaderConnectionHandler.java   
@Override
public void clientLoggedIn(NetHandler nh, INetworkManager manager, Packet1Login login)
{
    mod.serverConnect(nh);
}
项目:RuneCraftery    文件:ForgeTinyPacketHandler.java   
@Override
public void handle(NetHandler handler, Packet131MapData mapData)
{

}
项目:RuneCraftery    文件:Packet254ServerPing.java   
public void func_73279_a(NetHandler p_73279_1_) {
   p_73279_1_.func_72467_a(this);
}
项目:RuneCraftery    文件:Packet255KickDisconnect.java   
public void func_73279_a(NetHandler p_73279_1_) {
   p_73279_1_.func_72492_a(this);
}
项目:RuneCraftery    文件:Packet53BlockChange.java   
public void func_73279_a(NetHandler p_73279_1_) {
   p_73279_1_.func_72456_a(this);
}
项目:RuneCraftery    文件:Packet105UpdateProgressbar.java   
public void func_73279_a(NetHandler p_73279_1_) {
   p_73279_1_.func_72505_a(this);
}
项目:Chisel    文件:TinyChiselPacketHandler.java   
@Override
public void handle(NetHandler handler, Packet131MapData mapData) {
    if (handler instanceof NetServerHandler)
        ChiselEventHandler.place(handler.getPlayer(),
                handler.getPlayer().worldObj);
}
项目:RuneCraftery    文件:Packet107CreativeSetSlot.java   
public void func_73279_a(NetHandler p_73279_1_) {
   p_73279_1_.func_72464_a(this);
}
项目:RuneCraftery    文件:MemoryConnection.java   
/**
 * Sets the NetHandler for this NetworkManager. Server-only.
 */
public void setNetHandler(NetHandler par1NetHandler)
{
    this.myNetHandler = par1NetHandler;
}
项目:forge_world_downloader    文件:WDLConnectionHandler.java   
@Override
public void clientLoggedIn(NetHandler clientHandler, INetworkManager manager,
        Packet1Login login)
{
}
项目:RuneCraftery    文件:ModListRequestPacket.java   
/**
 *
 * This packet is executed on the client to evaluate the server's mod list against
 * the client
 *
 * @see cpw.mods.fml.common.network.FMLPacket#execute(INetworkManager, FMLNetworkHandler, NetHandler, String)
 */
@Override
public void execute(INetworkManager mgr, FMLNetworkHandler handler, NetHandler netHandler, String userName)
{
    List<String> missingMods = Lists.newArrayList();
    Map<String,String> modVersions = Maps.newHashMap();
    Map<String, ModContainer> indexedModList = Maps.newHashMap(Loader.instance().getIndexedModList());

    for (String m : sentModList)
    {
        ModContainer mc = indexedModList.get(m);
        if (mc == null)
        {
            missingMods.add(m);
            continue;
        }
        indexedModList.remove(m);
        modVersions.put(m, mc.getVersion());
    }

    if (indexedModList.size()>0)
    {
        for (Entry<String, ModContainer> e : indexedModList.entrySet())
        {
            if (e.getValue().isNetworkMod())
            {
                NetworkModHandler missingHandler = FMLNetworkHandler.instance().findNetworkModHandler(e.getValue());
                if (missingHandler.requiresServerSide())
                {
                    // TODO : what should we do if a mod is marked "serverSideRequired"? Stop the connection?
                    FMLLog.warning("The mod %s was not found on the server you connected to, but requested that the server side be present", e.getKey());
                }
            }
        }
    }

    FMLLog.fine("The server has compatibility level %d", compatibilityLevel);
    FMLCommonHandler.instance().getSidedDelegate().setClientCompatibilityLevel(compatibilityLevel);

    mgr.addToSendQueue(PacketDispatcher.getPacket("FML", FMLPacket.makePacket(MOD_LIST_RESPONSE, modVersions, missingMods)));
}
项目:RuneCraftery    文件:Packet63WorldParticles.java   
public void func_73279_a(NetHandler p_73279_1_) {
   p_73279_1_.func_98182_a(this);
}
项目:RuneCraftery    文件:Packet206SetObjective.java   
public void func_73279_a(NetHandler p_73279_1_) {
   p_73279_1_.func_96436_a(this);
}
项目:RuneCraftery    文件:ForgeConnectionHandler.java   
@Override
public void connectionOpened(NetHandler netClientHandler, String server, int port, INetworkManager manager)
{

}
项目:RuneCraftery    文件:FMLCommonHandler.java   
public void disconnectIDMismatch(MapDifference<Integer, ItemData> serverDifference, NetHandler toKill, INetworkManager network)
{
    sidedDelegate.disconnectIDMismatch(serverDifference, toKill, network);
}
项目:RuneCraftery    文件:FMLServerHandler.java   
@Override
public void disconnectIDMismatch(MapDifference<Integer, ItemData> s, NetHandler handler, INetworkManager mgr)
{

}
项目:RuneCraftery    文件:EntitySpawnAdjustmentPacket.java   
@Override
public void execute(INetworkManager network, FMLNetworkHandler handler, NetHandler netHandler, String userName)
{
    FMLCommonHandler.instance().adjustEntityLocationOnClient(this);
}
项目:RuneCraftery    文件:ModMissingPacket.java   
@Override
public void execute(INetworkManager network, FMLNetworkHandler handler, NetHandler netHandler, String userName)
{
    FMLCommonHandler.instance().getSidedDelegate().displayMissingMods(this);
}
项目:RuneCraftery    文件:Packet7UseEntity.java   
public void func_73279_a(NetHandler p_73279_1_) {
   p_73279_1_.func_72507_a(this);
}