NPC despawning

In Terraria, monsters will despawn if you are too far from the monster.

The despawning refers to two rectangles, and both their centers are the monster itself:


 * Rectangle #1: width = 504 blocks, height = 283.5 blocks (approximately the 1920*1080 screen multiplied with 4.2*4.2)
 * Rectangle #2: width = 120 blocks + the width of the monster itself, height = 67.5 blocks + the height of the monster itself.(the 1920*1080 screen plus the monster's size)

On following conditions, the monster will despawn:


 * The monster is not a part of another larger monster. (Such as boss with multiple parts, the worms' parts, etc. But that does not apply to some bosses, including Skeletron/Skeletron Prime, which means that its hands may despawn like other monster.)
 * All the players have been out of the rectangle #2 for at least 12.5s. (750 ticks)
 * All the players are now outside the rectangle #1.