private void OnMenuChanged(object s, EventArgsClickableMenuChanged e) { if (e.NewMenu?.GetType().FullName != "CJBItemSpawner.ItemMenu") { return; } Log.Trace("Overriding CJB Item Spawner menu items..."); CurrentMenu = e.NewMenu; var itemListField = _itemListField ?? (_itemListField = CurrentMenu.GetType().GetInstanceField("itemList")); var itemList = CurrentMenu.GetFieldValue <List <Item> >(itemListField); for (var i = 0; i < itemList.Count; ++i) { var item = itemList[i] as Object; if (item == null) { continue; } itemList[i] = Wrapper.Instance.Wrap(item); } var loadInventoryMethod = _loadInventoryMethod ?? (_loadInventoryMethod = CurrentMenu.GetType().GetInstanceMethod("loadInventory")); loadInventoryMethod.Invoke(CurrentMenu, null); Log.Trace("Overrided CJB Item Spawner menu items."); }