Fix player inventory being deleted by server (#1430)

* Fix auto drop crash

* Fix player inventory being deleted by server
This commit is contained in:
ReinforceZwei 2021-01-31 08:25:04 +08:00 committed by GitHub
parent f5f1a22b93
commit d19764869c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 2 deletions

View file

@ -1757,8 +1757,13 @@ namespace MinecraftClient
public void OnInventoryClose(int inventoryID)
{
if (inventories.ContainsKey(inventoryID))
inventories.Remove(inventoryID);
{
if (inventoryID == 0)
inventories[0].Items.Clear(); // Don't delete player inventory
else
inventories.Remove(inventoryID);
}
if (inventoryID != 0)
{
Log.Info(Translations.Get("extra.inventory_close", inventoryID));