diff --git a/MinecraftClient/ChatBots/AutoDrop.cs b/MinecraftClient/ChatBots/AutoDrop.cs index e3250d2d..ddf89d78 100644 --- a/MinecraftClient/ChatBots/AutoDrop.cs +++ b/MinecraftClient/ChatBots/AutoDrop.cs @@ -27,7 +27,7 @@ namespace MinecraftClient.ChatBots { if (!Enum.TryParse(mode, true, out dropMode)) { - LogToConsole("Cannot read drop mode from config. Using include mode."); + LogToConsoleTranslated("bot.autoDrop.no_mode"); } if (dropMode != Mode.Everything) this.itemList = ItemListParser(itemList).ToList(); @@ -120,6 +120,31 @@ namespace MinecraftClient.ChatBots { return Translations.Get("bot.autoDrop.no_item"); } + case "mode": + if (args.Length >= 2) + { + switch (args[1].ToLower()) + { + case "include": + dropMode = Mode.Include; + break; + case "exclude": + dropMode = Mode.Exclude; + break; + case "everything": + dropMode = Mode.Everything; + break; + default: + return Translations.Get("bot.autoDrop.unknown_mode"); // Unknwon mode. Available modes: Include, Exclude, Everything + } + inventoryUpdated = 0; + OnUpdateFinish(); + return Translations.Get("bot.autoDrop.switched", dropMode.ToString()); // Switched to {0} mode. + } + else + { + return Translations.Get("bot.autoDrop.unknown_mode"); + } default: return GetHelp(); } @@ -132,7 +157,7 @@ namespace MinecraftClient.ChatBots private string GetHelp() { - return Translations.Get("general.available_cmd", "on, off, add, remove, list"); + return Translations.Get("general.available_cmd", "on, off, add, remove, list, mode"); } public override void Initialize() @@ -165,7 +190,9 @@ namespace MinecraftClient.ChatBots if (enable) { updateDebounce = updateDebounceValue; - inventoryUpdated = inventoryId; + // Always interact container if available (larger ID) because they included player inventory (ID 0) + if (inventoryId >= inventoryUpdated) + inventoryUpdated = inventoryId; } } @@ -179,6 +206,9 @@ namespace MinecraftClient.ChatBots { foreach (var item in items) { + // Ingore crafting result slot + if (item.Key == 0) + continue; if (itemList.Contains(item.Value.Type)) { // Drop it !! @@ -190,6 +220,9 @@ namespace MinecraftClient.ChatBots { foreach (var item in items) { + // Ingore crafting result slot + if (item.Key == 0) + continue; if (!itemList.Contains(item.Value.Type)) { // Drop it !! @@ -201,6 +234,9 @@ namespace MinecraftClient.ChatBots { foreach (var item in items) { + // Ingore crafting result slot + if (item.Key == 0) + continue; // Drop it !! WindowAction(inventoryUpdated, item.Key, WindowActionType.DropItemStack); } diff --git a/MinecraftClient/McClient.cs b/MinecraftClient/McClient.cs index 15a1a780..0e6253ac 100644 --- a/MinecraftClient/McClient.cs +++ b/MinecraftClient/McClient.cs @@ -1770,6 +1770,7 @@ namespace MinecraftClient // Handle cursor item if (inventoryID == 255 && slotID == -1) { + inventoryID = 0; // Prevent key not found for some bots relied to this event if (inventories.ContainsKey(0)) { if (item != null) diff --git a/MinecraftClient/Resources/lang/en.ini b/MinecraftClient/Resources/lang/en.ini index 380a92f1..fb1f06e1 100644 --- a/MinecraftClient/Resources/lang/en.ini +++ b/MinecraftClient/Resources/lang/en.ini @@ -385,6 +385,9 @@ bot.autoDrop.removed=Removed item {0} bot.autoDrop.not_in_list=Item not in the list bot.autoDrop.no_item=No item in the list bot.autoDrop.list=Total {0} in the list:\n {1} +bot.autoDrop.switched=Switched to {0} mode. +bot.autoDrop.unknown_mode=Unknwon mode. Available modes: Include, Exclude, Everything +bot.autoDrop.no_mode=Cannot read drop mode from config. Using include mode. # AutoFish bot.autoFish.throw=Threw a fishing rod