Skip to content

AutoCrafter: Add per-recipe Ignore NBT toggle for ME input matching#13

Open
NuanKi wants to merge 7 commits intoAedial:mainfrom
NuanKi:Ignore-NBT
Open

AutoCrafter: Add per-recipe Ignore NBT toggle for ME input matching#13
NuanKi wants to merge 7 commits intoAedial:mainfrom
NuanKi:Ignore-NBT

Conversation

@NuanKi
Copy link

@NuanKi NuanKi commented Mar 5, 2026

Adds a per-recipe Ignore NBT toggle to the AutoCrafter. When enabled, the crafter treats ME network inputs as matching by item + meta only, allowing NBT-variant items (e.g., anvil-renamed logs) to be used.

Also: I made some texture variants for the Crafter Speed Upgrades for my own resource pack because I prefer the newer AE2 style. I’m including them here in case you’d like to use them

NBT-Toggle.mp4

return stack.getItem().hashCode() ^ (stack.getMetadata() * 31);
int h = stack.getItem().hashCode() ^ (stack.getMetadata() * 31);

h = 31 * h + (ignoreNbt ? 1 : 0);
Copy link
Owner

Choose a reason for hiding this comment

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

Isn't including the NBT already enough for this? Although it'd make the distribution slightly harder in case of starvation, I guess.

Copy link
Author

Choose a reason for hiding this comment

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

Including NBT is enough for strict matching, and that’s basically what the original code assumed since it did not have an ignore-NBT mode at all.

My changes add ignore-NBT support, and once you allow both strict and ignore-NBT entries to exist at the same time for the same item/meta, the key has to encode which matching mode you’re using.

Copy link
Owner

Choose a reason for hiding this comment

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

No, rather what I'm proposing is not make the difference between the 2, then process NBT Matching recipes first.

Recipe 1 requires 5 X and has NBT matching disabled.
Recipe 2 requires 5 X too and has NBT matching enabled.
We have 10 X (with NBT) and 50 X (without NBT).

Recipe 2 should come first and grab the 10 with NBT (only one fighting for it) + 20 of the other. Then recipe 1 is processed. That's what I meant by starvation, recipes fighting for equal distribution.

Allocation should be the ground source of truth, and return only strictly matching items (we can strictly map NBT-ignoring there), with a single pool (meaning a key that doesn't match NBT-ignore).
It does make the math slightly more complicated, tho, for recipes with unequal ratios.

@Aedial
Copy link
Owner

Aedial commented Mar 5, 2026

Looks good.

Could make a config to switch between the styles, in the current state I don't see anything using them. Also would probably be better to have a more relevant file names (like "modern_1").

NuanKi added 5 commits March 5, 2026 03:26
crafting allocation/extraction pipeline to handle mixed strict + ignore-NBT users.

Highlights:
- Add per-entry ignore-NBT toggle and propagate matching mode through candidate
  collection, validation, allocation, extraction, and pool reservation.
- Extend ItemStackKey with matching-mode awareness (strict vs ignore-NBT) so
  resource accounting remains isolated and deterministic.
- Add cross-reservation logic when strict entries reserve items, preventing
  ignore-NBT buckets from over-reporting remaining availability.
- Add ignore-NBT network extraction path that aggregates compatible variants
  (same item+meta) and extracts safely via snapshot iteration.
- Improve shared-pool initialization/allocation internals to reduce repeated
  ingredient lookups and improve behavior under contention.

Docs:
- Update/expand JavaDocs for 8 touched/added methods to describe matching
  semantics, allocation steps, and extraction behavior.
@NuanKi
Copy link
Author

NuanKi commented Mar 6, 2026

Looks good.

Could make a config to switch between the styles, in the current state I don't see anything using them. Also would probably be better to have a more relevant file names (like "modern_1").

Renamed the textures in 7adda43 to modern_(original name)_(V1 or V2)

@NuanKi
Copy link
Author

NuanKi commented Mar 6, 2026

NBT-Toggle-V2.mp4

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