Store and Load Custom Data from Datapack Files
Organizing Your Datapack Structure
DataPack Anvil Mod reads custom data from JSON files in your datapack directory. Create a logical folder structure under your datapack's data folder to organize different data types.
Defining Data Format
1. Decide what information your data type needs to store (properties, values, configurations)
2. Create JSON files following a consistent schema
3. Place these files in a dedicated namespace folder within your datapack
4. Ensure file names and structure match what your Data Manager expects
Loading Process
When the server loads or reloads:
1. The mod scans datapack directories for registered data types
2. Your Data Manager's load method reads and parses the JSON files
3. Data is validated and stored in memory
4. If validation fails, the mod logs errors without crashing
Best Practices
Keep your JSON schemas simple and well-documented. Use consistent naming conventions across files. Test your data files with /reload to catch parsing errors early. Consider version your data format if you plan future updates.