Register the damage-indicated fluid container handler at the lowest priority - #246
Merged
rubensworks merged 2 commits intoSep 21, 2026
Conversation
…riority DamageIndicatedItemFluidContainer registers a generic FluidHandlerItemCapacity for every subclass. A subclass whose own mod registers a more specific handler for the same item ends up with two competing providers, and NeoForge returns the first registered non-null one. RegisterCapabilitiesEvent is dispatched per event priority first and per mod second, so at equal priority the winner is decided by the mod load order between cyclopscore and the subclass' mod. That order is a topological tie-break over mod file discovery order whenever the dependency declares ordering="NONE", so it shifts with the rest of the mod set. EvilCraft's creative blood drop hits this: when cyclopscore registers first, a fresh stack resolves to the generic finite handler and reports an empty container, which silently turns the item into a useless one. It showed up as a blood infuser game test failing in the bigger pack test mod sets only. This handler is a fallback, so it now registers at EventPriority.LOWEST and any subclass registration wins regardless of mod load order. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FZV1n6KyUT6snFM4rf4hVs
This was referenced Sep 21, 2026
rubensworks
commented
Sep 21, 2026
rubensworks
deleted the
claude/damage-indicated-fluid-container-capability-priority
branch
September 21, 2026 14:37
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Replaces CyclopsMC/EvilCraft#1269, #1270 and #1271, which patched this at the EvilCraft end. Fixing it here is cleaner and covers every subclass in every dependent mod at once.
The bug
DamageIndicatedItemFluidContainerregisters a genericFluidHandlerItemCapacityfor every subclass, from its constructor, on CyclopsCore's mod bus. When the subclass' own mod registers a more specific handler for the same item, that item has two competing providers.ItemCapability#getCapabilityreturns the first registered non-null provider.RegisterCapabilitiesEventgoes throughModLoader.postEventWrapContainerInModOrder, andpostEventWithWrapInModOrderloops overEventPriority.values()on the outside andModList.forEachModInOrderon the inside. So at equal priority the winner is decided purely by mod load order.That order is not stable. A dependency declared with
ordering="NONE"creates no edge inModSorter's graph, so the two mods are ordered byTopologicalSort's tie-break, which is aPriorityQueuekeyed on each mod's index in the discovery order. Add or remove unrelated mods and the order can flip.How it showed up
EvilCraft's creative blood drop registers an infinite handler from
ItemCreativeBloodDropConfig, and EvilCraft declaresordering="NONE"forcyclopscore. When cyclopscore won the race, a fresh creative blood drop resolved to the generic finite handler, which on a fresh stack contains nothing — the item silently became useless.In CI it surfaced as
testBloodInfuserEmptyFluidContainerCreativeBloodDropfailing in thecyclops-all-depspack test only, and only on 26.1.2:EmptyFluidContainerInTankTickAction#canTicksaw an empty container and returnedfalseon every tick, so the drain never ran once. Hencewas 0rather than a partial amount. It was never a timeout: the drain moves 100 mB/tick and needs 100 of the 200 available ticks.The change
The handler registered here is a fallback, so it registers at
EventPriority.LOWEST. Any subclass registration, at any higher priority (including the defaultNORMAL), is therefore always considered first, whatever the mod load order. Subclasses that register nothing of their own are unaffected — the fallback is still the only provider.Verification
Built CyclopsCore with and without this change, published each to mavenLocal, and ran EvilCraft
master-26-ltsunmodified against both. To pin the mod ordering deterministically (rather than relying on whichever order this machine happens to produce), EvilCraft's own registration was temporarily moved toEventPriority.LOW— reproducing exactly the "cyclopscore is considered first" condition:NORMAL)Expected Blood infuser tank contents to be 10000: was 0 on tick 202— the CI failure, byte for byteLOWEST)The one-line priority change is the only variable between those two runs.
CyclopsCore's own
./gradlew build,testandrunGameTestServerall pass,spotlessApplyapplied.Note on a regression test
I did not add one here: CyclopsCore has no
DamageIndicatedItemFluidContainersubclass of its own and no game-test content items, so covering this would mean inventing a test item plus a competing registration purely for the test — more machinery than the fix. The EvilCraft PRs carried aGameTestsItemCreativeBloodDropthat asserts the creative blood drop's fluid handler directly and fails in one legible line; happy to re-propose that against EvilCraft separately if you want the guard.Downstream
EvilCraft needs no change once this is released, beyond the usual
cyclopscore_versionbump. The packtestsBuild (server, cyclops-all-deps, 26.1.2, neoforge)job goes green once it picks up a CyclopsCore build carrying this.Generated by Claude Code