From d9e9e8ed704b63baac12269ca145356c60a0ed47 Mon Sep 17 00:00:00 2001 From: Jacob Keller Date: Mon, 27 Jul 2026 16:21:58 -0700 Subject: [PATCH] Fix toolbar shifting when inventory has items The Farmer_shiftToolbar_Prefix function intercepts the toolbar shifting logic to allow configuring how many rows are shifted. This function checks many conditions to decide when to execute, including whether the inventory has items in it. Checking the number of actual items is incorrect, as it prevents shifting the toolbar when there are any items. We could invert the check to only execute if there is at least one item. Instead, just remove this check and shift regardless of whether there are items in the inventory. While at it, split the conditions over multiple lines, and re-arrange the order so that we check __instance.Items for null prior to attempting to access it, as reported by Copilot. Fixes #5 Signed-off-by: Jacob Keller --- CodePatches.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/CodePatches.cs b/CodePatches.cs index 0f8ef46..4451395 100644 --- a/CodePatches.cs +++ b/CodePatches.cs @@ -455,7 +455,16 @@ public static bool SpecialItem_getTemporarySpriteForHoldingUp_Prefix(SpecialItem public static bool Farmer_shiftToolbar_Prefix(Farmer __instance, bool right) { - if (!Config.ModEnabled || Config.ShiftRows < 1 || Config.ShiftRows >= __instance.Items.Count / 12 || __instance.Items is null || __instance.Items.Count < 37 || __instance.UsingTool || Game1.dialogueUp || !__instance.CanMove || __instance.Items.HasAny() || Game1.eventUp || Game1.farmEvent != null) + if (!Config.ModEnabled + || __instance.Items is null + || Config.ShiftRows < 1 + || Config.ShiftRows >= __instance.Items.Count / 12 + || __instance.Items.Count < 37 + || __instance.UsingTool + || Game1.dialogueUp + || !__instance.CanMove + || Game1.eventUp + || Game1.farmEvent != null) return true; if (Config.ShiftRows == 1) return false;