MinecraftForge/MinecraftForge — pull request #1001 by target-san (2014-03-13 11:02:30+00:00)
Title: Tile entity get behavior

This PR shows a way of migrating TE to dynamic behavior resolution, instead of currently used instanceof+typecast. I thought that a single PR would speak for itself better than tons of pages on forum.
I don't expect this PR to be merged - this is more of a concept or sketch. And even if such changes would be taken into account, I don't think they would happen before MC 1.8
Main changes are in TileEntity and Util classes, all other patched files are just brought in sync to TE changes

Pros of this approach:
+ TileEntity can function as a transparent proxy for other tiles, or a 'transparent' container for parts. As example, we potentially won't need to subclass Forge Multipart TE class to integrate pipes/wires/etc as multipart.
+ More convenient way of presenting temporary or sided behaviors. As example, you won't need ISidedInventory - just return IInventory on some sides and don't return on the other ones.

Cons:
- Would require to rewrite large portions of code. This might even need to be done on Mojang side.
- I still have no good idea on how to prohibit/discourage modders from using instanceof and move to getBehavior; making a proxy class would require to hide TE's public mutable fields behind accessor methods