1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2024-06-28 08:03:21 +00:00
CC-Tweaked/src/main/java/dan200/computercraft
SquidDev 5409d441b5 Expose peripherals as a capability
This registers IPeripheral as a capability. As a result, all (Minecraft
facing) functionality operates using LazyOptional<_>s instead.

Peripheral providers should now return a LazyOptional<IPeripheral> too.
Hopefully this will allow custom peripherals to mark themselves as
invalid (say, because a dependency has changed).

While peripheral providers are somewhat redundant, they still have their
usages. If a peripheral is applied to a large number of blocks (for
instance, all inventories) then using capabilities does incur some
memory overhead.

We also make the following changes based on the above:
 - Remove the default implementation for IWiredElement, migrating the
   definition to a common "Capabilities" class.

 - Remove IPeripheralTile - we'll exclusively use capabilities now.
   Absurdly this is the most complex change, as all TEs needed to be
   migrated too.

   I'm not 100% sure of the correctness of this changes so far - I've
   tested it pretty well, but blocks with more complex peripheral logic
   (wired/wireless modems and turtles) are still a little messy.

 - Remove the "command block" peripheral provider, attaching a
   capability instead.
2020-05-15 17:09:12 +01:00
..
api Expose peripherals as a capability 2020-05-15 17:09:12 +01:00
client Merge branch 'mc-1.14.x' into mc-1.15.x 2020-05-13 14:36:39 +01:00
core Replace getMethodNames/callMethod with annotations (#447) 2020-05-15 13:21:16 +01:00
data Merge branch 'mc-1.14.x' into mc-1.15.x 2020-05-04 10:05:32 +01:00
shared Expose peripherals as a capability 2020-05-15 17:09:12 +01:00
ComputerCraft.java Merge branch 'mc-1.14.x' into mc-1.15.x 2020-05-13 14:36:39 +01:00
ComputerCraftAPIImpl.java Expose peripherals as a capability 2020-05-15 17:09:12 +01:00