I changed the way I define entities to be way more intuitive.
This ASCII representation solves two things at once: describing an entity's shape on the grid, and describing what entities may be placed next to it. This one is shaped like a K, and anything placed next to it must have an edge labelled "111".