Class OnDatapackSyncEvent

java.lang.Object
net.minecraftforge.eventbus.api.Event
net.minecraftforge.event.OnDatapackSyncEvent

public class OnDatapackSyncEvent extends net.minecraftforge.eventbus.api.Event
Fires when a player joins the server or when the reload command is ran, before tags and crafting recipes are sent to the client. Send datapack data to clients when this event fires.
  • Field Details

    • playerList

      private final PlayerList playerList
    • player

      @Nullable private final @Nullable ServerPlayer player
  • Constructor Details

    • OnDatapackSyncEvent

      public OnDatapackSyncEvent(PlayerList playerList, @Nullable @Nullable ServerPlayer player)
  • Method Details

    • getPlayerList

      public PlayerList getPlayerList()
      Returns:
      The server's player list to get a view of all players.
    • getPlayer

      @Nullable public @Nullable ServerPlayer getPlayer()
      Returns:
      The player to sync datapacks to. Null when syncing for all players, such as when the reload command runs.
    • getPlayers

      public List<ServerPlayer> getPlayers()
      Returns:
      A list of players that should receive data during this event, which is the specified player (if not null) or all players otherwise.