Record Class CustomDataPacket
java.lang.Object
java.lang.Record
de.luckymcdev.foundryengine.common.network.packets.CustomDataPacket
- All Implemented Interfaces:
AbstractPacket<CustomDataPacket>, net.minecraft.network.protocol.common.custom.CustomPacketPayload
public record CustomDataPacket(String id, net.minecraft.nbt.CompoundTag data)
extends Record
implements AbstractPacket<CustomDataPacket>
-
Nested Class Summary
Nested classes/interfaces inherited from interface AbstractPacket
AbstractPacket.Definition<T>Nested classes/interfaces inherited from interface net.minecraft.network.protocol.common.custom.CustomPacketPayload
net.minecraft.network.protocol.common.custom.CustomPacketPayload.FallbackProvider<B>, net.minecraft.network.protocol.common.custom.CustomPacketPayload.Type<T>, net.minecraft.network.protocol.common.custom.CustomPacketPayload.TypeAndCodec<B,T> -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic BiConsumer<CustomDataPacket, net.neoforged.neoforge.network.handling.IPayloadContext> static final AbstractPacket.Definition<CustomDataPacket> static BiConsumer<CustomDataPacket, net.neoforged.neoforge.network.handling.IPayloadContext> Fields inherited from interface AbstractPacket
GENEROUS_NBT_CODEC, MAX_FILE_CONTENT_LENGTH, MAX_LIST_ELEMENT_COUNT, MAX_MODULE_COUNT, MAX_STRING_LENGTH -
Constructor Summary
ConstructorsConstructorDescriptionCustomDataPacket(String id, net.minecraft.nbt.CompoundTag data) Creates an instance of aCustomDataPacketrecord class. -
Method Summary
Modifier and TypeMethodDescriptionnet.minecraft.nbt.CompoundTagdata()Returns the value of thedatarecord component.final booleanIndicates whether some other object is "equal to" this one.net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf, CustomDataPacket> getCodec()net.minecraft.network.protocol.common.custom.CustomPacketPayload.Type<CustomDataPacket> getType()voidhandleClient(net.neoforged.neoforge.network.handling.IPayloadContext ctx) voidhandleServer(net.neoforged.neoforge.network.handling.IPayloadContext ctx) final inthashCode()Returns a hash code value for this object.id()Returns the value of theidrecord component.final StringtoString()Returns a string representation of this record class.Methods inherited from interface AbstractPacket
typeMethods inherited from interface net.minecraft.network.protocol.common.custom.CustomPacketPayload
toVanillaClientbound, toVanillaServerbound
-
Field Details
-
DEFINITION
-
CLIENT_HANDLER
public static volatile BiConsumer<CustomDataPacket, net.neoforged.neoforge.network.handling.IPayloadContext> CLIENT_HANDLER -
SERVER_HANDLER
public static volatile BiConsumer<CustomDataPacket, net.neoforged.neoforge.network.handling.IPayloadContext> SERVER_HANDLER
-
-
Constructor Details
-
CustomDataPacket
Creates an instance of aCustomDataPacketrecord class.- Parameters:
id- the value for theidrecord componentdata- the value for thedatarecord component
-
-
Method Details
-
getType
public net.minecraft.network.protocol.common.custom.CustomPacketPayload.Type<CustomDataPacket> getType()- Specified by:
getTypein interfaceAbstractPacket<CustomDataPacket>
-
getBoundTo
- Specified by:
getBoundToin interfaceAbstractPacket<CustomDataPacket>
-
getCodec
public net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf, CustomDataPacket> getCodec()- Specified by:
getCodecin interfaceAbstractPacket<CustomDataPacket>
-
handleClient
public void handleClient(net.neoforged.neoforge.network.handling.IPayloadContext ctx) - Specified by:
handleClientin interfaceAbstractPacket<CustomDataPacket>
-
handleServer
public void handleServer(net.neoforged.neoforge.network.handling.IPayloadContext ctx) - Specified by:
handleServerin interfaceAbstractPacket<CustomDataPacket>
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
id
Returns the value of theidrecord component.- Returns:
- the value of the
idrecord component
-
data
public net.minecraft.nbt.CompoundTag data()Returns the value of thedatarecord component.- Returns:
- the value of the
datarecord component
-