AutoCrafter: Add per-recipe Ignore NBT toggle for ME input matching#13
AutoCrafter: Add per-recipe Ignore NBT toggle for ME input matching#13NuanKi wants to merge 7 commits intoAedial:mainfrom
Conversation
src/main/java/com/ae2powertools/features/crafter/GuiAutoCrafter.java
Outdated
Show resolved
Hide resolved
| return stack.getItem().hashCode() ^ (stack.getMetadata() * 31); | ||
| int h = stack.getItem().hashCode() ^ (stack.getMetadata() * 31); | ||
|
|
||
| h = 31 * h + (ignoreNbt ? 1 : 0); |
There was a problem hiding this comment.
Isn't including the NBT already enough for this? Although it'd make the distribution slightly harder in case of starvation, I guess.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
|
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"). |
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.
Renamed the textures in 7adda43 to modern_(original name)_(V1 or V2) |
NBT-Toggle-V2.mp4 |
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