Fix bugs about Multiphase 修复多相相关问题#3431
Open
QiuShui1012 wants to merge 2 commits intoAnvil-Dev:dev/1.21/1.6from
Open
Fix bugs about Multiphase 修复多相相关问题#3431QiuShui1012 wants to merge 2 commits intoAnvil-Dev:dev/1.21/1.6from
QiuShui1012 wants to merge 2 commits intoAnvil-Dev:dev/1.21/1.6from
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR targets multiphase-related data handling in the recipe/result-modifier pipeline, aiming to fix enchantment inheritance issues (notably around Frost/Merciless enchantments) and simplify the custom data component construction flow.
Changes:
- Refactors
ICustomDataComponentto build data directly fromResultContext(removing theRequiredEntry/ordered-list mechanism). - Updates
CopyData/MergeDatato calltype.make(ctx)directly during result modification. - Adjusts multiphase construction so phases derive names/enchants more consistently (including Merciless enchantments being incorporated during
MultiphaseData.make).
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/main/java/dev/dubhe/anvilcraft/saved/multiphase/Multiphase.java | Simplifies phase creation (phase name now comes from Phase.create). |
| src/main/java/dev/dubhe/anvilcraft/api/recipe/result/modifier/MergeData.java | Switches merge flow to ICustomDataComponent.make(ResultContext) and merges onto result. |
| src/main/java/dev/dubhe/anvilcraft/api/recipe/result/modifier/CopyData.java | Switches copy flow to ICustomDataComponent.make(ResultContext) and applies to result. |
| src/main/java/dev/dubhe/anvilcraft/api/recipe/data/RequiredEntry.java | Removes the previous “required components list” abstraction. |
| src/main/java/dev/dubhe/anvilcraft/api/recipe/data/NormalDataComponent.java | Migrates input addressing to RecipeInputSlot and updates codecs accordingly. |
| src/main/java/dev/dubhe/anvilcraft/api/recipe/data/MultiphaseData.java | Rebuilds multiphase refs from ResultContext inputs; adds Merciless enchantment inclusion. |
| src/main/java/dev/dubhe/anvilcraft/api/recipe/data/ItemEnchantmentsData.java | Migrates input addressing to RecipeInputSlot and updates codecs accordingly. |
| src/main/java/dev/dubhe/anvilcraft/api/recipe/data/ICustomDataComponent.java | Changes the core API from make(List<Object>) to make(ResultContext). |
Comments suppressed due to low confidence (1)
src/main/java/dev/dubhe/anvilcraft/api/recipe/data/ItemEnchantmentsData.java:105
- ItemEnchantmentsData codec now reads the
inputusingRecipeInputSlot.CODEC(string form), but existing generated recipe JSONs (e.g. merge_data/change_data_type entries undersrc/generated/resources/data/anvilcraft/recipe/**) still provide"input": 0as an integer. This will break datapack recipe decoding at runtime. Please either keep int decoding for compatibility (or accept both int and string) or update/regenerate the JSON recipes to match the new schema.
public static final MapCodec<ItemEnchantmentsData> CODEC = RecordCodecBuilder.mapCodec(inst -> inst.group(
RecipeInputSlot.CODEC
.forGetter(ItemEnchantmentsData::getInput),
DataComponentType.CODEC
.fieldOf("component")
.forGetter(ItemEnchantmentsData::getDataComponentType)
).apply(inst, ItemEnchantmentsData::new));
public static final StreamCodec<RegistryFriendlyByteBuf, ItemEnchantmentsData> STREAM_CODEC = StreamCodec.composite(
RecipeInputSlot.STREAM_CODEC,
ItemEnchantmentsData::getInput,
DataComponentType.STREAM_CODEC,
ItemEnchantmentsData::getDataComponentType,
ItemEnchantmentsData::new
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
屎山代码代码逻辑