diff --git a/CraftingGUI.cs b/CraftingGUI.cs index 6cf092f5..37417ca7 100644 --- a/CraftingGUI.cs +++ b/CraftingGUI.cs @@ -1485,6 +1485,9 @@ private static void HoverStation(int slot, ref int hoverSlot) private static void HoverRecipe(int slot, ref int hoverSlot) { + if (TryDepositMouseItem()) + return; + int visualSlot = slot; slot += numColumns * (int) Math.Round(scrollBar.ViewPosition); if (slot < recipes.Count) @@ -1535,6 +1538,22 @@ private static void HoverRecipe(int slot, ref int hoverSlot) } } + private static bool TryDepositMouseItem() + { + Player player = Main.LocalPlayer; + if (MouseClicked && !Main.mouseItem.IsAir && player.itemAnimation == 0 && player.itemTime == 0) + { + if (TryDepositResult(Main.mouseItem)) + { + RefreshItems(); + Main.PlaySound(SoundID.Grab); + return true; + } + } + + return false; + } + private static void SetSelectedRecipe(Recipe recipe) { if (recipe != null) @@ -1625,6 +1644,9 @@ private static void HoverItem(int slot, ref int hoverSlot) private static void HoverStorage(int slot, ref int hoverSlot) { + if (TryDepositMouseItem()) + return; + int visualSlot = slot; slot += numColumns2 * (int) Math.Round(scrollBar2.ViewPosition); if (slot < storageItems.Count) @@ -1659,7 +1681,7 @@ private static void HoverResult(int slot, ref int hoverSlot) if (MouseClicked) { bool changed = false; - if (!Main.mouseItem.IsAir && player.itemAnimation == 0 && player.itemTime == 0 && result != null && Main.mouseItem.type == result.type) + if (!Main.mouseItem.IsAir && player.itemAnimation == 0 && player.itemTime == 0) { if (TryDepositResult(Main.mouseItem)) changed = true;