Interface CustomPacket

All Superinterfaces:
DataSerializable

public interface CustomPacket extends DataSerializable
The interface is used to send a custom data packet to a player
for further processing of this data on his client by some mod.
  • Method Details

    • of

      static CustomPacket of(String resourceLocation, String data)
      Creating your data package.
      Parameters:
      resourceLocation - - Packet ID. Usually has the form modid:chanel.
      data - - Package data provided as a String
    • of

      static CustomPacket of(String resourceLocation, com.google.gson.JsonElement data)
      Creating your data package. You can use JsonParser.parseString(java.lang.String) to reverse the conversion on the client.
      Parameters:
      resourceLocation - - Packet ID. Usually has the form modid:chanel.
      data - - Package data provided as a JsonElement.
    • of

      static CustomPacket of(ResourceKey resourceLocation, String data)
      Creating your data package.
      Parameters:
      resourceLocation - - Packet ID. Usually has the form modid:chanel.
      data - - Package data provided as a String
    • of

      static CustomPacket of(ResourceKey resourceLocation, com.google.gson.JsonElement data)
      Creating your data package. You can use JsonParser.parseString(java.lang.String) to reverse the conversion on the client.
      Parameters:
      resourceLocation - - Packet ID. Usually has the form modid:chanel.
      data - - Package data provided as a JsonElement.
    • sendTo

      void sendTo(ServerPlayer player)