<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://forge.gemwire.uk/index.php?action=history&amp;feed=atom&amp;title=Sending_Packets%2F1.16</id>
	<title>Sending Packets/1.16 - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://forge.gemwire.uk/index.php?action=history&amp;feed=atom&amp;title=Sending_Packets%2F1.16"/>
	<link rel="alternate" type="text/html" href="https://forge.gemwire.uk/index.php?title=Sending_Packets/1.16&amp;action=history"/>
	<updated>2026-05-22T22:54:57Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.35.0</generator>
	<entry>
		<id>https://forge.gemwire.uk/index.php?title=Sending_Packets/1.16&amp;diff=2729&amp;oldid=prev</id>
		<title>ShrimpBot: Copy Sending Packets to MC1.16 archive</title>
		<link rel="alternate" type="text/html" href="https://forge.gemwire.uk/index.php?title=Sending_Packets/1.16&amp;diff=2729&amp;oldid=prev"/>
		<updated>2021-07-27T03:59:09Z</updated>

		<summary type="html">&lt;p&gt;Copy &lt;a href=&quot;/wiki/Sending_Packets&quot; title=&quot;Sending Packets&quot;&gt;Sending Packets&lt;/a&gt; to MC1.16 archive&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Once a packet has been added to the network, it can be called to send a message to the side it refers to. Usually there are four different directions a packet can be sent:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable sortable&amp;quot; border=1&lt;br /&gt;
!Direction !!Description &lt;br /&gt;
|-&lt;br /&gt;
|   &amp;lt;code&amp;gt;PLAY_TO_CLIENT&amp;lt;/code&amp;gt;   ||  A packet is sent from the server to the client during gameplay. &lt;br /&gt;
|-&lt;br /&gt;
|   &amp;lt;code&amp;gt;PLAY_TO_SERVER&amp;lt;/code&amp;gt;   ||  A packet is sent from the client to the server during gameplay. &lt;br /&gt;
|-&lt;br /&gt;
|   &amp;lt;code&amp;gt;LOGIN_TO_CLIENT&amp;lt;/code&amp;gt;   ||  A packet is sent to the client on initial login. &lt;br /&gt;
|-&lt;br /&gt;
|   &amp;lt;code&amp;gt;LOGIN_TO_SERVER&amp;lt;/code&amp;gt;   ||  A packet is sent to the server on initial login. &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The two login packets are handled internally by forge itself. However, the other two need to be sent using &amp;lt;code&amp;gt;SimpleChannel#send&amp;lt;/code&amp;gt; for &amp;lt;code&amp;gt;SimpleChannel#sendToServer&amp;lt;/code&amp;gt;. Each method takes a new instance of the message to send.&lt;br /&gt;
&lt;br /&gt;
== Client Packet Locations ==&lt;br /&gt;
&lt;br /&gt;
It might not always be necessary to update every single client with a packet if they are not viewing the entity or are not affected by it. To specify which clients to send a packet from the server to, a &amp;lt;code&amp;gt;PacketDistributor$PacketTarget&amp;lt;/code&amp;gt; must also be passed in as a parameter. There are many helpful fields that hold simple implementations of where to send which packet within &amp;lt;code&amp;gt;PacketDistributor&amp;lt;/code&amp;gt;. However, they must be supplied with the required input either via &amp;lt;code&amp;gt;PacketDistributor#with&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;PacketDistributor#noArg&amp;lt;/code&amp;gt; if it is going to all players.&lt;br /&gt;
&lt;br /&gt;
Here is a list of distributors available:&lt;/div&gt;</summary>
		<author><name>ShrimpBot</name></author>
	</entry>
</feed>