I'm writing a plugin to control the growth rate of plants based on the seed's itemID. I've been using player.GetActiveItem() to retrieve the item ID of the seed currently held by the player, but once the player runs out of seeds, it throws a NullReferenceException because there is no longer an item in the players hands. 

Any way I can get the itemid from GetComponent<GrowableEntity>() instead?

        private void OnEntityBuilt(Planner plan, GameObject seed)
        {
            try
            {
                var player = plan.GetOwnerPlayer();
                var entity = seed.GetComponent<GrowableEntity>();
                var held = player.GetActiveItem();