Class AbstractPacket<T extends net.minecraft.network.protocol.common.custom.CustomPacketPayload>
java.lang.Object
net.darkhax.bookshelf.common.api.network.AbstractPacket<T>
- Type Parameters:
T- The type of the payload.
- All Implemented Interfaces:
IPacket<T>
public abstract class AbstractPacket<T extends net.minecraft.network.protocol.common.custom.CustomPacketPayload>
extends Object
implements IPacket<T>
A basic packet implementation.
-
Constructor Summary
ConstructorsConstructorDescriptionAbstractPacket(net.minecraft.resources.ResourceLocation id, net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf, T> codec) A packet that is sent from the server to the client.AbstractPacket(net.minecraft.resources.ResourceLocation id, net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf, T> codec, Destination direction) A simple packet type. -
Method Summary
Modifier and TypeMethodDescriptionDefines how the packet is meant to be sent and where it should be handled.net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf, T> Gets a stream codec that can serialize the payload across the network.net.minecraft.network.protocol.common.custom.CustomPacketPayload.Type<T> type()Gets the payload type.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.IPacket
handle, toAllPlayers, toAllPlayers, toAllPlayers, toPlayer, toServer
-
Constructor Details
-
AbstractPacket
public AbstractPacket(net.minecraft.resources.ResourceLocation id, net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf, T> codec) A packet that is sent from the server to the client.- Parameters:
id- The packet ID.codec- The payload codec.
-
AbstractPacket
public AbstractPacket(net.minecraft.resources.ResourceLocation id, net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf, T> codec, Destination direction) A simple packet type.- Parameters:
id- The packet ID.codec- The payload codec.direction- The intended destination of the packet.
-
-
Method Details
-
type
Description copied from interface:IPacketGets the payload type. -
streamCodec
public net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf,T> streamCodec()Description copied from interface:IPacketGets a stream codec that can serialize the payload across the network.- Specified by:
streamCodecin interfaceIPacket<T extends net.minecraft.network.protocol.common.custom.CustomPacketPayload>- Returns:
- The stream coded used to serialize the payload.
-
destination
Description copied from interface:IPacketDefines how the packet is meant to be sent and where it should be handled.- Specified by:
destinationin interfaceIPacket<T extends net.minecraft.network.protocol.common.custom.CustomPacketPayload>- Returns:
- The intended destination of the packet.
-