your message class should have two fields: player uuid and button name (and two methods: encode and decode). make an instance of this message class and send it.
edit: also include block position in the message.
World#tickableBlockEntities returns a List of all TileEntities which are an instance of ITickableTileEntity,
World#blockEntityList returns a List of all TileEntities which are in the World
you can copy the List into a World Capability, note: i'm not sure if you remove them from the List if they were also removed from the World