Make peripherals a capability
SquidDev opened this issue ยท 5 comments
- Register peripherals as a capability.
- Make the internal
Peripherals.getPeripheralAt
return aLazyOptional
- Subscribe to optional invalidations and treat it as a block update.
Would I be right in saying this is a requirement for mods which want to add optional support for CC: Tweaked?
In my case, PneumaticCraft: Repressurized, which had optional support for ComputerCraft in 1.12.2 via the Optional.Interface
system, which is of course no longer a thing. Sounds like an IPeripheral
capability is exactly what I need here...
It's not a requirement - one can register an IPeripheralProvider
instead, which effectively does the same thing. It just feels that capabilities are the more natural way to do things on recent Forge versions.
I've a local branch which implements this, I just need to work out a few things. LazyOptional does incur a bit of boilerplate, which I'd like to minimise.
That said, I'd probably hold off on doing anything with the API for a week or two. The 1.15 version is still in alpha as there's a couple of breaking changes to the API I'd like to get out (#447).
Thanks - yeah, I'd forgotten about IPeripheralProvider
. I'll hold off for now then and see how things work out.
Fixed in 5409d44.