@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); }
@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)); } } }
@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); }
@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) { } }
/** * 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; }
@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); } }
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(); }
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(); }
@Override public void handleTinyPacket(NetHandler handler, Packet131MapData mapData) { ((NetClientHandler)handler).fmlPacket131Callback(mapData); }
@Override public void connectionOpened(NetHandler netClientHandler, String server, int port, INetworkManager manager) { }
public void func_73279_a(NetHandler p_73279_1_) { p_73279_1_.func_72491_a(this); }
@Override public World getWorld(NetHandler handler) { return null; }
public void func_73279_a(NetHandler p_73279_1_) { p_73279_1_.func_72490_a(this); }
public void func_73279_a(NetHandler p_73279_1_) { p_73279_1_.func_72462_a(this); }
@Override public void handle(NetHandler handler, Packet131MapData mapData) { }
public void func_73279_a(NetHandler p_73279_1_) { p_73279_1_.func_72511_a(this); }
@Override public void clientLoggedIn(NetHandler clientHandler, INetworkManager manager, Packet1Login login) { }
/** * Sets the NetHandler for this NetworkManager. Server-only. */ public void setNetHandler(NetHandler par1NetHandler) { this.theNetHandler = par1NetHandler; }
@Override public void clientLoggedIn(NetHandler nh, INetworkManager manager, Packet1Login login) { mod.serverConnect(nh); }
public void func_73279_a(NetHandler p_73279_1_) { p_73279_1_.func_72467_a(this); }
public void func_73279_a(NetHandler p_73279_1_) { p_73279_1_.func_72492_a(this); }
public void func_73279_a(NetHandler p_73279_1_) { p_73279_1_.func_72456_a(this); }
public void func_73279_a(NetHandler p_73279_1_) { p_73279_1_.func_72505_a(this); }
@Override public void handle(NetHandler handler, Packet131MapData mapData) { if (handler instanceof NetServerHandler) ChiselEventHandler.place(handler.getPlayer(), handler.getPlayer().worldObj); }
public void func_73279_a(NetHandler p_73279_1_) { p_73279_1_.func_72464_a(this); }
/** * Sets the NetHandler for this NetworkManager. Server-only. */ public void setNetHandler(NetHandler par1NetHandler) { this.myNetHandler = par1NetHandler; }
/** * * 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))); }
public void func_73279_a(NetHandler p_73279_1_) { p_73279_1_.func_98182_a(this); }
public void func_73279_a(NetHandler p_73279_1_) { p_73279_1_.func_96436_a(this); }
public void disconnectIDMismatch(MapDifference<Integer, ItemData> serverDifference, NetHandler toKill, INetworkManager network) { sidedDelegate.disconnectIDMismatch(serverDifference, toKill, network); }
@Override public void disconnectIDMismatch(MapDifference<Integer, ItemData> s, NetHandler handler, INetworkManager mgr) { }
@Override public void execute(INetworkManager network, FMLNetworkHandler handler, NetHandler netHandler, String userName) { FMLCommonHandler.instance().adjustEntityLocationOnClient(this); }
@Override public void execute(INetworkManager network, FMLNetworkHandler handler, NetHandler netHandler, String userName) { FMLCommonHandler.instance().getSidedDelegate().displayMissingMods(this); }
public void func_73279_a(NetHandler p_73279_1_) { p_73279_1_.func_72507_a(this); }