Introduce codec module for data serialization and deserialization#15
Introduce codec module for data serialization and deserialization#15Gu-ZT merged 14 commits intoAnvil-Dev:dev/1.21.1from
Conversation
…ialization and deserialization
There was a problem hiding this comment.
Pull request overview
This PR introduces a new codec module to centralize common Codec / StreamCodec helpers, and migrates recipe-related serialization code to depend on that shared module.
Changes:
- Added
module.codec(new Gradle module + CI/release workflow jobs) providingCodecUtilandStreamCodecUtil. - Migrated
module.recipeserialization utilities to usedev.anvilcraft.lib.v2.codec.*and removed the oldmodule.recipeCodecUtil. - Updated documentation and Gradle wiring to include/publish the new codec artifact.
Reviewed changes
Copilot reviewed 29 out of 29 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| settings.gradle | Includes and names the new module.codec project. |
| README.md | Documents the new Codec module and adds dependency examples. |
| README.en.md | English documentation for the new Codec module and dependency examples. |
| module.recipe/src/main/java/dev/anvilcraft/lib/v2/recipe/util/CodecUtil.java | Removes recipe-local codec utilities (moved to new module). |
| module.recipe/src/main/java/dev/anvilcraft/lib/v2/recipe/predicate/item/HasItemBase.java | Switches network codecs to StreamCodecUtil. |
| module.recipe/src/main/java/dev/anvilcraft/lib/v2/recipe/predicate/block/HasBlockBase.java | Switches Vec3 stream codec to StreamCodecUtil. |
| module.recipe/src/main/java/dev/anvilcraft/lib/v2/recipe/outcome/SpawnItem.java | Switches number-provider/Vec3 codecs to codec module utilities. |
| module.recipe/src/main/java/dev/anvilcraft/lib/v2/recipe/outcome/SetBlock.java | Switches blockstate/number-provider/Vec3 codecs to codec module utilities. |
| module.recipe/src/main/java/dev/anvilcraft/lib/v2/recipe/outcome/ProduceExplosion.java | Switches codec-to-stream bridging to StreamCodecUtil. |
| module.recipe/src/main/java/dev/anvilcraft/lib/v2/recipe/outcome/ChooseOneOutcome.java | Switches codec-to-stream bridging to StreamCodecUtil. |
| module.recipe/src/main/java/dev/anvilcraft/lib/v2/recipe/data/advancement/predicate/item/OrPredicate.java | Uses dev.anvilcraft.lib.v2.codec.CodecUtil. |
| module.recipe/src/main/java/dev/anvilcraft/lib/v2/recipe/data/advancement/predicate/item/NotPredicate.java | Uses dev.anvilcraft.lib.v2.codec.CodecUtil. |
| module.recipe/src/main/java/dev/anvilcraft/lib/v2/recipe/data/advancement/predicate/item/AndPredicate.java | Uses dev.anvilcraft.lib.v2.codec.CodecUtil. |
| module.recipe/src/main/java/dev/anvilcraft/lib/v2/recipe/component/ItemPredicate.java | Switches codec-to-stream bridging to StreamCodecUtil. |
| module.recipe/src/main/java/dev/anvilcraft/lib/v2/recipe/component/ItemIngredientPredicate.java | Switches codec-to-stream bridging to StreamCodecUtil. |
| module.recipe/src/main/java/dev/anvilcraft/lib/v2/recipe/component/ChanceItemStack.java | Switches number-provider codecs to codec module utilities. |
| module.recipe/src/main/java/dev/anvilcraft/lib/v2/recipe/component/ChanceBlockState.java | Switches blockstate/number-provider codecs to codec module utilities. |
| module.recipe/build.gradle | Adds codec dependency (jarJar) for recipe module builds. |
| module.main/build.gradle | Adds codec dependency (jarJar) for aggregate/main module builds. |
| module.codec/src/main/resources/META-INF/neoforge.mods.toml | Adds module metadata for NeoForge loading. |
| module.codec/src/main/resources/anvillib_codec.mixins.json | Adds mixin config for the new module. |
| module.codec/src/main/java/dev/anvilcraft/lib/v2/codec/StreamCodecUtil.java | New: shared stream codecs + high-arity composite(...) helpers. |
| module.codec/src/main/java/dev/anvilcraft/lib/v2/codec/CodecUtil.java | New: shared Codec/MapCodec helpers moved from recipe. |
| module.codec/src/main/java/dev/anvilcraft/lib/v2/codec/package-info.java | New: package-level nullability defaults. |
| module.codec/gradle.properties | New: codec module properties (mod id/name/versions). |
| module.codec/build.gradle | New: module build/publish configuration. |
| .github/workflows/release.yml | Adds codec build + deploy jobs to release pipeline. |
| .github/workflows/pull_request.yml | Adds codec job and updates recipe job ordering. |
| .github/workflows/ci.yml | Adds codec job and updates recipe job ordering. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…ialization and deserialization
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 34 out of 34 changed files in this pull request and generated 2 comments.
Comments suppressed due to low confidence (1)
.github/workflows/pull_request.yml:117
- PR workflow jobs call
build_and_test.yml, which hard-codesNOT_DEV: true. That meansmodule.recipe/module.mainwill resolveanvillib-codecvia Maven (latest.release) instead of using the code from this PR, and on PR buildspublishis skipped so the newcodecartifact won’t be available. Consider adjusting the PR workflow/build script so PR builds use project dependencies (e.g., setNOT_DEVbased onpr_build, or publish built modules to a local repository and resolve from there) to ensurerecipe/mainactually build against the in-PRcodecchanges.
recipe:
needs:
- config
- codec
uses: ./.github/workflows/build_and_test.yml
with:
module: recipe
module_id: anvillib-recipe
mod_id: anvillib_recipe
ci_build: true
pr_build: true
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 35 out of 35 changed files in this pull request and generated 6 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 35 out of 35 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Introduce codec module for data serialization and deserialization
No description provided.