Skip to content

Conversation

@solidDoWant
Copy link
Owner

JEI's "Move Items" button failed to transfer fluids to the native AE2 Pattern Terminal when EnderCore/EnderIO was present. Fluids were completely omitted from the pattern, while items worked correctly. The Extended Pattern Terminal was unaffected.

Root Cause

JEI's RecipeRegistry creates an immutable snapshot of recipe transfer handlers during construction. The original approach attempted to replace AE2's handler via reflection by modifying RecipeTransferRegistry, but this had two fatal flaws:

  1. Non-deterministic plugin load order: JEI loads @JEIPlugin classes in an undefined order (from ASMDataTable.getAll() which returns an unordered Set). Sometimes our plugin loaded before AE2's, sometimes after.
  2. Immutable handler cache: Even when the source registry was successfully modified via reflection, RecipeRegistry already held a frozen ImmutableTable snapshot taken during startup. Runtime modifications were never seen by the actual handler lookup code.

Solution

Implemented a Mixin (RecipeRegistryMixin) that intercepts RecipeRegistry.getRecipeTransferHandler() at runtime:

  • Detects when the lookup is for ContainerPatternTerm
  • Replaces AE2's fluid-unaware handler with our custom handler that converts fluids to fluid encoder items
  • Works regardless of plugin load order since it intercepts the actual runtime lookup

Changes

  1. Added RecipeRegistryMixin.java - Mixin that intercepts handler lookups
  2. Simplified JeiPlugin.java - Removed complex reflection code, now only registers Extended Pattern Terminal handler
  3. Fixed RecipeTransferHandler.java - Force processing mode for fluids to avoid slot conflicts
  4. Updated mixins.gregtechenergistics.json - Registered the new mixin

Testing

Verified with EnderCore/EnderIO enabled across multiple restarts - fluids now consistently appear as fluid encoder items when using JEI's "Move Items" button on the native AE2 Pattern Terminal.

Signed-off-by: solidDoWant <fred.heinecke@yahoo.com>
Signed-off-by: solidDoWant <fred.heinecke@yahoo.com>
Copy link

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

Fixes JEI “Move Items” failing to transfer fluids into AE2’s native Pattern Terminal when EnderCore/EnderIO affects plugin load order, by replacing the runtime recipe transfer handler lookup instead of trying to mutate JEI’s startup snapshot.

Changes:

  • Added a JEI RecipeRegistry Mixin to override the handler returned for ContainerPatternTerm.
  • Simplified the JEI plugin registration to only register the Extended Pattern Terminal handler via public API.
  • Adjusted recipe transfer logic to avoid slot conflicts by forcing “processing mode” for fluids and adding null-guards.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
src/main/resources/mixins.gregtechenergistics.json Registers the new JEI mixin so runtime handler interception is applied.
src/main/java/com/soliddowant/gregtechenergistics/mixins/jei/RecipeRegistryMixin.java Intercepts RecipeRegistry.getRecipeTransferHandler and swaps AE2’s handler for the mod’s handler for ContainerPatternTerm.
src/main/java/com/soliddowant/gregtechenergistics/integration/jei/RecipeTransferHandler.java Changes transfer behavior for fluids and server-side merging/preserve-slot logic.
src/main/java/com/soliddowant/gregtechenergistics/integration/jei/JeiPlugin.java Removes reflection-based registry mutation; registers only the extended terminal handler.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

Copilot AI commented Jan 20, 2026

@solidDoWant I've opened a new pull request, #14, to work on those changes. Once the pull request is ready, I'll request review from you.

Copilot AI and others added 3 commits January 20, 2026 02:10
* Initial plan

* Fix hasInputFluids and hasOutputFluids calculation

Co-authored-by: solidDoWant <16456946+solidDoWant@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: solidDoWant <16456946+solidDoWant@users.noreply.github.com>
Signed-off-by: solidDoWant <fred.heinecke@yahoo.com>
Signed-off-by: solidDoWant <fred.heinecke@yahoo.com>
Copy link

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

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

Copilot AI commented Jan 20, 2026

@solidDoWant I've opened a new pull request, #15, to work on those changes. Once the pull request is ready, I'll request review from you.

solidDoWant and others added 3 commits January 20, 2026 08:26
Signed-off-by: solidDoWant <fred.heinecke@yahoo.com>
…EI (#15)

* Initial plan

* Add IMixinConfigPlugin to gate JEI mixin behind mod presence check

Co-authored-by: solidDoWant <16456946+solidDoWant@users.noreply.github.com>

* Use startsWith for more precise JEI mixin package detection

Co-authored-by: solidDoWant <16456946+solidDoWant@users.noreply.github.com>

* Make JEI package detection more robust using mixinPackage parameter

Co-authored-by: solidDoWant <16456946+solidDoWant@users.noreply.github.com>

* Extract JEI constants and fix formatting

Co-authored-by: solidDoWant <16456946+solidDoWant@users.noreply.github.com>

* Add documentation for JEI package convention

Co-authored-by: solidDoWant <16456946+solidDoWant@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: solidDoWant <16456946+solidDoWant@users.noreply.github.com>
Signed-off-by: solidDoWant <fred.heinecke@yahoo.com>
Copy link

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

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

Copilot AI commented Jan 20, 2026

@solidDoWant I've opened a new pull request, #16, to work on those changes. Once the pull request is ready, I'll request review from you.

Signed-off-by: solidDoWant <fred.heinecke@yahoo.com>
@solidDoWant solidDoWant merged commit 491b1b7 into main Jan 20, 2026
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.

2 participants