Record Class ConfigSyncPacket<T>
java.lang.Object
java.lang.Record
net.frozenblock.lib.config.impl.network.ConfigSyncPacket<T>
- All Implemented Interfaces:
net.minecraft.network.protocol.common.custom.CustomPacketPayload
public record ConfigSyncPacket<T>(String modId, String className, T configData)
extends Record
implements net.minecraft.network.protocol.common.custom.CustomPacketPayload
- Since:
- 1.5
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.minecraft.network.protocol.common.custom.CustomPacketPayload
net.minecraft.network.protocol.common.custom.CustomPacketPayload.FallbackProvider<B extends net.minecraft.network.FriendlyByteBuf>, net.minecraft.network.protocol.common.custom.CustomPacketPayload.Type<T extends net.minecraft.network.protocol.common.custom.CustomPacketPayload>, net.minecraft.network.protocol.common.custom.CustomPacketPayload.TypeAndCodec<B extends net.minecraft.network.FriendlyByteBuf,T extends net.minecraft.network.protocol.common.custom.CustomPacketPayload> -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final net.minecraft.network.codec.StreamCodec<net.minecraft.network.FriendlyByteBuf, ConfigSyncPacket<?>> static final net.minecraft.network.protocol.common.custom.CustomPacketPayload.Type<ConfigSyncPacket<?>> static final int -
Constructor Summary
ConstructorsConstructorDescriptionConfigSyncPacket(String modId, String className, T configData) Creates an instance of aConfigSyncPacketrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theclassNamerecord component.Returns the value of theconfigDatarecord component.static <T> @Nullable ConfigSyncPacket<T> create(@NotNull net.minecraft.network.FriendlyByteBuf buf) final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.static booleanhasPermissionsToSendSync(@Nullable net.minecraft.world.entity.player.Player player, boolean serverSide) modId()Returns the value of themodIdrecord component.static <T> voidreceive(@NotNull ConfigSyncPacket<T> packet, @Nullable net.minecraft.server.MinecraftServer server) static voidsendC2S()static voidstatic voidsendS2C(net.minecraft.server.level.ServerPlayer player) static voidfinal StringtoString()Returns a string representation of this record class.static <T> voidtrySendC2S(Config<T> config) @NotNull net.minecraft.network.protocol.common.custom.CustomPacketPayload.Type<?> type()voidwrite(@NotNull net.minecraft.network.FriendlyByteBuf buf)
-
Field Details
-
PERMISSION_LEVEL
public static final int PERMISSION_LEVEL- See Also:
-
PACKET_TYPE
public static final net.minecraft.network.protocol.common.custom.CustomPacketPayload.Type<ConfigSyncPacket<?>> PACKET_TYPE -
CODEC
public static final net.minecraft.network.codec.StreamCodec<net.minecraft.network.FriendlyByteBuf,ConfigSyncPacket<?>> CODEC
-
-
Constructor Details
-
ConfigSyncPacket
Creates an instance of aConfigSyncPacketrecord class.- Parameters:
modId- the value for themodIdrecord componentclassName- the value for theclassNamerecord componentconfigData- the value for theconfigDatarecord component
-
-
Method Details
-
create
@Nullable public static <T> @Nullable ConfigSyncPacket<T> create(@NotNull @NotNull net.minecraft.network.FriendlyByteBuf buf) -
write
public void write(@NotNull @NotNull net.minecraft.network.FriendlyByteBuf buf) -
receive
public static <T> void receive(@NotNull @NotNull ConfigSyncPacket<T> packet, @Nullable @Nullable net.minecraft.server.MinecraftServer server) -
sendS2C
-
sendS2C
public static void sendS2C(net.minecraft.server.level.ServerPlayer player) -
hasPermissionsToSendSync
public static boolean hasPermissionsToSendSync(@Nullable @Nullable net.minecraft.world.entity.player.Player player, boolean serverSide) -
sendC2S
-
sendC2S
@Environment(CLIENT) public static void sendC2S() -
trySendC2S
-
type
@NotNull public @NotNull net.minecraft.network.protocol.common.custom.CustomPacketPayload.Type<?> type()- Specified by:
typein interfacenet.minecraft.network.protocol.common.custom.CustomPacketPayload
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
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). -
modId
Returns the value of themodIdrecord component.- Returns:
- the value of the
modIdrecord component
-
className
Returns the value of theclassNamerecord component.- Returns:
- the value of the
classNamerecord component
-
configData
Returns the value of theconfigDatarecord component.- Returns:
- the value of the
configDatarecord component
-