Class ReloadHandler

java.lang.Object
software.bluelib.event.ReloadEventHandler
software.bluelib.example.event.ReloadHandler

public class ReloadHandler extends ReloadEventHandler
A ReloadHandler class that handles server start and reload events related to entity variants.

This class extends ReloadEventHandler and implements event handling for server starting and reloading, ensuring that entity variant data is properly loaded and refreshed.

Key Methods:

Since:
1.0.0
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    LoadEntityVariants(net.minecraft.server.MinecraftServer pServer)
    Loads entity variants from JSON files into the MinecraftServer.
    static void
    onReload(net.neoforged.neoforge.event.AddReloadListenerEvent pEvent)
    Handles the reload event by scheduling a task to reload entity variants.
    static void
    onServerStart(net.neoforged.neoforge.event.server.ServerStartingEvent pEvent)
    Handles the server starting event to initialize the MinecraftServer instance and load entity variants.

    Methods inherited from class software.bluelib.event.ReloadEventHandler

    registerEntityVariants

    Methods inherited from class java.lang.Object

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

    • ReloadHandler

      public ReloadHandler()
  • Method Details

    • onServerStart

      public static void onServerStart(net.neoforged.neoforge.event.server.ServerStartingEvent pEvent)
      Handles the server starting event to initialize the MinecraftServer instance and load entity variants.
      Parameters:
      pEvent - ServerStartingEvent - The event triggered when the server starts.
      Since:
      1.0.0
    • onReload

      public static void onReload(net.neoforged.neoforge.event.AddReloadListenerEvent pEvent)
      Handles the reload event by scheduling a task to reload entity variants.

      This method schedules the LoadEntityVariants method to run after a short delay.

      Parameters:
      pEvent - AddReloadListenerEvent - The event triggered when a reload occurs.
      Since:
      1.0.0
    • LoadEntityVariants

      public static void LoadEntityVariants(net.minecraft.server.MinecraftServer pServer)
      Loads entity variants from JSON files into the MinecraftServer.

      This method iterates through the list of entity names, constructs file paths, and registers entity variants using the ReloadEventHandler.

      Parameters:
      pServer - MinecraftServer - The server on which the entity variants will be loaded.
      Since:
      1.0.0