Moved some code to the tile entity