Ejemplo n.º 1
0
            private static void OnCrafted(object sender, EventArgs e)
            {
                var heldItem = CraftingMenu.GetField <Item>("heldItem") as Object;

                if (PreviousCraftedObject == heldItem)
                {
                    return;
                }

                var args = new ObjectEventArgs(heldItem);

                CraftedObjectChanged?.Invoke(args);
                if (heldItem != args.Object)
                {
                    CraftingMenu.SetField <Item>("heldItem", PreviousCraftedObject = args.Object);
                }
            }
Ejemplo n.º 2
0
            public static void OnUpdateTick(object sender, EventArgs e)
            {
                var activeObject = Game1.player.ActiveObject;

                if (activeObject == PreviousActiveObject)
                {
                    return;
                }

                var args = new ObjectEventArgs(activeObject);

                ActiveObjectChanged?.Invoke(args);
                if (activeObject != args.Object)
                {
                    PreviousActiveObject = Game1.player.ActiveObject = args.Object;
                }
            }