feat: capability-lookup wrapper (Phase 1) + public GameTest assertions - #12
Merged
Conversation
Add ArchieCapabilityExposure.kt, wrapping Common Storage Lib's ItemApi/ FluidApi/EnergyApi.BLOCK singletons so BlockEntity-backed storage can be exposed to third-party pipes/hoppers on both loaders with one call at registration time (exposeItemStorage/exposeFluidStorage/exposeEnergyStorage, plus RegistrySupplier convenience overloads and a stretch Item.exposeItemStorage via ItemApi.ITEM). Update ArchieEnergyStorage's KDoc to point at the new helper. Add CapabilityLookupTests/CapabilityLookupTestFixtures to Archie-Test, verifying the wrapper actually reaches ItemApi.BLOCK.find (not just Archie-internal bookkeeping) against a real registered BlockEntityType (TileRegistry.TestTile) - fixture registration runs at mod-init time (after TileRegistry.init()), matching real consumer-mod usage, since CSL's BlockLookup.onRegister is a one-shot listener that fires during CSL's own platform registration event, long before a GameTest server boots. Also make GameTestAssertions.kt's assertTrue/assertEquals/expectThrows public and move them from the internal gametest.internal.tests package to the public net.kernelpanicsoft.archie.gametest package, so consuming mods (including Archie-Test) can use them instead of hand-rolled fail(...) checks. Update the 3 server-side test files that used them via same-package resolution to import explicitly, and update docs/gametest.md and AGENTS.md to match. Verified: :common:compileKotlin and :common-test:compileKotlin both clean, and CapabilityLookupTests all pass under a real fabric-test:runGametest run. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
KP2048
marked this pull request as ready for review
August 8, 2026 15:32
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.
Phase 1 of the pre-release storage/GUI plan: capability-lookup wrapper
Wraps Common Storage Lib's
ItemApi/FluidApi/EnergyApi.BLOCKsingletons (alreadytransitively on Archie's classpath, no new Gradle dependency) so
ArchieItemStorage/ArchieFluidStorage/ArchieEnergyStoragecan be exposed to third-party mods' pipes andhoppers on both loaders with one call at registration time — closing the gap called out
explicitly in
ArchieEnergyStorage's own KDoc.New API —
net.kernelpanicsoft.archie.transfer.ArchieCapabilityExposureexposeItemStorage/exposeFluidStorage/exposeEnergyStorageonBlockEntityType<T>,each with a direction-aware and a no-direction overload, wrapping CSL's
BlockLookup.onRegister { registrar -> registrar.registerBlockEntities(...) }(the onlyreachable path for
BlockEntityGetter-based registration — confirmed viajavapagainstthe real CSL jars;
registerSelfonly acceptsBlock-keyedBlockGetter).RegistrySupplier<BlockEntityType<T>>convenience overloads via Architectury's.listen{},for calling right next to a
DeferredRegisterdeclaration.Item.exposeItemStorageviaItemApi.ITEM, for item-in-item interop with otherCSL-depending mods.
NBTHolder.itemField/etc. — registration must happenonce per
BlockEntityType, while those delegates run per-instance; an explicit call atregistration time avoids awkward static bookkeeping.
Verification
New
CapabilityLookupTests/CapabilityLookupTestFixturesin Archie-Test, registered atmod-init time (after
TileRegistry.init(), mirroring real consumer-mod usage — CSL'sonRegisteris a one-shot listener that fires during CSL's own platform registration event,long before a GameTest server boots, so this can't live inside the
@GameTestmethodsthemselves). All 3 pass under a real
fabric-test:runGametestrun:Manual-only (not GameTest-coverable): a real hopper/pipe mod on both Fabric and NeoForge
pulling/pushing into a block exposing
ArchieItemStorage, before release.Also in this PR: make
GameTestAssertions.ktpublicassertTrue/assertEquals/expectThrowswereinternalto Archie's owncommonmodule,so Archie-Test's new tests above couldn't use them despite being the obvious sugar for this
kind of test. Moved from
gametest.internal.teststo the publicnet.kernelpanicsoft.archie.gametestpackage (alongside
AClientGameTestHarness.kt) and made public; updated the 3 server-sidetest files that referenced them via same-package resolution to import explicitly, and updated
docs/gametest.md/AGENTS.mdto match.Part of the three-feature pre-release plan (capability lookup / data attachments / item-backed
container menus); Phases 2 and 3 to follow in separate PRs.
🤖 Generated with Claude Code