When producing code similar to the furnace's, I stumbled upon a bug. For furnaces, it's only a performance bug, but it can potentially become a 'real' one in other instances.
When a furnace gets lit or runs out of fuel, it changes its block ID. For that, it caches the tile entity, and then sets original one over the new one that's generated. The 'new' tile entity stays in the arrays though, producing a ghost tile entity (that still gets updated!) every time the furnace state is changed.
What I expected to happen was...:
The newly produced tile entity to get deleted.
What actually happened was...:
It got reproduced and became a ghost in the tile entity arrays.
Steps to Reproduce:
*Keep track of all furnace entities in game.
*Light a furnace
*Let it run out of fuel
*Watch the number of furnace tile entities growing.
I know you don't use the same names as MCP does, but I did this:
Before setting a tile entity (setBlockTileEntity) inside World, make sure to run through all tile entity inside addedTileEntityList and loadedTileEntityList, and delete all with the same x, y, and z coord.