Record Class ConfigSyncPacket<T>
java.lang.Object
java.lang.Record
net.frozenblock.lib.config.impl.network.ConfigSyncPacket<T>
- All Implemented Interfaces:
net.fabricmc.fabric.api.networking.v1.FabricPacket
public record ConfigSyncPacket<T>(String modId, String className, T configData)
extends Record
implements net.fabricmc.fabric.api.networking.v1.FabricPacket
- Since:
- 1.5
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final net.fabricmc.fabric.api.networking.v1.PacketType<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.net.fabricmc.fabric.api.networking.v1.PacketType<?> getType()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) 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.fabricmc.fabric.api.networking.v1.PacketType<ConfigSyncPacket<?>> PACKET_TYPE
-
-
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) - Specified by:
writein interfacenet.fabricmc.fabric.api.networking.v1.FabricPacket
-
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
-
getType
public net.fabricmc.fabric.api.networking.v1.PacketType<?> getType()- Specified by:
getTypein interfacenet.fabricmc.fabric.api.networking.v1.FabricPacket
-
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
-