CC: Tweaked

CC: Tweaked

57M Downloads

Make peripherals a capability

SquidDev opened this issue ยท 5 comments

commented
  • Register peripherals as a capability.
  • Make the internal Peripherals.getPeripheralAt return a LazyOptional
  • Subscribe to optional invalidations and treat it as a block update.
commented

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...

commented

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).

commented

Thanks - yeah, I'd forgotten about IPeripheralProvider. I'll hold off for now then and see how things work out.

commented

Fixed in 5409d44.

commented

org.squiddev:cc-tweaked-1.15.2:1.88.0 has now been released, which should now have a stable API.