Skip to content

Unify animated Flux recipe card presentation - #152

Merged
swear01 merged 3 commits into
mainfrom
feat/craftable-animated-recipe-card
Aug 22, 2026
Merged

swear01 merged 3 commits into
mainfrom
feat/craftable-animated-recipe-card

Conversation

@swear01

@swear01 swear01 commented Aug 22, 2026

Copy link
Copy Markdown
Owner

Summary

  • add an explicit, fail-closed Flux Creating Flux Craftable renderer
  • center native, EMI, JEI, and custom diagrams inside the shared recipe bounds
  • keep the shared ledger, navigation, craft controls, and world-station transaction unchanged
  • extend the Flux GUI scenario and active documentation for the visual contract

Verification

  • focused RED -> GREEN static regressions
  • ./gradlew build
  • minimum/latest EMI compile
  • ./gradlew stageAe2CompatAuditAncestry
  • base GameTests 406/406
  • recipe addon 17/17
  • compatibility fixtures and PneumaticCraft 9/9
  • compatibility matrix retry 3/3; first attempt was a host-sensitive 58.279 ms Craftable preparation failure, retry passed
  • Python suite 639/639
  • runData produced no changes beyond the intentional language entries
  • git diff --check

GUI visual approval remains user-owned; the current flux-station handoff was blocked because the normal warm Prism Launcher was not running.

Refs #149

@swear-review

swear-review Bot commented Aug 22, 2026 •

Copy link
Copy Markdown

Swear Review

Mode: Full PR
Model: deepseek-v4-flash
OCR: 1.9.0

Status: ❌ Failed — review infrastructure/model failure.
Reason: OCR review failed: Review failed: 0 finding(s); 14 of 14 selected item(s) failed.

You can retry with /swear-review full.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a custom animated recipe presentation for creating Flux in the Crafting Terminal GUI, implementing FluxRecipeDiagramRenderer to render the 1 redstone to 1 flux dust transaction when using a world station. It also unifies vertical centering logic inside the diagram bounds across Native, EMI, JEI, and Flux renderers. The review feedback focuses on optimizing the rendering loop in FluxRecipeDiagramRenderer by caching ItemStack instances (for Bedrock and Flux Block) in the constructor, thereby avoiding per-frame allocations and registry lookups that could cause garbage collection pressure and micro-stuttering.

Comment on lines +15 to +30
public final class FluxRecipeDiagramRenderer implements RecipeDiagramRenderer {
public static final ResourceLocation RECIPE_ID = ResourceLocation.fromNamespaceAndPath(
AutoStorage.MODID, "flux_station/redstone_to_flux_dust");

private static final ResourceLocation FLUX_BLOCK_ID = ResourceLocation.fromNamespaceAndPath(
"fluxnetworks", "flux_block");
private static final ResourceLocation FLUX_DUST_ID = ResourceLocation.fromNamespaceAndPath(
"fluxnetworks", "flux_dust");
private static final ResourceLocation REDSTONE_ID = ResourceLocation.fromNamespaceAndPath(
"minecraft", "redstone");
private static final ResourceLocation STATION_ID = ResourceLocation.fromNamespaceAndPath(
AutoStorage.MODID, "flux_station");
private static final int CONTENT_WIDTH = 128;
private static final int CONTENT_HEIGHT = 80;
private static final int ANIMATION_TICKS = 80;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

Instantiating ItemStack and performing registry lookups during the render loop (which runs every frame) creates significant garbage collection pressure and micro-stuttering. We should cache the ItemStack instances for Bedrock and the Flux Block in the renderer's constructor to avoid per-frame allocations and lookups.

public final class FluxRecipeDiagramRenderer implements RecipeDiagramRenderer {
    public static final ResourceLocation RECIPE_ID = ResourceLocation.fromNamespaceAndPath(
            AutoStorage.MODID, "flux_station/redstone_to_flux_dust");

    private static final ResourceLocation FLUX_BLOCK_ID = ResourceLocation.fromNamespaceAndPath(
            "fluxnetworks", "flux_block");
    private static final ResourceLocation FLUX_DUST_ID = ResourceLocation.fromNamespaceAndPath(
            "fluxnetworks", "flux_dust");
    private static final ResourceLocation REDSTONE_ID = ResourceLocation.fromNamespaceAndPath(
            "minecraft", "redstone");
    private static final ResourceLocation STATION_ID = ResourceLocation.fromNamespaceAndPath(
            AutoStorage.MODID, "flux_station");
    private static final int CONTENT_WIDTH = 128;
    private static final int CONTENT_HEIGHT = 80;
    private static final int ANIMATION_TICKS = 80;

    private final ItemStack bedrockStack = new ItemStack(Blocks.BEDROCK);
    private final ItemStack fluxBlockStack;

