Class ForgeNetworkHandler
java.lang.Object
net.darkhax.bookshelf.forge.impl.network.ForgeNetworkHandler
- All Implemented Interfaces:
INetworkHandler
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancanSendPacket(net.minecraft.server.level.ServerPlayer recipient, net.minecraft.resources.ResourceLocation payloadId) Tests if a payload type can be sent to a player.<T extends net.minecraft.network.protocol.common.custom.CustomPacketPayload>
voidRegisters a Bookshelf packet type to the packet registry.<T extends net.minecraft.network.protocol.common.custom.CustomPacketPayload>
voidsendToPlayer(net.minecraft.server.level.ServerPlayer recipient, T payload) Sends a packet from the server to a player.<T extends net.minecraft.network.protocol.common.custom.CustomPacketPayload>
voidsendToServer(T payload) Sends a payload from the client to the server.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.darkhax.bookshelf.common.api.network.INetworkHandler
canSendPacket, canSendPacket
-
Constructor Details
-
ForgeNetworkHandler
public ForgeNetworkHandler()
-
-
Method Details
-
register
public <T extends net.minecraft.network.protocol.common.custom.CustomPacketPayload> void register(IPacket<T> packet) Description copied from interface:INetworkHandlerRegisters a Bookshelf packet type to the packet registry.- Specified by:
registerin interfaceINetworkHandler- Type Parameters:
T- The type of the payload.- Parameters:
packet- The packet type to register.
-
sendToServer
public <T extends net.minecraft.network.protocol.common.custom.CustomPacketPayload> void sendToServer(T payload) Description copied from interface:INetworkHandlerSends a payload from the client to the server.- Specified by:
sendToServerin interfaceINetworkHandler- Type Parameters:
T- The type of the payload.- Parameters:
payload- The payload to send.
-
sendToPlayer
public <T extends net.minecraft.network.protocol.common.custom.CustomPacketPayload> void sendToPlayer(net.minecraft.server.level.ServerPlayer recipient, T payload) Description copied from interface:INetworkHandlerSends a packet from the server to a player.- Specified by:
sendToPlayerin interfaceINetworkHandler- Type Parameters:
T- The type of the payload.- Parameters:
recipient- The recipient of the packet.payload- The payload to send.
-
canSendPacket
public boolean canSendPacket(net.minecraft.server.level.ServerPlayer recipient, net.minecraft.resources.ResourceLocation payloadId) Description copied from interface:INetworkHandlerTests if a payload type can be sent to a player.- Specified by:
canSendPacketin interfaceINetworkHandler- Parameters:
recipient- The recipient of the packet.payloadId- The payload type ID.- Returns:
- If the payload can be sent to the recipient player.
-