public override void Click(UIMouseEvent evt) { if (item == null && Main.mouseItem.IsAir) { return; } //if the player isnt holding anything but something is equipped, unequip it Codex codex = (Parent as Codex); if (item != null && Main.mouseItem.IsAir) { item = null; Main.PlaySound(SoundID.Grab); codex.ShownRecipes.Clear(); codex.RefreshRecipes(); return; } //if nothing is equipped, equip the held item if (item == null) { item = Main.mouseItem.Clone(); Main.PlaySound(SoundID.Grab); UpdateParent(item); } //if something is equipped, swap that for the held item else { item = Main.mouseItem.Clone(); Main.PlaySound(SoundID.Grab); UpdateParent(item); } codex.RefreshRecipes(); }
public override void Update(GameTime gameTime) { if (IsMouseHovering) { Main.LocalPlayer.mouseInterface = true; Main.isMouseLeftConsumedByUI = true; } if (!Codex.Crafting) { Codex codex = (Parent as Codex); item = null; codex.ShownRecipes.Clear(); codex.RefreshRecipes(); } }