Class CustomPlayerRegistry

java.lang.Object
com.jubiman.customplayerlib.CustomPlayerRegistry

public class CustomPlayerRegistry extends Object
Registry where mods can register CustomPlayers
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    clientTickAll(necesse.engine.network.client.Client client)
    Client ticks all registered CustomPlayers.
    static void
    forEach(BiConsumer<? super String,? super CustomPlayersHandler<?>> action)
    Applies forEach function on the registry HasMap
    get(String identifier)
    Get CustomPlayers instance in registry
    static void
    loadAllEnter(necesse.engine.save.LoadData data)
    Loads all registered CustomPlayers, is called before the rest of the player is loaded
    static void
    loadAllExit(necesse.engine.save.LoadData data)
    Loads all registered CustomPlayers, is called after the rest of the player is loaded
    static void
    register(String identifier, CustomPlayersHandler<?> customPlayersHandlerInstance)
    Register a new CustomPlayers instance
    static void
    saveAll(necesse.engine.save.SaveData save, necesse.engine.network.server.ServerClient player)
    Saves player data from all registered CustomPlayers classes
    static void
    serverTickAll(necesse.engine.network.server.Server server)
    Server ticks all registered CustomPlayers.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • CustomPlayerRegistry

      public CustomPlayerRegistry()
  • Method Details

    • register

      public static void register(String identifier, CustomPlayersHandler<?> customPlayersHandlerInstance)
      Register a new CustomPlayers instance
      Parameters:
      identifier - the name of the class (used to return the instance)
      customPlayersHandlerInstance - a new instance of the class
    • get

      public static CustomPlayersHandler<?> get(String identifier)
      Get CustomPlayers instance in registry
      Parameters:
      identifier - the identifier of the CustomPlayers
      Returns:
      CustomPlayers instance registered with the identifier
    • forEach

      public static void forEach(BiConsumer<? super String,? super CustomPlayersHandler<?>> action)
      Applies forEach function on the registry HasMap
      Parameters:
      action - the function to execute
    • saveAll

      public static void saveAll(necesse.engine.save.SaveData save, necesse.engine.network.server.ServerClient player)
      Saves player data from all registered CustomPlayers classes
      Parameters:
      save - the SaveData to save to
      player - the player to save
    • loadAllEnter

      public static void loadAllEnter(necesse.engine.save.LoadData data)
      Loads all registered CustomPlayers, is called before the rest of the player is loaded
      Parameters:
      data - the LoadData to load from
    • loadAllExit

      public static void loadAllExit(necesse.engine.save.LoadData data)
      Loads all registered CustomPlayers, is called after the rest of the player is loaded
      Parameters:
      data - the LoadData to load from
    • serverTickAll

      public static void serverTickAll(necesse.engine.network.server.Server server)
      Server ticks all registered CustomPlayers. Please do not call this function as it's called every tick when Necesse's server ticks.
      Parameters:
      server - the server to tick from
    • clientTickAll

      public static void clientTickAll(necesse.engine.network.client.Client client)
      Client ticks all registered CustomPlayers. Please do not call this function as it's called every tick when Necesse's client ticks.
      Parameters:
      client - the client to tick from