Package commonnetwork.api
Interface NetworkHandler
- All Known Implementing Classes:
PacketRegistrationHandler
public interface NetworkHandler
-
Method Summary
Modifier and TypeMethodDescription<T> voidsend(T packet, net.minecraft.network.Connection connection) Sends the packet to the connection.default <T> voidsendToAllClients(T packet, net.minecraft.server.MinecraftServer server) Sends the packet to all the client players in the server, only if the players has the packet registered.default <T> voidsendToAllClients(T packet, net.minecraft.server.MinecraftServer server, boolean ignoreCheck) Sends the packet to all the client players in the serverdefault <T> voidsendToClient(T packet, net.minecraft.server.level.ServerPlayer player) Sends the packet to the client player, only if the player has the packet registered.<T> voidsendToClient(T packet, net.minecraft.server.level.ServerPlayer player, boolean ignoreCheck) Sends the packet to the client player..default <T> voidsendToClients(T packet, List<net.minecraft.server.level.ServerPlayer> players) Sends the packet to the client players, only if the players has the packet registered.default <T> voidsendToClients(T packet, List<net.minecraft.server.level.ServerPlayer> players, boolean ignoreCheck) Sends the packet to the client players.default <T> voidsendToClientsInLevel(T packet, net.minecraft.server.level.ServerLevel level) Sends the packet to all the client players in the level, only if the players has the packet registered.default <T> voidsendToClientsInLevel(T packet, net.minecraft.server.level.ServerLevel level, boolean ignoreCheck) Sends the packet to all the client players in the level.default <T> voidsendToClientsInRange(T packet, net.minecraft.server.level.ServerLevel level, net.minecraft.core.BlockPos pos, double range) Sends the packet to all the client players in range of a position, only if the players has the packet registered.default <T> voidsendToClientsInRange(T packet, net.minecraft.server.level.ServerLevel level, net.minecraft.core.BlockPos pos, double range, boolean ignoreCheck) Sends the packet to all the client players in range of a position.default <T> voidsendToClientsLoadingChunk(T packet, net.minecraft.world.level.chunk.LevelChunk chunk) Sends the packet to all the client players loading a chunk, only if the players has the packet registered.default <T> voidsendToClientsLoadingChunk(T packet, net.minecraft.world.level.chunk.LevelChunk chunk, boolean ignoreCheck) Sends the packet to all the client players loading a chunk.default <T> voidsendToClientsLoadingPos(T packet, net.minecraft.server.level.ServerLevel level, net.minecraft.core.BlockPos pos) Sends the packet to all the client players loading a position, only if the players has the packet registered.default <T> voidsendToClientsLoadingPos(T packet, net.minecraft.server.level.ServerLevel level, net.minecraft.core.BlockPos pos, boolean ignoreCheck) Sends the packet to all the client players loading a positiondefault <T> voidsendToClientsLoadingPos(T packet, net.minecraft.server.level.ServerLevel level, net.minecraft.world.level.ChunkPos pos) Sends the packet to all the client players loading a position, only if the players has the packet registered.default <T> voidsendToClientsLoadingPos(T packet, net.minecraft.server.level.ServerLevel level, net.minecraft.world.level.ChunkPos pos, boolean ignoreCheck) Sends the packet to all the client players loading a position.default <T> voidsendToServer(T packet) Sends the packet to the server, if the server has the packet registered.<T> voidsendToServer(T packet, boolean ignoreCheck) Sends the packet to the server.
-
Method Details
-
sendToServer
default <T> void sendToServer(T packet) Sends the packet to the server, if the server has the packet registered.- Type Parameters:
T- - The packet- Parameters:
packet- - the packet
-
sendToServer
<T> void sendToServer(T packet, boolean ignoreCheck) Sends the packet to the server. Can ignore the check if the server has the packet registered. Likely use case for this is talking to bukkit/spigot/paper servers.- Type Parameters:
T- - The packet- Parameters:
packet- - the packetignoreCheck- - ignore the check if the server has the packet registered.
-
sendToClient
default <T> void sendToClient(T packet, net.minecraft.server.level.ServerPlayer player) Sends the packet to the client player, only if the player has the packet registered.- Type Parameters:
T- - The packet- Parameters:
packet- - the packetplayer- - the player
-
sendToClient
<T> void sendToClient(T packet, net.minecraft.server.level.ServerPlayer player, boolean ignoreCheck) Sends the packet to the client player..- Type Parameters:
T- - The packet- Parameters:
packet- - the packetplayer- - the playerignoreCheck- - ignore the check if the client has the packet registered.
-
send
<T> void send(T packet, net.minecraft.network.Connection connection) Sends the packet to the connection.- Type Parameters:
T- - The packet- Parameters:
packet- - the packetconnection- - the connection
-
sendToClients
Sends the packet to the client players, only if the players has the packet registered.- Type Parameters:
T- - The packet- Parameters:
packet- - the packetplayers- - the players
-
sendToClients
default <T> void sendToClients(T packet, List<net.minecraft.server.level.ServerPlayer> players, boolean ignoreCheck) Sends the packet to the client players.- Type Parameters:
T- - The packet- Parameters:
packet- - the packetplayers- - the playersignoreCheck- - ignore the check if the client has the packet registered.
-
sendToAllClients
default <T> void sendToAllClients(T packet, net.minecraft.server.MinecraftServer server) Sends the packet to all the client players in the server, only if the players has the packet registered.- Type Parameters:
T- - The packet- Parameters:
packet- - the packetserver- - the server
-
sendToAllClients
default <T> void sendToAllClients(T packet, net.minecraft.server.MinecraftServer server, boolean ignoreCheck) Sends the packet to all the client players in the server- Type Parameters:
T- - The packet- Parameters:
packet- - the packetserver- - the serverignoreCheck- - ignore the check if the client has the packet registered.
-
sendToClientsInLevel
default <T> void sendToClientsInLevel(T packet, net.minecraft.server.level.ServerLevel level) Sends the packet to all the client players in the level, only if the players has the packet registered.- Type Parameters:
T- - The packet- Parameters:
packet- - the packetlevel- - the level
-
sendToClientsInLevel
default <T> void sendToClientsInLevel(T packet, net.minecraft.server.level.ServerLevel level, boolean ignoreCheck) Sends the packet to all the client players in the level.- Type Parameters:
T- - The packet- Parameters:
packet- - the packetlevel- - the levelignoreCheck- - ignore the check if the client has the packet registered.
-
sendToClientsLoadingChunk
default <T> void sendToClientsLoadingChunk(T packet, net.minecraft.world.level.chunk.LevelChunk chunk) Sends the packet to all the client players loading a chunk, only if the players has the packet registered.- Type Parameters:
T- - The packet- Parameters:
packet- - the packetchunk- - the chunk
-
sendToClientsLoadingChunk
default <T> void sendToClientsLoadingChunk(T packet, net.minecraft.world.level.chunk.LevelChunk chunk, boolean ignoreCheck) Sends the packet to all the client players loading a chunk.- Type Parameters:
T- - The packet- Parameters:
packet- - the packetchunk- - the chunkignoreCheck- - ignore the check if the client has the packet registered.
-
sendToClientsLoadingPos
default <T> void sendToClientsLoadingPos(T packet, net.minecraft.server.level.ServerLevel level, net.minecraft.world.level.ChunkPos pos) Sends the packet to all the client players loading a position, only if the players has the packet registered.- Type Parameters:
T- - The packet- Parameters:
packet- - the packetlevel- - the levelpos- - the chunkpos
-
sendToClientsLoadingPos
default <T> void sendToClientsLoadingPos(T packet, net.minecraft.server.level.ServerLevel level, net.minecraft.world.level.ChunkPos pos, boolean ignoreCheck) Sends the packet to all the client players loading a position.- Type Parameters:
T- - The packet- Parameters:
packet- - the packetlevel- - the levelpos- - the chunkposignoreCheck- - ignore the check if the client has the packet registered.
-
sendToClientsLoadingPos
default <T> void sendToClientsLoadingPos(T packet, net.minecraft.server.level.ServerLevel level, net.minecraft.core.BlockPos pos) Sends the packet to all the client players loading a position, only if the players has the packet registered.- Type Parameters:
T- - The packet- Parameters:
packet- - the packetlevel- - the levelpos- - the blockpos
-
sendToClientsLoadingPos
default <T> void sendToClientsLoadingPos(T packet, net.minecraft.server.level.ServerLevel level, net.minecraft.core.BlockPos pos, boolean ignoreCheck) Sends the packet to all the client players loading a position- Type Parameters:
T- - The packet- Parameters:
packet- - the packetlevel- - the levelpos- - the blockposignoreCheck- - ignore the check if the client has the packet registered.
-
sendToClientsInRange
default <T> void sendToClientsInRange(T packet, net.minecraft.server.level.ServerLevel level, net.minecraft.core.BlockPos pos, double range) Sends the packet to all the client players in range of a position, only if the players has the packet registered.- Type Parameters:
T- - The packet- Parameters:
packet- - the packetlevel- - the levelpos- - the blockposrange- - the range
-
sendToClientsInRange
default <T> void sendToClientsInRange(T packet, net.minecraft.server.level.ServerLevel level, net.minecraft.core.BlockPos pos, double range, boolean ignoreCheck) Sends the packet to all the client players in range of a position.- Type Parameters:
T- - The packet- Parameters:
packet- - the packetlevel- - the levelpos- - the blockposrange- - the rangeignoreCheck- - ignore the check if the client has the packet registered.
-