@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)); } } }
@SideOnly(Side.CLIENT) public void handleClientPacket(NetClientHandler handler, short id, byte[] data) { DataInputStream stream = new DataInputStream(new ByteArrayInputStream(data)); try { switch(id) { case 0: { stream.readByte(); break; } } } catch(IOException e) { } }
/** * 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; }
public void onGuiClosed() { Keyboard.enableRepeatEvents(false); NetClientHandler netclienthandler = this.mc.getNetHandler(); if (MinecraftServer.getServer().isSinglePlayer()) { MiscHelper.setPersistentDataTag(MinecraftServer.getServer().getConfigurationManager().getPlayerForUsername(MinecraftServer.getServer().getServerOwner()), BSConstants.NBT_PLAYER_GRAVE_DATA, data); } else if (netclienthandler != null) { PacketDispatcher.sendPacketToServer(NetworkHelper.makeNBTPacket(BSConstants.CHANNEL_GRAVE_UPGRADE, data)); } }
public void handleMapChunk(Packet51MapChunk mapChunk) { if (wc == null) { wc = (WorldClient)Reflexion.stealField(NetClientHandler.class, WorldClient.class).get(nch); } if (mapChunk.includeInitialize) { if (mapChunk.yChMin == 0) { doPreChunk(mapChunk.xCh, mapChunk.zCh, false); return; } doPreChunk(mapChunk.xCh, mapChunk.zCh, true); } wc.invalidateBlockReceiveRegion(mapChunk.xCh << 4, 0, mapChunk.zCh << 4, (mapChunk.xCh << 4) + 15, 256, (mapChunk.zCh << 4) + 15); Chunk chunk = wc.getChunkFromChunkCoords(mapChunk.xCh, mapChunk.zCh); if (mapChunk.includeInitialize && chunk == null) { doPreChunk(mapChunk.xCh, mapChunk.zCh, true); chunk = wc.getChunkFromChunkCoords(mapChunk.xCh, mapChunk.zCh); } if (chunk != null) { chunk.fillChunk(mapChunk.getCompressedChunkData(), mapChunk.yChMin, mapChunk.yChMax, mapChunk.includeInitialize); wc.markBlockRangeForRenderUpdate(mapChunk.xCh << 4, 0, mapChunk.zCh << 4, (mapChunk.xCh << 4) + 15, 256, (mapChunk.zCh << 4) + 15); if (!mapChunk.includeInitialize || !(wc.provider instanceof WorldProviderSurface)) { chunk.resetRelightChecks(); } } }
@Override public void handleMapChunks(Packet56MapChunks par1Packet56MapChunks) { if (wc == null) { wc = (WorldClient)Reflexion.stealField(NetClientHandler.class, WorldClient.class).get(nch); } //nch.handleMapChunks(par1Packet56MapChunks); for (int i = 0; i < par1Packet56MapChunks.getNumberOfChunkInPacket(); ++i) { int j = par1Packet56MapChunks.getChunkPosX(i); int k = par1Packet56MapChunks.getChunkPosZ(i); doPreChunk(j, k, true); wc.invalidateBlockReceiveRegion(j << 4, 0, k << 4, (j << 4) + 15, 256, (k << 4) + 15); Chunk chunk = wc.getChunkFromChunkCoords(j, k); if (chunk == null) { doPreChunk(j, k, true); chunk = wc.getChunkFromChunkCoords(j, k); } if (chunk != null) { chunk.fillChunk(par1Packet56MapChunks.getChunkCompressedData(i), par1Packet56MapChunks.field_73590_a[i], par1Packet56MapChunks.field_73588_b[i], true); wc.markBlockRangeForRenderUpdate(j << 4, 0, k << 4, (j << 4) + 15, 256, (k << 4) + 15); if (!(wc.provider instanceof WorldProviderSurface)) { chunk.resetRelightChecks(); } } } }
@Override public void disconnectIDMismatch(MapDifference<Integer, ItemData> s, NetHandler toKill, INetworkManager mgr) { boolean criticalMismatch = !s.entriesOnlyOnLeft().isEmpty(); for (Entry<Integer, ValueDifference<ItemData>> mismatch : s.entriesDiffering().entrySet()) { ValueDifference<ItemData> vd = mismatch.getValue(); if (!vd.leftValue().mayDifferByOrdinal(vd.rightValue())) { criticalMismatch = true; } } if (!criticalMismatch) { // We'll carry on with this connection, and just log a message instead return; } // Nuke the connection ((NetClientHandler)toKill).func_72553_e(); // Stop GuiConnecting GuiConnecting.forceTermination((GuiConnecting)client.field_71462_r); // pulse the network manager queue to clear cruft mgr.func_74428_b(); // Nuke the world client client.func_71403_a((WorldClient)null); // Show error screen warnIDMismatch(s, false); }
@Override public boolean clientConnectionClosed(INetworkManager manager, BaseModProxy mod) { if (managerLookups.containsKey(manager)) { ((BaseMod)mod).clientDisconnect((NetClientHandler) managerLookups.get(manager)); return true; } return false; }
/** * Called when a client connects * @param handler */ @SideOnly(CLIENT) @Deprecated public void clientConnect(NetClientHandler handler) { }
/** * Called when the client disconnects * @param handler */ @SideOnly(CLIENT) @Deprecated public void clientDisconnect(NetClientHandler handler) { }
public WorldClient(NetClientHandler p_i1188_1_, WorldSettings p_i1188_2_, int p_i1188_3_, int p_i1188_4_, Profiler p_i1188_5_, ILogAgent p_i1188_6_) { super(new SaveHandlerMP(), "MpServer", WorldProvider.func_76570_a(p_i1188_3_), p_i1188_2_, p_i1188_5_, p_i1188_6_); this.field_73035_a = p_i1188_1_; this.field_73013_u = p_i1188_4_; this.func_72950_A(8, 64, 8); this.field_72988_C = p_i1188_1_.field_72558_b; }
public void run() { try { GuiConnecting.func_74252_a(this.field_78820_c, new NetClientHandler(GuiConnecting.func_74256_a(this.field_78820_c), this.field_78821_a, this.field_78819_b)); if(GuiConnecting.func_74257_b(this.field_78820_c)) { return; } GuiConnecting.func_74253_d(this.field_78820_c).func_72552_c(new Packet2ClientProtocol(78, GuiConnecting.func_74254_c(this.field_78820_c).func_110432_I().func_111285_a(), this.field_78821_a, this.field_78819_b)); } catch (UnknownHostException var2) { if(GuiConnecting.func_74257_b(this.field_78820_c)) { return; } GuiConnecting.func_74250_f(this.field_78820_c).func_71373_a(new GuiDisconnected(GuiConnecting.func_98097_e(this.field_78820_c), "connect.failed", "disconnect.genericReason", new Object[]{"Unknown host \'" + this.field_78821_a + "\'"})); } catch (ConnectException var3) { if(GuiConnecting.func_74257_b(this.field_78820_c)) { return; } GuiConnecting.func_74251_g(this.field_78820_c).func_71373_a(new GuiDisconnected(GuiConnecting.func_98097_e(this.field_78820_c), "connect.failed", "disconnect.genericReason", new Object[]{var3.getMessage()})); } catch (Exception var4) { if(GuiConnecting.func_74257_b(this.field_78820_c)) { return; } var4.printStackTrace(); GuiConnecting.func_98096_h(this.field_78820_c).func_71373_a(new GuiDisconnected(GuiConnecting.func_98097_e(this.field_78820_c), "connect.failed", "disconnect.genericReason", new Object[]{var4.toString()})); } }
public void func_73874_b() { Keyboard.enableRepeatEvents(false); NetClientHandler var1 = this.field_73882_e.func_71391_r(); if(var1 != null) { var1.func_72552_c(new Packet130UpdateSign(this.field_73982_c.field_70329_l, this.field_73982_c.field_70330_m, this.field_73982_c.field_70327_n, this.field_73982_c.field_70412_a)); } this.field_73982_c.func_70408_a(true); }
public void run() { try { TaskOnlineConnect.func_96583_a(this.field_96594_c, new NetClientHandler(this.field_96594_c.func_96578_b(), this.field_96595_a, this.field_96593_b, TaskOnlineConnect.func_98172_a(this.field_96594_c))); if(this.field_96594_c.func_96577_c()) { return; } this.field_96594_c.func_96576_b(I18n.func_135053_a("mco.connect.authorizing")); TaskOnlineConnect.func_96580_a(this.field_96594_c).func_72552_c(new Packet2ClientProtocol(78, this.field_96594_c.func_96578_b().func_110432_I().func_111285_a(), this.field_96595_a, this.field_96593_b)); } catch (UnknownHostException var2) { if(this.field_96594_c.func_96577_c()) { return; } this.field_96594_c.func_96578_b().func_71373_a(new GuiScreenDisconnectedOnline(TaskOnlineConnect.func_98172_a(this.field_96594_c), "connect.failed", "disconnect.genericReason", new Object[]{"Unknown host \'" + this.field_96595_a + "\'"})); } catch (ConnectException var3) { if(this.field_96594_c.func_96577_c()) { return; } this.field_96594_c.func_96578_b().func_71373_a(new GuiScreenDisconnectedOnline(TaskOnlineConnect.func_98172_a(this.field_96594_c), "connect.failed", "disconnect.genericReason", new Object[]{var3.getMessage()})); } catch (Exception var4) { if(this.field_96594_c.func_96577_c()) { return; } var4.printStackTrace(); this.field_96594_c.func_96578_b().func_71373_a(new GuiScreenDisconnectedOnline(TaskOnlineConnect.func_98172_a(this.field_96594_c), "connect.failed", "disconnect.genericReason", new Object[]{var4.toString()})); } }
@Override public void disconnectIDMismatch(MapDifference<Integer, ItemData> s, NetHandler toKill, INetworkManager mgr) { boolean criticalMismatch = !s.entriesOnlyOnLeft().isEmpty(); for (Entry<Integer, ValueDifference<ItemData>> mismatch : s.entriesDiffering().entrySet()) { ValueDifference<ItemData> vd = mismatch.getValue(); if (!vd.leftValue().mayDifferByOrdinal(vd.rightValue())) { criticalMismatch = true; } } if (!criticalMismatch) { // We'll carry on with this connection, and just log a message instead return; } // Nuke the connection ((NetClientHandler)toKill).disconnect(); // Stop GuiConnecting GuiConnecting.forceTermination((GuiConnecting)client.currentScreen); // pulse the network manager queue to clear cruft mgr.processReadPackets(); // Nuke the world client client.loadWorld((WorldClient)null); // Show error screen warnIDMismatch(s, false); }
/** * Called when the screen is unloaded. Used to disable keyboard repeat events */ public void onGuiClosed() { Keyboard.enableRepeatEvents(false); NetClientHandler netclienthandler = this.mc.getNetHandler(); if (netclienthandler != null) { netclienthandler.addToSendQueue(new Packet130UpdateSign(this.entitySign.xCoord, this.entitySign.yCoord, this.entitySign.zCoord, this.entitySign.signText)); } this.entitySign.setEditable(true); }
public void continueWorldLoading() { this.integratedServerIsRunning = true; this.loadingScreen.displayProgressMessage(I18n.getString("menu.loadingLevel")); while (!this.theIntegratedServer.serverIsInRunLoop()) { String s2 = this.theIntegratedServer.getUserMessage(); if (s2 != null) { this.loadingScreen.resetProgresAndWorkingMessage(I18n.getString(s2)); } else { this.loadingScreen.resetProgresAndWorkingMessage(""); } try { Thread.sleep(200L); } catch (InterruptedException interruptedexception) { ; } } this.displayGuiScreen((GuiScreen)null); try { NetClientHandler netclienthandler = new NetClientHandler(this, this.theIntegratedServer); this.myNetworkManager = netclienthandler.getNetManager(); } catch (IOException ioexception) { this.displayCrashReport(this.addGraphicsAndWorldToCrashReport(new CrashReport("Connecting to integrated server", ioexception))); } }
@Override public void handle(NetHandler handler, Packet131MapData mapData) { int id = mapData.uniqueID; if(handler instanceof NetServerHandler) { handleServerPacket((NetServerHandler)handler, mapData.uniqueID, mapData.itemData, (EntityPlayerMP)handler.getPlayer()); } else { handleClientPacket((NetClientHandler)handler, mapData.uniqueID, mapData.itemData); } }
@Override public void clientLoggedIn(NetHandler clientHandler, INetworkManager manager, Packet1Login login) { Minecraft mc = Minecraft.getMinecraft(); HackedPlayerController controller = new HackedPlayerController(mc, (NetClientHandler) clientHandler); mc.playerController = controller; controller.setGameType(login.gameType); }
public WDLNetClientHandler(NetClientHandler _nch) { nch = _nch; }
@Override public void handleTinyPacket(NetHandler handler, Packet131MapData mapData) { ((NetClientHandler)handler).fmlPacket131Callback(mapData); }
@Override public void setClientCompatibilityLevel(byte compatibilityLevel) { NetClientHandler.setConnectionCompatibilityLevel(compatibilityLevel); }
@Override public byte getClientCompatibilityLevel() { return NetClientHandler.getConnectionCompatibilityLevel(); }
@Override public void clientConnectionOpened(NetHandler netClientHandler, INetworkManager manager, BaseModProxy mod) { managerLookups.put(manager, netClientHandler); ((BaseMod)mod).clientConnect((NetClientHandler)netClientHandler); }
@SideOnly(CLIENT) @Deprecated public void clientCustomPayload(NetClientHandler handler, Packet250CustomPayload packet) { }
@Deprecated @SideOnly(CLIENT) public static void serverLogin(NetClientHandler handler, Packet1Login loginPacket) { }
public EntityClientPlayerMP(Minecraft p_i1189_1_, World p_i1189_2_, Session p_i1189_3_, NetClientHandler p_i1189_4_) { super(p_i1189_1_, p_i1189_2_, p_i1189_3_, 0); this.field_71174_a = p_i1189_4_; }
public PlayerControllerMP(Minecraft p_i1185_1_, NetClientHandler p_i1185_2_) { this.field_78779_k = EnumGameType.SURVIVAL; this.field_78776_a = p_i1185_1_; this.field_78774_b = p_i1185_2_; }
static NetClientHandler func_74252_a(GuiConnecting p_74252_0_, NetClientHandler p_74252_1_) { return p_74252_0_.field_74259_a = p_74252_1_; }