mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2026-08-15 13:04:36 +00:00
Fix open container crash (#2996)
This commit is contained in:
commit
6beb00bae4
5 changed files with 26 additions and 2 deletions
|
|
@ -435,6 +435,12 @@ namespace MinecraftClient.Commands
|
|||
return r.SetAndReturn(CmdResult.Status.Fail, msg);
|
||||
}
|
||||
|
||||
if (container.Type != ContainerType.PlayerInventory)
|
||||
{
|
||||
handler.Log.Warn(string.Format(Translations.cmd_inventory_tui_unsupported_container, inventoryId));
|
||||
return r.SetAndReturn(CmdResult.Status.Fail);
|
||||
}
|
||||
|
||||
handler.Log.Info(string.Format(Translations.cmd_inventory_tui_opening, inventoryId));
|
||||
|
||||
bool success = InventoryTuiHost.Launch(handler, inventoryId);
|
||||
|
|
|
|||
|
|
@ -4587,7 +4587,10 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
|
||||
if(protocolVersion >= MC_1_14_Version)
|
||||
packet.Add(0); // insideBlock = false
|
||||
|
||||
|
||||
if (protocolVersion >= MC_1_21_2_Version)
|
||||
packet.Add(0); // worldBorderHit = false
|
||||
|
||||
if (protocolVersion >= MC_1_19_Version)
|
||||
packet.AddRange(DataTypes.GetVarInt(sequenceId));
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Net.Sockets;
|
||||
using MinecraftClient.Crypto;
|
||||
|
||||
|
|
@ -90,6 +90,9 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
/// <param name="buffer">data to send</param>
|
||||
public void SendDataRAW(byte[] buffer)
|
||||
{
|
||||
if (!IsConnected())
|
||||
throw new SocketException((int)SocketError.NotConnected);
|
||||
|
||||
if (encrypted)
|
||||
s!.Write(buffer, 0, buffer.Length);
|
||||
else
|
||||
|
|
|
|||
|
|
@ -6332,6 +6332,15 @@ namespace MinecraftClient {
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to TUI viewer does not support this container type (Inventory #{0}). Use '/inventory {0} list' to view its contents..
|
||||
/// </summary>
|
||||
internal static string cmd_inventory_tui_unsupported_container {
|
||||
get {
|
||||
return ResourceManager.GetString("cmd.inventory.tui_unsupported_container", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Hold Shift + Left-click to select and copy text..
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -2229,6 +2229,9 @@ Logging in...</value>
|
|||
<data name="cmd.inventory.tui_launch_failed" xml:space="preserve">
|
||||
<value>Failed to launch TUI inventory viewer.</value>
|
||||
</data>
|
||||
<data name="cmd.inventory.tui_unsupported_container" xml:space="preserve">
|
||||
<value>TUI viewer does not support this container type (Inventory #{0}). Use '/inventory {0} list' to view its contents.</value>
|
||||
</data>
|
||||
<data name="tui.select_copy_hint" xml:space="preserve">
|
||||
<value>Hold Shift + Left-click to select and copy text.</value>
|
||||
</data>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue