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

    Fields
    Modifier and Type
    Field
    Description
    static final net.fabricmc.fabric.api.networking.v1.PacketType<ConfigSyncPacket<?>>
     
    static final int
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    ConfigSyncPacket(String modId, String className, T configData)
    Creates an instance of a ConfigSyncPacket record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the value of the className record component.
    Returns the value of the configData record component.
    static <T> @Nullable ConfigSyncPacket<T>
    create(@NotNull net.minecraft.network.FriendlyByteBuf buf)
     
    final boolean
    Indicates whether some other object is "equal to" this one.
    net.fabricmc.fabric.api.networking.v1.PacketType<?>
     
    final int
    Returns a hash code value for this object.
    static boolean
    hasPermissionsToSendSync(@Nullable net.minecraft.world.entity.player.Player player, boolean serverSide)
     
    Returns the value of the modId record component.
    static <T> void
    receive(@NotNull ConfigSyncPacket<T> packet, @Nullable net.minecraft.server.MinecraftServer server)
     
    static void
     
    static void
    sendC2S(@NotNull Iterable<Config<?>> configs)
     
    static void
    sendS2C(net.minecraft.server.level.ServerPlayer player)
     
    static void
    sendS2C(net.minecraft.server.level.ServerPlayer player, @NotNull Iterable<Config<?>> configs)
     
    final String
    Returns a string representation of this record class.
    static <T> void
    trySendC2S(Config<T> config)
     
    void
    write(@NotNull net.minecraft.network.FriendlyByteBuf buf)
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • 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

      public ConfigSyncPacket(String modId, String className, T configData)
      Creates an instance of a ConfigSyncPacket record class.
      Parameters:
      modId - the value for the modId record component
      className - the value for the className record component
      configData - the value for the configData record 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:
      write in interface net.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

      public static void sendS2C(net.minecraft.server.level.ServerPlayer player, @NotNull @NotNull Iterable<Config<?>> configs)
    • 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

      @Environment(CLIENT) public static void sendC2S(@NotNull @NotNull Iterable<Config<?>> configs)
    • sendC2S

      @Environment(CLIENT) public static void sendC2S()
    • trySendC2S

      @Environment(CLIENT) public static <T> void trySendC2S(Config<T> config)
    • getType

      public net.fabricmc.fabric.api.networking.v1.PacketType<?> getType()
      Specified by:
      getType in interface net.fabricmc.fabric.api.networking.v1.FabricPacket
    • toString

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • modId

      public String modId()
      Returns the value of the modId record component.
      Returns:
      the value of the modId record component
    • className

      public String className()
      Returns the value of the className record component.
      Returns:
      the value of the className record component
    • configData

      public T configData()
      Returns the value of the configData record component.
      Returns:
      the value of the configData record component