diff --git a/common/src/main/java/software/bluelib/entity/variant/VariantLoader.java b/common/src/main/java/software/bluelib/entity/variant/VariantLoader.java index 1c223ae7..c11dde32 100644 --- a/common/src/main/java/software/bluelib/entity/variant/VariantLoader.java +++ b/common/src/main/java/software/bluelib/entity/variant/VariantLoader.java @@ -4,108 +4,108 @@ import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import java.util.Collection; import java.util.HashMap; import java.util.Map; -import net.minecraft.resources.ResourceLocation; import net.minecraft.server.MinecraftServer; -import net.minecraft.server.packs.resources.ResourceManager; -import software.bluelib.interfaces.variant.base.IVariantEntityBase; -import software.bluelib.json.JSONLoader; -import software.bluelib.json.JSONMerger; +import software.bluelib.json.JSONParser; import software.bluelib.utils.logging.BaseLogLevel; import software.bluelib.utils.logging.BaseLogger; import software.bluelib.utils.variant.ParameterUtils; /** - * A {@code public class} that implements the {@link IVariantEntityBase} {@code interface} that manages the loading and storage of entity variants. + * A class for loading and managing entity variants. *
- * The class handles loading and merging of JSON Data by utilizing the {@link JSONLoader} and {@link JSONMerger} classes.
- * To load the Variants it loops through all resources in a folder and merges them into a single {@link JsonObject}.
- * The merged JSON data is then parsed into {} instances and stored in {@link #AllVariants}.
+ * Purpose: This class handles the loading and parsing of entity variants from JSON files.
+ * When: The variants are loaded when the {@link #loadVariants(String, MinecraftServer, String)} method is called.
+ * Where: The variants are stored in a static map and can be accessed globally.
+ * Additional Info: This class extends {@link JSONParser} to utilize its JSON parsing capabilities.
*
- * The field is used to store all variants of an entity and is accessed by the {@link ParameterUtils} class.
+ * Purpose: This map holds all the variants loaded from JSON files, keyed by entity name.
+ * When: Populated when the {@link #loadVariants(String, MinecraftServer, String)} method is called.
+ * Where: Used globally to access the loaded variants.
+ * Additional Info: The map is static to allow global access.
*
- * This {@link JSONMerger} instance is used to merge JSON data into a single {@link JsonObject}.
+ * Purpose: This instance is used to load and parse JSON data.
+ * When: Initialized when the class is loaded.
+ * Where: Used internally within the class methods.
+ * Additional Info: Ensures only one instance of VariantLoader is used.
*
- * The method loops through all resources in the folder and merges them into a single {@link JsonObject}.
- * The merged JSON data is then parsed into {@link JsonObject} instances and stored in {@link #AllVariants}.
+ * Purpose: This method loads JSON data from the specified folder path and parses the variants.
+ * When: Called when variants need to be loaded for a specific entity.
+ * Where: Typically invoked during server initialization or entity configuration.
+ * Additional Info: The loaded variants are stored in the {@link #AllVariants} map.
*
- * The method parses the merged {@link JsonObject} and stores the data in the {@link #AllVariants} map.
- * The map is used to store all variants of an entity.
+ * Purpose: This method parses the JSON data and stores the variants in the {@link #AllVariants} map.
+ * When: Called internally after loading the JSON data.
+ * Where: Invoked within the {@link #loadVariants(String, MinecraftServer, String)} method.
+ * Additional Info: The parsed variants are logged for debugging purposes.
*
+ * Purpose: This class provides methods to load and merge JSON data from specified folder paths.
+ * When: The JSON data is loaded and merged when the {@link #loadData(String, MinecraftServer)} method is called.
+ * Where: The JSON data is loaded from the specified folder path and merged into a single {@link JsonObject}.
+ * Additional Info: This class uses {@link JSONLoader} to load JSON data and {@link JSONMerger} to merge JSON objects.
+ *
+ * Purpose: This map holds the JSON data loaded from the specified folder path.
+ * When: The map is populated when the {@link #loadData(String, MinecraftServer)} method is called.
+ * Where: The map is used to store JSON data with their corresponding keys.
+ * Additional Info: The keys are the resource locations of the JSON files.
+ *
+ * Purpose: This instance is used to load JSON data from the specified folder path.
+ * When: The instance is used when the {@link #loadData(String, MinecraftServer)} method is called.
+ * Where: The instance is used to load JSON data from the specified folder path.
+ * Additional Info: The JSONLoader class provides methods to load JSON data from resource locations.
+ *
+ * Purpose: This instance is used to merge JSON objects loaded from the specified folder path.
+ * When: The instance is used when the {@link #loadData(String, MinecraftServer)} method is called.
+ * Where: The instance is used to merge JSON objects loaded from the specified folder path.
+ * Additional Info: The JSONMerger class provides methods to merge JSON objects.
+ *
+ * Purpose: This object holds the merged JSON data from the specified folder path.
+ * When: The object is populated when the {@link #loadData(String, MinecraftServer)} method is called.
+ * Where: The object is used to store the merged JSON data.
+ * Additional Info: The merged JSON data is a combination of all JSON files loaded from the specified folder path.
+ *
+ * Purpose: This method loads JSON data from the specified folder path and merges them into a single {@link JsonObject}.
+ * When: The method is called to load and merge JSON data.
+ * Where: The method is called whenever JSON data needs to be loaded and merged.
+ * Additional Info: The method uses {@link JSONLoader} to load JSON data and {@link JSONMerger} to merge JSON objects.
+ *
+ * Purpose: This method returns the data map containing JSON data loaded from the specified folder path.
+ * When: The method is called to retrieve the data map.
+ * Where: The method is called from any class or method.
+ * Additional Info: The data map contains JSON data with their corresponding keys.
+ *
+ * Purpose: This method returns the merged JSON object containing data from all JSON files loaded from the specified folder path.
+ * When: The method is called to retrieve the merged JSON object.
+ * Where: The method is called from any class or method.
+ * Additional Info: The merged JSON object is a combination of all JSON files loaded from the specified folder path.
+ *