Skip to content

Fix BoM highlight not showing for Sophisticated Storage without crafting upgrade #454

Description

@jssda

Background

Previously I reported in [#451] that EMI favorites counts were incorrectly including Sophisticated Storage items as player inventory
items (now fixed).

After testing, the original fix introduced a regression: when a Sophisticated Storage does not have a crafting upgrade installed,
materials missing from the recipe tree are not highlighted in the storage, whereas vanilla chests do highlight them correctly.

Thanks to @P3pp3rF1y for promptly fixing this issue.

Latest Fix

In the latest version (1.4.18+), only getInputSources() in EmiGridMenuInfo.java needs to be modified:

@Override
public List<Slot> getInputSources(C handler) {
    ArrayList<Slot> filterSlot = new ArrayList<>(
        handler.realInventorySlots.strea m()
            .filter(s -> s.mayPickup(Minecraft.getInstanc e().player)).toList()
    );
    List<Slot> slots = handler.getOpenOrFirstCraftingCo ntainer(recipeType).isPresent()
        ? filterSlot
        : getPlayerInventorySlots(handler) ;
    slots.addAll(getCraftingSlots(ha ndler));
    return slots;
}

Fix logic:

  Scenario                    | getInputSources()                              | BoM Highlight | BoM Tree Material
  ---------------------------+---- -------------------------------- ------------+---------------+--- -----------------
  No crafting upgrade        | getPlayerInventorySlots() (excludes storage)  | Highlighted ✅ | Not sufficient ❌
  With crafting upgrade      | filterSlot (includes storage)                  | Not highlighted ✅ | Sufficient ✅

The getPlayerInventorySlots() helper filters out only player inventory slots (index 0–35, container instanceof Inventory) for when no
crafting upgrade is present.

Verification

  1. Open a Sophisticated Storage without a crafting upgrade, place some recipe materials inside
  2. Open EMI recipe tree and favorite a recipe
  3. Close EMI recipe tree and check whether missing materials are highlighted in the storage
  4. Install a crafting upgrade and repeat — storage items should not be highlighted (BoM considers materials sufficient)

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions