Changes

592 bytes added ,  15:50, 27 May 2023
Line 16: Line 16:  
The two login packets are handled internally by forge itself. However, the other two need to be sent using <code>SimpleChannel#send</code> for <code>SimpleChannel#sendToServer</code>. Each method takes a new instance of the message to send.
 
The two login packets are handled internally by forge itself. However, the other two need to be sent using <code>SimpleChannel#send</code> for <code>SimpleChannel#sendToServer</code>. Each method takes a new instance of the message to send.
   −
== Client Packet Locations ==
+
==Client Packet Locations==
   −
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 <code>PacketDistributor$PacketTarget</code> must also be passed in as a parameter. There are many helpful fields that hold simple implementations of where to send which packet within <code>PacketDistributor</code>. However, they must be supplied with the required input either via <code>PacketDistributor#with</code> or <code>PacketDistributor#noArg</code> if it is going to all players.
+
* 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 <code>PacketDistributor$PacketTarget</code> must also be passed in as a parameter. There are many helpful fields that hold simple implementations of where to send which packet within <code>PacketDistributor</code>. However, they must be supplied with the required input either via <code>PacketDistributor#with</code> or <code>PacketDistributor#noArg</code> if it is going to all players.
 +
*
    
Here is a list of distributors available:
 
Here is a list of distributors available:
 +
 +
<br />
 +
* <u>PLAYER:</u>Send to the specified Player.
 +
* <u>DIMENSION:</u>Send to everyone in the specified dimension.
 +
* <u>NEAR:</u>Send to everyone near the specified <code>PacketDistributor$TargetPoint</code>
 +
* <u>ALL:</u>Send to everyone
 +
* <u>SERVER:</u>Send to the server(from client)
 +
* <u>TRACKING_ENTITY:</u>Send to all tracking the specified Entity<br />
 +
* <u>TRACKING_ENTITY_AND_SELF:</u>Send to all tracking the specified Entity and Player
 +
* <u>TRACKING_CHUNK:</u>Send to all tracking the specified Chunk
 +
* <u>NMLIST:</u>Send to each NetworkManager instance in the specified List
2

edits