Package commonnetwork.networking
Class FabricNetworkHandler
java.lang.Object
commonnetwork.networking.PacketRegistrationHandler
commonnetwork.networking.FabricNetworkHandler
- All Implemented Interfaces:
NetworkHandler,PacketRegistrar
-
Field Summary
Fields inherited from class commonnetwork.networking.PacketRegistrationHandler
side -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected <T> voidregisterPacket(PacketContainer<T> container) <T> voidsend(T packet, net.minecraft.network.Connection connection) Sends the packet to the connection.<T> voidsendToClient(T packet, net.minecraft.server.level.ServerPlayer player, boolean ignoreCheck) Sends the packet to the client player..<T> voidsendToServer(T packet, boolean ignoreCheck) Sends the packet to the server.Methods inherited from class commonnetwork.networking.PacketRegistrationHandler
getSide, registerConfigurationPacket, registerPacket, registerPacketMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface commonnetwork.api.NetworkHandler
sendToAllClients, sendToAllClients, sendToClient, sendToClients, sendToClients, sendToClientsInLevel, sendToClientsInLevel, sendToClientsInRange, sendToClientsInRange, sendToClientsLoadingChunk, sendToClientsLoadingChunk, sendToClientsLoadingPos, sendToClientsLoadingPos, sendToClientsLoadingPos, sendToClientsLoadingPos, sendToServer
-
Constructor Details
-
FabricNetworkHandler
-
-
Method Details
-
registerPacket
-
send
public <T> void send(T packet, net.minecraft.network.Connection connection) Description copied from interface:NetworkHandlerSends the packet to the connection.- Type Parameters:
T- - The packet- Parameters:
packet- - the packetconnection- - the connection
-
sendToServer
public <T> void sendToServer(T packet, boolean ignoreCheck) Description copied from interface:NetworkHandlerSends 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
public <T> void sendToClient(T packet, net.minecraft.server.level.ServerPlayer player, boolean ignoreCheck) Description copied from interface:NetworkHandlerSends 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.
-