    public FluxRecipeDiagramRenderer() {
        Block fluxBlock = BuiltInRegistries.BLOCK.get(FLUX_BLOCK_ID);
        this.fluxBlockStack = new ItemStack(fluxBlock == Blocks.AIR ? Blocks.BEDROCK : fluxBlock);
    }

Comment on lines +132 to +135
graphics.renderComponentTooltip(font, List.of(Component.translatable(
"gui.auto_storage.flux_recipe.base_options",
new ItemStack(Blocks.BEDROCK).getHoverName(),
fluxName)), mouseX, mouseY);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

Reuse the cached bedrockStack to retrieve the hover name instead of allocating a new ItemStack instance.

Suggested change
graphics.renderComponentTooltip(font, List.of(Component.translatable(
"gui.auto_storage.flux_recipe.base_options",
new ItemStack(Blocks.BEDROCK).getHoverName(),
fluxName)), mouseX, mouseY);
graphics.renderComponentTooltip(font, List.of(Component.translatable(
"gui.auto_storage.flux_recipe.base_options",
bedrockStack.getHoverName(),
fluxName)), mouseX, mouseY);

Comment on lines +181 to +186
private static ItemStack baseStack(float progress) {
Block base = progress < 0.5F
? Blocks.BEDROCK
: BuiltInRegistries.BLOCK.get(FLUX_BLOCK_ID);
return new ItemStack(base == Blocks.AIR ? Blocks.BEDROCK : base);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

Simplify baseStack to return the cached ItemStack instances directly, avoiding per-frame allocations and registry lookups.

    private ItemStack baseStack(float progress) {
        return progress < 0.5F ? bedrockStack : fluxBlockStack;
    }

@swear01

swear01 commented Aug 22, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e697c12a1c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread docs/notes.md Outdated
@@ -1,4 +1,4 @@
2026-08-22 CurseMaven CI transport correction:GitHub Actions repeatedly received HTTP 429 from the Cloudflare-fronted `www.cursemaven.com` endpoint while resolving generated POMs, although the pinned Flux Networks jar remained valid. All CurseMaven repository declarations now use the documented Cleanroom endpoint `https://curse.cleanroommc.com`; its exact Flux artifact resolves in a clean Gradle cache with the existing SHA-256 pin. The beta `cfa2.cursemaven.com` route is not used as a production fallback.
2026-08-22 Craftable animated Flux presentation:Flux 的 `Creating Flux` 只在明確的 `auto_storage:flux_station/redstone_to_flux_dust` presentation ID、`WORLD_STATION` kind、1×1 redstone→flux_dust、Flux Station 與單一輸出語意全部吻合時啟用;任何 recipe override 或語意漂移都回到普通 renderer。Native、EMI、JEI 與 Flux 共用 diagram bounds 的垂直置中;EMI、JEI 與 Flux 自己以 scissor 裁切,Native 依 geometry 內的 slot bounds 繪製。Flux 自己繪製站點動畫,不重複 shared station badge。`flux-station` GUI scenario 另驗動畫留在同一 Craftable card、共用 ledger/navigation/craft controls,並說明 bedrock/flux_block 兩種 base。\n\n2026-08-22 CurseMaven CI transport correction:GitHub Actions repeatedly received HTTP 429 from the Cloudflare-fronted `www.cursemaven.com` endpoint while resolving generated POMs, although the pinned Flux Networks jar remained valid. All CurseMaven repository declarations now use the documented Cleanroom endpoint `https://curse.cleanroommc.com`; its exact Flux artifact resolves in a clean Gradle cache with the existing SHA-256 pin. The beta `cfa2.cursemaven.com` route is not used as a production fallback.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P3 Badge Replace the literal newline escape sequences

The inserted \n\n is stored as literal text rather than Markdown line breaks, so the new entry and the existing CurseMaven entry render as one paragraph with visible escape characters. The same mistake on docs/plan.md:1 absorbs the previous plan item into the new list item; replace these sequences with actual newlines.

Useful? React with 👍 / 👎.

Comment on lines +65 to +69
graphics.enableScissor(
left + diagram.x(),
top + diagram.y(),
left + diagram.right(),
top + diagram.bottom());

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Complete the required Flux visual gate

This player-visible renderer and the simultaneous native/EMI/JEI recentering were committed without a completed flux-station Prism handoff—the commit records that the launch was blocked because a warm Prism process was absent. Consequently, clipping, scaled tooltip hitboxes, and the animated base explanation have no required current-run evidence; run python3 scripts/run_prism_gui_session.py --scenario flux-station and complete the user checklist before treating the change as ready.

AGENTS.md reference: AGENTS.md:L183-L183

Useful? React with 👍 / 👎.

@swear01

swear01 commented Aug 22, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Hooray!

Reviewed commit: f32bf11f63

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@swear01
swear01 merged commit 1bbc459 into main Aug 22, 2026
1 of 2 checks passed
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.

1 participant