mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2026-08-15 13:04:36 +00:00
chore: polish recipe book support
Agent-Logs-Url: https://github.com/MCCTeam/Minecraft-Console-Client/sessions/00c8527f-5755-43c1-8916-8d571d28860b Co-authored-by: milutinke <441903+milutinke@users.noreply.github.com>
This commit is contained in:
parent
d5308ba8c6
commit
893be203e5
5 changed files with 71 additions and 10 deletions
|
|
@ -1411,7 +1411,7 @@ namespace MinecraftClient
|
|||
if (inventories.Count == 0)
|
||||
return null;
|
||||
|
||||
Container activeInventory = inventories.Values.Last();
|
||||
Container activeInventory = inventories.MaxBy(static pair => pair.Key).Value;
|
||||
return SupportsRecipeBook(activeInventory.Type) ? activeInventory : null;
|
||||
}
|
||||
|
||||
|
|
@ -2728,7 +2728,11 @@ namespace MinecraftClient
|
|||
if (activeInventory is null)
|
||||
return false;
|
||||
|
||||
return handler.SendPlaceRecipe(activeInventory.ID, NormalizeRecipeId(recipeId), makeAll);
|
||||
string normalizedRecipeId = NormalizeRecipeId(recipeId);
|
||||
if (normalizedRecipeId.Length == 0)
|
||||
return false;
|
||||
|
||||
return handler.SendPlaceRecipe(activeInventory.ID, normalizedRecipeId, makeAll);
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
|
@ -4172,6 +4176,9 @@ namespace MinecraftClient
|
|||
private static string NormalizeRecipeId(string recipeId)
|
||||
{
|
||||
string trimmedRecipeId = recipeId.Trim();
|
||||
if (trimmedRecipeId.Length == 0)
|
||||
return string.Empty;
|
||||
|
||||
return trimmedRecipeId.Contains(':', StringComparison.Ordinal)
|
||||
? trimmedRecipeId
|
||||
: "minecraft:" + trimmedRecipeId;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue