Skip to content
This repository was archived by the owner on Dec 8, 2025. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion CraftingGUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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;
Expand Down