Class VariantLoader

java.lang.Object
software.bluelib.entity.variant.VariantLoader
All Implemented Interfaces:
IVariantEntityBase

public class VariantLoader extends Object implements IVariantEntityBase
A public class that implements the IVariantEntityBase interface that manages the loading and storage of entity variants.

The class handles loading and merging of JSON Data by utilizing the JSONLoader and JSONMerger classes.
To load the Variants it loops through all resources in a folder and merges them into a single JsonObject.
The merged JSON data is then parsed into {} instances and stored in AllVariants.

Key Methods:
Since:
1.0.0
  • Field Details

    • AllVariants

      public static Map<String,com.google.gson.JsonObject> AllVariants
      A public static Map that stores all variants of an entity.

      The field is used to store all variants of an entity and is accessed by the ParameterUtils class.


      We don't recommend using this field directly unless you know what you are doing.
      Since:
      1.3.0
  • Constructor Details

    • VariantLoader

      public VariantLoader()
  • Method Details

    • loadVariants

      public static void loadVariants(String pFolderPath, net.minecraft.server.MinecraftServer pServer, String pEntityName)
      A public static void that loads and merges variant data from JSON resources in the specified folder path.

      The method loops through all resources in the folder and merges them into a single JsonObject.
      The merged JSON data is then parsed into JsonObject instances and stored in AllVariants.

      Parameters:
      pFolderPath - String - The path to the folder containing JSON resources.
      pServer - MinecraftServer - The MinecraftServer instance used to access resources.
      pEntityName - String - The name of the entity whose variants should be cleared before loading new ones.
      Since:
      1.0.0