From 259ef80cf97b18a55da0f4b810460e1e49e1711a Mon Sep 17 00:00:00 2001 From: ORelio Date: Tue, 28 Dec 2021 11:15:11 +0100 Subject: [PATCH] Inventory: Select foreground container (#1875) When several containers are open "/inventory container" will select the container with highest ID (i.e. foreground container) --- MinecraftClient/Commands/Inventory.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MinecraftClient/Commands/Inventory.cs b/MinecraftClient/Commands/Inventory.cs index 7c3ff730..b164662a 100644 --- a/MinecraftClient/Commands/Inventory.cs +++ b/MinecraftClient/Commands/Inventory.cs @@ -69,8 +69,8 @@ namespace MinecraftClient.Commands { List availableIds = handler.GetInventories().Keys.ToList(); availableIds.Remove(0); // remove player inventory ID from list - if (availableIds.Count == 1) - inventoryId = availableIds[0]; // one container, use it + if (availableIds.Count > 0) + inventoryId = availableIds.Max(); // use foreground container else return Translations.Get("cmd.inventory.container_not_found"); } else if (args[0].ToLower() == "help")