Skip to content

ArchieCapabilityExposure

Exposes ArchieItemStorage/ArchieFluidStorage/ArchieEnergyStorage to third-party mods' pipes/hoppers/etc, by registering against Common Storage Lib's ItemApi/FluidApi/EnergyApi BLOCK lookups - which are, unlike a lookup you'd build yourself via BlockLookup.create, the real, already-canonical singletons Common Storage Lib itself wires straight through to each platform's native capability system (Fabric Transfer API's ItemStorage.SIDED/FluidStorage.SIDED, NeoForge's Capabilities.ItemHandler.BLOCK/Capabilities.FluidHandler.BLOCK). Registering here makes a block entity's storage visible to any mod querying those native systems directly - no dependency on Common Storage Lib (or Archie) required on the consuming side.

Deliberately explicit opt-in, not wired into net.kernelpanicsoft.archie.serialization.NBTHolder.itemField/ fluidField/energyField: registration must happen exactly once per BlockEntityType, while those field delegates run once per block entity instance (inside its constructor) - auto-registering from there would either re-register redundantly per instance or need awkward static bookkeeping. Call these once, at registration time, next to your DeferredRegister/RegistrySupplier declarations:

object BlockEntities : ADeferredRegistryHolder<BlockEntityType<*>>(MyMod.MOD, Registries.BLOCK_ENTITY_TYPE) {
    val TANK by register("tank") { BlockEntityType.Builder.of(::TankBlockEntity, MyBlocks.TANK).build(null) }
}

// In mod init, after BlockEntities.init():
BlockEntities.TANK.exposeFluidStorage { tank -> tank.fluid }