Java 类net.minecraft.network.TcpConnection 实例源码

项目: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    文件:TcpReaderThread.java   
public void run() {
   TcpConnection.field_74471_a.getAndIncrement();

   try {
      while(TcpConnection.func_74462_a(this.field_74498_a) && !TcpConnection.func_74449_b(this.field_74498_a)) {
         while(true) {
            if(!TcpConnection.func_74450_c(this.field_74498_a)) {
               try {
                  sleep(2L);
               } catch (InterruptedException var5) {
                  ;
               }
            }
         }
      }
   } finally {
      TcpConnection.field_74471_a.getAndDecrement();
   }

}
项目:RuneCraftery    文件:TcpMasterThread.java   
public void run() {
   try {
      Thread.sleep(5000L);
      if(TcpConnection.func_74457_g(this.field_74504_a).isAlive()) {
         try {
            TcpConnection.func_74457_g(this.field_74504_a).stop();
         } catch (Throwable var3) {
            ;
         }
      }

      if(TcpConnection.func_74461_h(this.field_74504_a).isAlive()) {
         try {
            TcpConnection.func_74461_h(this.field_74504_a).stop();
         } catch (Throwable var2) {
            ;
         }
      }
   } catch (InterruptedException var4) {
      var4.printStackTrace();
   }

}
项目:RuneCraftery    文件:StatsComponent.java   
private void func_120034_a() {
   long var1 = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory();
   System.gc();
   this.field_120036_d[0] = "Memory use: " + var1 / 1024L / 1024L + " mb (" + Runtime.getRuntime().freeMemory() * 100L / Runtime.getRuntime().maxMemory() + "% free)";
   this.field_120036_d[1] = "Threads: " + TcpConnection.field_74471_a.get() + " + " + TcpConnection.field_74469_b.get();
   this.field_120036_d[2] = "Avg tick: " + field_120040_a.format(this.func_120035_a(this.field_120037_e.field_71311_j) * 1.0E-6D) + " ms";
   this.field_120036_d[3] = "Avg sent: " + (int)this.func_120035_a(this.field_120037_e.field_71300_f) + ", Avg size: " + (int)this.func_120035_a(this.field_120037_e.field_71301_g);
   this.field_120036_d[4] = "Avg rec: " + (int)this.func_120035_a(this.field_120037_e.field_71313_h) + ", Avg size: " + (int)this.func_120035_a(this.field_120037_e.field_71314_i);
   if(this.field_120037_e.field_71305_c != null) {
      for(int var3 = 0; var3 < this.field_120037_e.field_71305_c.length; ++var3) {
         this.field_120036_d[5 + var3] = "Lvl " + var3 + " tick: " + field_120040_a.format(this.func_120035_a(this.field_120037_e.field_71312_k[var3]) * 1.0E-6D) + " ms";
         if(this.field_120037_e.field_71305_c[var3] != null && this.field_120037_e.field_71305_c[var3].field_73059_b != null) {
            this.field_120036_d[5 + var3] = this.field_120036_d[5 + var3] + ", " + this.field_120037_e.field_71305_c[var3].field_73059_b.func_73148_d();
            this.field_120036_d[5 + var3] = this.field_120036_d[5 + var3] + ", Vec3: " + this.field_120037_e.field_71305_c[var3].func_82732_R().func_82590_d() + " / " + this.field_120037_e.field_71305_c[var3].func_82732_R().func_82591_c();
         }
      }
   }

   double var5 = 12500.0D;
   this.field_120038_b[this.field_120039_c++ & 255] = (int)(this.func_120035_a(this.field_120037_e.field_71301_g) * 100.0D / 12500.0D);
   this.repaint();
}
项目:RuneCraftery    文件:TcpWriterThread.java   
public void run() {
   TcpConnection.field_74469_b.getAndIncrement();

   try {
      while(TcpConnection.func_74462_a(this.field_74501_a)) {
         boolean var1;
         for(var1 = false; TcpConnection.func_74451_d(this.field_74501_a); var1 = true) {
            ;
         }

         try {
            if(var1 && TcpConnection.func_74453_e(this.field_74501_a) != null) {
               TcpConnection.func_74453_e(this.field_74501_a).flush();
            }
         } catch (IOException var8) {
            if(!TcpConnection.func_74456_f(this.field_74501_a)) {
               TcpConnection.func_74458_a(this.field_74501_a, var8);
            }

            var8.printStackTrace();
         }

         try {
            sleep(2L);
         } catch (InterruptedException var7) {
            ;
         }
      }
   } finally {
      TcpConnection.field_74469_b.getAndDecrement();
   }

}
项目:RuneCraftery    文件:TcpMonitorThread.java   
public void run() {
   try {
      Thread.sleep(2000L);
      if(TcpConnection.func_74462_a(this.field_74417_a)) {
         TcpConnection.func_74461_h(this.field_74417_a).interrupt();
         this.field_74417_a.func_74424_a("disconnect.closed", new Object[0]);
      }
   } catch (Exception var2) {
      var2.printStackTrace();
   }

}
项目:RuneCraftery    文件:NetClientHandler.java   
public NetClientHandler(Minecraft par1Minecraft, String par2Str, int par3) throws IOException
{
    this.mc = par1Minecraft;
    Socket socket = new Socket(InetAddress.getByName(par2Str), par3);
    this.netManager = new TcpConnection(par1Minecraft.getLogAgent(), socket, "Client", this);
    FMLNetworkHandler.onClientConnectionToRemoteServer(this, par2Str, par3, this.netManager);
}
项目:RuneCraftery    文件:NetClientHandler.java   
public NetClientHandler(Minecraft par1Minecraft, String par2Str, int par3, GuiScreen par4GuiScreen) throws IOException
{
    this.mc = par1Minecraft;
    this.field_98183_l = par4GuiScreen;
    Socket socket = new Socket(InetAddress.getByName(par2Str), par3);
    this.netManager = new TcpConnection(par1Minecraft.getLogAgent(), socket, "Client", this);
    FMLNetworkHandler.onClientConnectionToRemoteServer(this, par2Str, par3, this.netManager);
}
项目:RuneCraftery    文件:StatsComponent.java   
private void func_120034_a()
{
    this.field_120036_d = new String[5 + DimensionManager.getIDs().length];
    long i = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory();
    System.gc();
    this.field_120036_d[0] = "Memory use: " + i / 1024L / 1024L + " mb (" + Runtime.getRuntime().freeMemory() * 100L / Runtime.getRuntime().maxMemory() + "% free)";
    this.field_120036_d[1] = "Threads: " + TcpConnection.field_74471_a.get() + " + " + TcpConnection.field_74469_b.get();
    this.field_120036_d[2] = "Avg tick: " + field_120040_a.format(this.func_120035_a(this.field_120037_e.tickTimeArray) * 1.0E-6D) + " ms";
    this.field_120036_d[3] = "Avg sent: " + (int)this.func_120035_a(this.field_120037_e.sentPacketCountArray) + ", Avg size: " + (int)this.func_120035_a(this.field_120037_e.sentPacketSizeArray);
    this.field_120036_d[4] = "Avg rec: " + (int)this.func_120035_a(this.field_120037_e.receivedPacketCountArray) + ", Avg size: " + (int)this.func_120035_a(this.field_120037_e.receivedPacketSizeArray);

    if (this.field_120037_e.worldServers != null)
    {
        int j = 0;
        for (Integer id : DimensionManager.getIDs())
        {
            this.field_120036_d[5 + j] = "Lvl " + id + " tick: " + field_120040_a.format(this.func_120035_a(this.field_120037_e.worldTickTimes.get(id)) * 1.0E-6D) + " ms";

            WorldServer world = DimensionManager.getWorld(id);
            if (world != null && world.theChunkProviderServer != null)
            {
                this.field_120036_d[5 + j] = this.field_120036_d[5 + j] + ", " + world.theChunkProviderServer.makeString();
                this.field_120036_d[5 + j] = this.field_120036_d[5 + j] + ", Vec3: " + world.getWorldVec3Pool().func_82590_d() + " / " + world.getWorldVec3Pool().getPoolSize();
            }
            j++;
        }
    }

    double d0 = 12500.0D;
    this.field_120038_b[this.field_120039_c++ & 255] = (int)(this.func_120035_a(this.field_120037_e.sentPacketSizeArray) * 100.0D / 12500.0D);
    this.repaint();
}
项目:BetterNutritionMod    文件:NetClientHandler.java   
public NetClientHandler(Minecraft par1Minecraft, String par2Str, int par3) throws IOException
{
    this.mc = par1Minecraft;
    Socket socket = new Socket(InetAddress.getByName(par2Str), par3);
    this.netManager = new TcpConnection(par1Minecraft.getLogAgent(), socket, "Client", this);
    FMLNetworkHandler.onClientConnectionToRemoteServer(this, par2Str, par3, this.netManager);
}
项目:BetterNutritionMod    文件:NetClientHandler.java   
public NetClientHandler(Minecraft par1Minecraft, String par2Str, int par3, GuiScreen par4GuiScreen) throws IOException
{
    this.mc = par1Minecraft;
    this.field_98183_l = par4GuiScreen;
    Socket socket = new Socket(InetAddress.getByName(par2Str), par3);
    this.netManager = new TcpConnection(par1Minecraft.getLogAgent(), socket, "Client", this);
    FMLNetworkHandler.onClientConnectionToRemoteServer(this, par2Str, par3, this.netManager);
}
项目:BetterNutritionMod    文件:StatsComponent.java   
private void func_120034_a()
{
    this.field_120036_d = new String[5 + DimensionManager.getIDs().length];
    long i = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory();
    System.gc();
    this.field_120036_d[0] = "Memory use: " + i / 1024L / 1024L + " mb (" + Runtime.getRuntime().freeMemory() * 100L / Runtime.getRuntime().maxMemory() + "% free)";
    this.field_120036_d[1] = "Threads: " + TcpConnection.field_74471_a.get() + " + " + TcpConnection.field_74469_b.get();
    this.field_120036_d[2] = "Avg tick: " + field_120040_a.format(this.func_120035_a(this.field_120037_e.tickTimeArray) * 1.0E-6D) + " ms";
    this.field_120036_d[3] = "Avg sent: " + (int)this.func_120035_a(this.field_120037_e.sentPacketCountArray) + ", Avg size: " + (int)this.func_120035_a(this.field_120037_e.sentPacketSizeArray);
    this.field_120036_d[4] = "Avg rec: " + (int)this.func_120035_a(this.field_120037_e.receivedPacketCountArray) + ", Avg size: " + (int)this.func_120035_a(this.field_120037_e.receivedPacketSizeArray);

    if (this.field_120037_e.worldServers != null)
    {
        int j = 0;
        for (Integer id : DimensionManager.getIDs())
        {
            this.field_120036_d[5 + j] = "Lvl " + id + " tick: " + field_120040_a.format(this.func_120035_a(this.field_120037_e.worldTickTimes.get(id)) * 1.0E-6D) + " ms";

            WorldServer world = DimensionManager.getWorld(id);
            if (world != null && world.theChunkProviderServer != null)
            {
                this.field_120036_d[5 + j] = this.field_120036_d[5 + j] + ", " + world.theChunkProviderServer.makeString();
                this.field_120036_d[5 + j] = this.field_120036_d[5 + j] + ", Vec3: " + world.getWorldVec3Pool().func_82590_d() + " / " + world.getWorldVec3Pool().getPoolSize();
            }
            j++;
        }
    }

    double d0 = 12500.0D;
    this.field_120038_b[this.field_120039_c++ & 255] = (int)(this.func_120035_a(this.field_120037_e.sentPacketSizeArray) * 100.0D / 12500.0D);
    this.repaint();
}
项目:secri    文件:ConnectionHandler.java   
@Override
public void connectionClosed(INetworkManager manager) {
    if (manager instanceof TcpConnection) {
        TcpConnection tcpConnection = (TcpConnection) manager;
        Field f = tcpConnection.getClass().getDeclaredFields()[13];
        f.setAccessible(true);
        NetHandler netHandler = null;
        try {
            netHandler = (NetHandler) f.get(tcpConnection);
            MaemeStorage.onPlayerDC(netHandler.getPlayer());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
项目:RuneCraftery    文件:TcpWriterThread.java   
TcpWriterThread(TcpConnection p_i1394_1_, String p_i1394_2_) {
   super(p_i1394_2_);
   this.field_74501_a = p_i1394_1_;
}
项目:RuneCraftery    文件:TcpMonitorThread.java   
TcpMonitorThread(TcpConnection p_i1396_1_) {
   this.field_74417_a = p_i1396_1_;
}
项目:RuneCraftery    文件:TcpReaderThread.java   
TcpReaderThread(TcpConnection p_i1393_1_, String p_i1393_2_) {
   super(p_i1393_2_);
   this.field_74498_a = p_i1393_1_;
}
项目:RuneCraftery    文件:NetLoginHandler.java   
public NetLoginHandler(MinecraftServer p_i1527_1_, Socket p_i1527_2_, String p_i1527_3_) throws IOException {
   this.field_72534_f = p_i1527_1_;
   this.field_72538_b = new TcpConnection(p_i1527_1_.func_98033_al(), p_i1527_2_, p_i1527_3_, this, p_i1527_1_.func_71250_E().getPrivate());
   this.field_72538_b.field_74468_e = 0;
}
项目:RuneCraftery    文件:TcpMasterThread.java   
TcpMasterThread(TcpConnection p_i1395_1_) {
   this.field_74504_a = p_i1395_1_;
}
项目:RuneCraftery    文件:NetClientHandler.java   
public NetClientHandler(Minecraft p_i1176_1_, String p_i1176_2_, int p_i1176_3_) throws IOException {
   this.field_72563_h = p_i1176_1_;
   Socket var4 = new Socket(InetAddress.getByName(p_i1176_2_), p_i1176_3_);
   this.field_72555_g = new TcpConnection(p_i1176_1_.func_98033_al(), var4, "Client", this);
}
项目:RuneCraftery    文件:NetClientHandler.java   
public NetClientHandler(Minecraft p_i1177_1_, String p_i1177_2_, int p_i1177_3_, GuiScreen p_i1177_4_) throws IOException {
   this.field_72563_h = p_i1177_1_;
   this.field_98183_l = p_i1177_4_;
   Socket var5 = new Socket(InetAddress.getByName(p_i1177_2_), p_i1177_3_);
   this.field_72555_g = new TcpConnection(p_i1177_1_.func_98033_al(), var5, "Client", this);
}