Ender IO Zoo

Ender IO Zoo

961k Downloads

Capabilities using AttachCapabilitiesEvent

LatvianModder opened this issue ยท 3 comments

commented

Seems like it could easily be done with hasCapablity()/getCapability() for both items and tile entities. Isn't really a problem for TileEntities, but new ItemStack instances are created constantly, especially when there is AE/RS system.

Some places where its used:

https://github.com/SleepyTrousers/EnderIO/blob/6720c7319f1c53863d74e3ca99aaadd9bc97c83b/enderio-base/src/main/java/crazypants/enderio/base/item/darksteel/upgrade/energy/EnergyUpgradePowerAdapter.java#L19-L29

https://github.com/SleepyTrousers/EnderIO/blob/f026ef9c35a56159b4fef7b6c1990055014ac61a/enderio-base/src/main/java/crazypants/enderio/base/power/forge/ForgeAdapter.java#L66-L76

  • DS Items
  • TEs
  • Other Items
  • Old plugable cap infrastructure
commented

I actually plan on doing this, the current state is a side-effect of us supporting 3 different energy systems in the past.

commented

AttachCapabilitiesEvent replaced with MixIn acouple weeks ago.

commented

If we do that we move the boilerplate into the implementation, requiring any subtype of IDarkSteelItem etc to copypaste code that can be done generically in this event instead.