{"id":26009736,"url":"https://github.com/emmathemartian/stapi-datagen","last_synced_at":"2026-05-29T18:31:06.365Z","repository":{"id":247418926,"uuid":"825335882","full_name":"EmmaTheMartian/stapi-datagen","owner":"EmmaTheMartian","description":null,"archived":false,"fork":false,"pushed_at":"2024-10-07T18:20:31.000Z","size":66,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-12T22:07:54.939Z","etag":null,"topics":["minecraft-mod","stapi"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/EmmaTheMartian.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-07T13:54:19.000Z","updated_at":"2024-11-21T16:43:00.000Z","dependencies_parsed_at":"2025-03-05T22:04:13.454Z","dependency_job_id":"313ca9b9-89e1-4773-8301-a111ec515aed","html_url":"https://github.com/EmmaTheMartian/stapi-datagen","commit_stats":null,"previous_names":["emmathemartian/stapi-datagen"],"tags_count":1,"template":false,"template_full_name":"calmilamsy/stationapi-example-mod","purl":"pkg:github/EmmaTheMartian/stapi-datagen","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EmmaTheMartian%2Fstapi-datagen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EmmaTheMartian%2Fstapi-datagen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EmmaTheMartian%2Fstapi-datagen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EmmaTheMartian%2Fstapi-datagen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/EmmaTheMartian","download_url":"https://codeload.github.com/EmmaTheMartian/stapi-datagen/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EmmaTheMartian%2Fstapi-datagen/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33666290,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-29T02:00:06.066Z","response_time":107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["minecraft-mod","stapi"],"created_at":"2025-03-05T22:04:07.465Z","updated_at":"2026-05-29T18:31:06.350Z","avatar_url":"https://github.com/EmmaTheMartian.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Station API Datagen\n\nA library mod for [Station API](https://github.com/ModificationStation/StationAPI) which\nallows modders to programmatically generate JSON files.\n\n## Note\n\nCurrently, the API does not make hashes of files to check for changes. As of now, all\nfiles are regenerated every time you run data. Along with this, stale files are not\nremoved. I recommend completely clearing your data generated folder and re-running data\nbefore making a release just to be certain that there are no stale files.\n\n## Usage\n\n\u003e The buildscript codeblocks are Groovy, however it should be very similar (if not then\n\u003e exactly the same) in Kotlin DSL.\n\n1. Include the datagen library. You can do this via Jitpack:\n\n    ```groovy\n    dependencies {\n        modImplementation(\"com.github.emmathemartian:stapi-datagen:version\")\n    }\n    ```\n\n2. Configure source sets to include a new `generated` source set. Make a directory at\n`src/generated/`, then add this to your buildscript:\n\n    ```groovy\n    sourceSets {\n        main {\n            java {\n                srcDir(\"src/main/java\")\n            }\n            resources {\n                srcDir(\"src/test/resources\")\n                srcDir(\"src/generated/resources\")\n            }\n        }\n    }\n    ```\n\n3. Create a new run configuration to run the data generator:\n\n    ```groovy\n    loom {\n        ...\n        \n        runs {\n            register(\"data\") {\n                property(\"datagen.run\", \"MODID\") // replace with your mod's id\n                property(\"datagen.path\", project.projectDir.toPath().resolve(\"src/generated/resources/\").toAbsolutePath().toString())\n                client()\n            }\n        }\n    }\n    ```\n\n4. Create an entrypoint for the data generator to find:\n\n   ```java\n   public class ModData implements DataEntrypoint {\n      @Entrypoint.Namespace\n      private static final Namespace NAMESPACE = Null.get();\n      \n      @Override\n      public void run() {\n         DataGenContext context = new DataGenContext(NAMESPACE);\n         \n         context.run(new CraftingRecipeProvider(context) {\n            @Override\n            public void run(DataGenContext context) {\n               shapeless()\n                     .ingredient(Ingredient.of(Block.DIRT.asItem()))\n                     .ingredient(Ingredient.of(Item.WATER_BUCKET))\n                     .result(new ItemStack(Block.CLAY.asItem()))\n                     .save(\"dirt_to_clay\", this, context);\n            }\n         });\n      }\n   }\n   ```\n      \n   ```json5\n   // fabric.mod.json\n   {\n      \"entrypoints\": {\n         \"data\": [\n            \"yourpackage.ModData\"\n         ]\n      }\n   }\n   ```\n\n5. Reload Gradle and test using `gradlew runData`. You should see the file at\n`src/generated/resources/assets/example_mod/stationapi/recipes/crafting/dirt_to_clay.json`.\n\n\u003e See `src/test/java/emmathemartian/datagen/test/` for a more comprehensive example.\n\n## Troubleshooting\n\n### The window does not appear or it closes after loading\n\nThis is intentional when running the data generator. Due to when data is made and when\nthe mod's JAR is made, you can't use any freshly generated files until the next run.\n\n### Old recipes/models/whatever still exist even after removing the code to generate them\n\nRead [note](#note).\n\n### \"Entry ... is a duplicate but no duplicate handling strategy has been set.\"\n\nEither you have a literal duplicate file across two source sets, or you are experiencing\n[this](https://github.com/gradle/gradle/issues/17236) bug. If you do not have any\nduplicate *files*, but you have duplicate *folders*, it will be the latter.\n\n\u003e Example: `src/main/resouces/assets/` and `src/generated/resources/assets/`. The `assets`\n\u003e folder is flagged as a duplicate for some reason. Thanks Gradle.\n\nTo fix the latter, just put this line in `processResources` (or whatever other task is\nfailing):\n\n```groovy\nduplicatesStrategy = DuplicatesStrategy.EXCLUDE\n```\n\nIf you prefer not to hunt down individual tasks to define `duplicatesStrategy` in, then\nyou can add this code to your buildscript, which should configure the duplicates strategy\nfor most tasks where it is important:\n\n```groovy\ntasks.withType(Jar).configureEach {\n\tduplicatesStrategy = DuplicatesStrategy.EXCLUDE\n}\n\ntasks.withType(Copy).configureEach {\n\tduplicatesStrategy = DuplicatesStrategy.EXCLUDE\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femmathemartian%2Fstapi-datagen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Femmathemartian%2Fstapi-datagen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femmathemartian%2Fstapi-datagen/lists"}