diff --git a/MinecraftClient/ChatBots/AutoEat.cs b/MinecraftClient/ChatBots/AutoEat.cs index 1b1616b9..8c7c58f5 100644 --- a/MinecraftClient/ChatBots/AutoEat.cs +++ b/MinecraftClient/ChatBots/AutoEat.cs @@ -50,7 +50,7 @@ namespace MinecraftClient.ChatBots Container inventory = GetPlayerInventory(); bool found = false; LastSlot = CurrentSlot; - if (inventory.Items.ContainsKey(CurrentSlot + 36) && ItemTypeExtensions.IsFood(inventory.Items[CurrentSlot + 36].Type)) + if (inventory.Items.ContainsKey(CurrentSlot + 36) && inventory.Items[CurrentSlot + 36].Type.IsFood()) { // no need to change slot found = true; @@ -60,7 +60,7 @@ namespace MinecraftClient.ChatBots for (int i = 36; i <= 44; i++) { if (!inventory.Items.ContainsKey(i)) continue; - if (inventory.Items[i].IsFood()) + if (inventory.Items[i].Type.IsFood()) { int slot = i - 36; ChangeSlot((short)slot); diff --git a/MinecraftClient/Inventory/Item.cs b/MinecraftClient/Inventory/Item.cs index 43661796..0aefaadb 100644 --- a/MinecraftClient/Inventory/Item.cs +++ b/MinecraftClient/Inventory/Item.cs @@ -70,24 +70,5 @@ namespace MinecraftClient.Inventory return null; } } - - /// - /// Check item is a food - /// - /// True if is a food - public bool IsFood() - { - // non-poison and stackable food - // remarks: auto eat may works with non-stackable food <- not tested - int[] foods = { 524, 765, 821, 823, 562, 763, 680, 629, 801, 585, 788, 630, 670, 674, 588, 587, 768, 673, 764, 777, 677, 679, 625, 800, 584, 787, 626, 678, 876, 627 }; - if (foods.Contains((int)Type)) - { - return true; - } - else - { - return false; - } - } } } diff --git a/MinecraftClient/Inventory/ItemTypeExtensions.cs b/MinecraftClient/Inventory/ItemTypeExtensions.cs index 2c448a57..b46aff61 100644 --- a/MinecraftClient/Inventory/ItemTypeExtensions.cs +++ b/MinecraftClient/Inventory/ItemTypeExtensions.cs @@ -7,12 +7,7 @@ namespace MinecraftClient.Inventory { public static class ItemTypeExtensions { - /** - * I see "this" in the MaterialExtensions class method, why need that? - * public static bool IsSolid(this Material m) - * ^^^^ - */ - public static bool IsFood(ItemType m) + public static bool IsFood(this ItemType m) { ItemType[] t = {