austinv11 / PeripheralsPlusPlus

A pseudo-port of miscperipherals, with other stuff as well!
GNU General Public License v2.0
25 stars 27 forks source link

Changed Peripherals++ to only use a single Peripheral Provider and made Provider a lot more safe. #109

Closed Vexatos closed 9 years ago

Vexatos commented 9 years ago

This change makes Peripherals++ only add a single Peripheral Provider that will return the correct peripheral for any TileEntity implementing IPlusPlusPeripheral. Not only is it a lot more clean, but it is also a lot more safe as you previously were casting the TileEntity to IPeripheral without checking if it is one of your TileEntities at all.

If you want to add a new TileEntity, simply ensure that it or one of its superclasses implements IPlusPlusPeripheral. There is no need to add new Peripheral Providers anymore.

I moved the log messages for registering Forestry/AE2 blocks to ModBlocks so they still appear.

You might need to clean up imports after merging this; I tried to change as little as possible with this Pull Request.

This will close asiekierka/Computronics#147 as that issue was caused by your Providers throwing a ClassCastException.