mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2026-08-15 13:04:36 +00:00
chore: finalize recipe book support polish
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
893be203e5
commit
dfc1164839
3 changed files with 4 additions and 10 deletions
|
|
@ -87,20 +87,12 @@ namespace MinecraftClient.Commands
|
|||
if (handler.GetActiveRecipeBookInventory() is null)
|
||||
return r.SetAndReturn(CmdResult.Status.Fail, Translations.cmd_recipebook_no_active_inventory);
|
||||
|
||||
string normalizedRecipeId = NormalizeRecipeId(recipeId);
|
||||
string normalizedRecipeId = McClient.NormalizeRecipeId(recipeId);
|
||||
string successMessage = string.Format(makeAll ? Translations.cmd_recipebook_craftall_sent : Translations.cmd_recipebook_craft_sent, normalizedRecipeId);
|
||||
|
||||
return handler.SendPlaceRecipe(recipeId, makeAll)
|
||||
? r.SetAndReturn(CmdResult.Status.Done, successMessage)
|
||||
: r.SetAndReturn(CmdResult.Status.Fail, string.Format(Translations.cmd_recipebook_craft_failed, normalizedRecipeId));
|
||||
}
|
||||
|
||||
private static string NormalizeRecipeId(string recipeId)
|
||||
{
|
||||
string trimmedRecipeId = recipeId.Trim();
|
||||
return trimmedRecipeId.Contains(':')
|
||||
? trimmedRecipeId
|
||||
: "minecraft:" + trimmedRecipeId;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4173,7 +4173,7 @@ namespace MinecraftClient
|
|||
}
|
||||
}
|
||||
|
||||
private static string NormalizeRecipeId(string recipeId)
|
||||
internal static string NormalizeRecipeId(string recipeId)
|
||||
{
|
||||
string trimmedRecipeId = recipeId.Trim();
|
||||
if (trimmedRecipeId.Length == 0)
|
||||
|
|
|
|||
|
|
@ -3200,6 +3200,8 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
|
||||
private bool SkipRecipeBookSettings(Queue<byte> packetData)
|
||||
{
|
||||
// MC 1.13 uses 4 booleans for the crafting/smelting recipe book states.
|
||||
// MC 1.14+ expands this to 8 booleans by adding blast furnace and smoker states.
|
||||
int boolCount = protocolVersion >= MC_1_14_Version ? 8 : 4;
|
||||
if (packetData.Count < boolCount)
|
||||
return false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue