Skip to content

Fix bugs about Multiphase 修复多相相关问题#3431

Open
QiuShui1012 wants to merge 2 commits intoAnvil-Dev:dev/1.21/1.6from
QiuShui1012:multiphase/1.21/1.6
Open

Fix bugs about Multiphase 修复多相相关问题#3431
QiuShui1012 wants to merge 2 commits intoAnvil-Dev:dev/1.21/1.6from
QiuShui1012:multiphase/1.21/1.6

Conversation

@QiuShui1012
Copy link
Copy Markdown
Contributor

@QiuShui1012 QiuShui1012 commented Apr 23, 2026

Copilot AI review requested due to automatic review settings April 23, 2026 10:53
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 ICustomDataComponent to build data directly from ResultContext (removing the RequiredEntry/ordered-list mechanism).
  • Updates CopyData/MergeData to call type.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 input using RecipeInputSlot.CODEC (string form), but existing generated recipe JSONs (e.g. merge_data/change_data_type entries under src/generated/resources/data/anvilcraft/recipe/**) still provide "input": 0 as 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] 浮霜共振器和浮霜重戟制作超限装备时附魔继承异常

2 participants