Commit graph

714 commits

Author SHA1 Message Date
copilot-swe-agent[bot]
d5308ba8c6 feat: add recipe book command 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>
2026-03-29 18:00:44 +00:00
BruceChen
871305bd72 Add server status display and protocol version upgrade handling
- Introduced a new `ServerStatusInfo` class to encapsulate server status data including MOTD, player counts, and version information.
- Implemented `ServerStatusDisplay` to format and display server status information in both classic and TUI modes.
- Added protocol version upgrade logic in `ProtocolHandler` to determine the highest supported protocol version for multi-version servers.
- Updated translations to support new server status labels and messages.
- Created `ServerStatusPanelBuilder` for TUI to visually represent server status with player information and connection details.
2026-03-30 01:39:37 +08:00
BruceChen
d05e3148f1 Refactor explosion packet handling for protocol version updates
- Updated explosion packet processing to accommodate changes in Minecraft protocol versions, specifically for versions 1.21.2 and 1.20.4.
- Removed obsolete fields such as explosion strength and block records for newer versions, and added support for optional knockback and particle data.
- Enhanced backward compatibility for earlier versions by maintaining existing logic for explosion data retrieval.
2026-03-29 22:40:43 +08:00
BruceChen
6631180f8a Minimap support 2026-03-29 19:53:50 +08:00
BruceChen
ef133f3d6d Enhance container handling for Minecraft protocol updates
- Updated the Container class to include a protocol version parameter for accurate container type mapping.
- Modified the GetContainerType method to account for changes in container types introduced in Minecraft 1.20.4.
- Added new container types, including Crafter, to the ContainerType enum.
- Adjusted ContainerTypeExtensions to reflect the new container mappings and ensure compatibility with the updated protocol.
2026-03-28 02:17:47 +08:00
BruceChen
22f46d14a9 Fix negative location error 2026-03-28 02:17:47 +08:00
Anon
0a9948a92a Merge branch 'master' of github.com:MCCTeam/Minecraft-Console-Client into fix/use-item 2026-03-27 16:46:29 +01:00
Anon
0c9ff137b2 Fixed shovel not being able to be used on dirt 2026-03-27 16:43:53 +01:00
Anon
f6446b198d Implemented effects support, as a command, chat notification and added in TUI mode 2026-03-27 15:47:27 +01:00
Anon
966b787a4c
feat: Added missing enchantments for new versions 2026-03-25 20:01:43 +01:00
BruceChen
dcfff3f1ba feat: enhance Protocol18 and SocketWrapper for improved functionality
- Added support for the new world border hit flag in Protocol18 for protocol version 1.21.2.
- Updated SocketWrapper to throw a SocketException if SendDataRAW is called when not connected, improving error handling.

These changes enhance the protocol handling and error management in the Minecraft Console Client.
2026-03-26 02:35:43 +08:00
copilot-swe-agent[bot]
d4faea9ecc fix: add lunge enchantment mapping for 1.21.11
Co-authored-by: milutinke <441903+milutinke@users.noreply.github.com>
Agent-Logs-Url: https://github.com/MCCTeam/Minecraft-Console-Client/sessions/16e21ef0-6f09-4280-b539-8d704ddc3b67
2026-03-25 18:00:38 +00:00
Anon
41a1a1db9b Fixed transfering breaking on multiple versions 2026-03-25 14:05:43 +01:00
Anon
52eda4ccdd
bugfix: Fixed more components on 1.21.5, 1.21.11 and 26.1 and crashing on 1.21.8 2026-03-25 12:50:10 +01:00
Anon
2f40cc1538 More component updates and fixes for 1.21.5, 1.21.11 and 26.1 2026-03-25 12:46:43 +01:00
copilot-swe-agent[bot]
7e9be430db Merge remote-tracking branch 'origin/master' into copilot/reimplement-chat-formatting-feature
# Conflicts:
#	MinecraftClient/Protocol/Message/ChatParser.cs
2026-03-25 10:05:37 +00:00
Anon
c43b157b55 More fixed for 1.21.5, 1.21.9, 1.21.11, stress tested against everything from 1.20.6 - 1.21.11 2026-03-25 02:08:59 +01:00
Anon
17808bb652 Fixed the component system from 1.20.6 - 1.21.11 2026-03-25 01:08:27 +01:00
copilot-swe-agent[bot]
6c70685d52 Changes before error encountered
Co-authored-by: milutinke <441903+milutinke@users.noreply.github.com>
Agent-Logs-Url: https://github.com/MCCTeam/Minecraft-Console-Client/sessions/e56a9086-4921-4504-ab06-ebb912cf52ce
2026-03-24 21:11:43 +00:00
copilot-swe-agent[bot]
3fb7625b39 Add chat formatting code propagation (bold, italic, underline, strikethrough, obfuscated)
Re-implements PR #2851 against the current System.Text.Json.Nodes codebase.

Changes:
- ChatParser.cs: Add FormattingCodes dict, update JSONData2String to propagate
  formatting codes alongside colors, update NbtToString for the NBT chat path
  (used in MC 1.20.4+), fix root-string shortcut to preserve formatting prefix
- DiscordBridge.cs: Add GetDiscordText() converting § codes to Discord Markdown,
  handle unclosed formatting codes with end-of-string matching

End-to-end tested against Minecraft 1.21.11 (MC 26.1) offline server.
All 8 formatting types verified: bold(§l), italic(§o), strikethrough(§m),
underline(§n), combined, nested, reset-via-false, obfuscated(§k).

Co-authored-by: milutinke <441903+milutinke@users.noreply.github.com>
Agent-Logs-Url: https://github.com/MCCTeam/Minecraft-Console-Client/sessions/65b0d230-287c-4ed8-9b3c-a5ea25411804
2026-03-24 20:18:53 +00:00
copilot-swe-agent[bot]
8ab9f8505f Fix crash when scoreboard is updated on MC 1.20.4+
ChatParser.NbtToString crashed with InvalidCastException when a scoreboard
update was received. The switch expressions for extra/with NBT arrays only
handled int and string; everything else fell through to a hard cast to
Dictionary<string,object>, which fails for long/short/byte/float/double.

Replace with a pattern that explicitly matches string and Dictionary, and
converts all other values (any numeric NBT type) to a text component via
ToString(). This matches the behavior that ReadNbtField can return for
TAG_Byte, TAG_Short, TAG_Int, TAG_Long, TAG_Float, and TAG_Double.

Co-authored-by: milutinke <441903+milutinke@users.noreply.github.com>
Agent-Logs-Url: https://github.com/MCCTeam/Minecraft-Console-Client/sessions/44b66082-14ee-4966-9c23-4074134e0187
2026-03-24 19:58:58 +00:00
copilot-swe-agent[bot]
db5faa22b1 Add configurable MaxChatMessageLength to override default limits for older versions
Adds a MaxChatMessageLength config option under [Main.Advanced] that allows
users to override the protocol-defined maximum chat message length. Default is
0 (auto: 100 for MC 1.10 and below, 256 for MC 1.11+). Some servers like
Hypixel support longer messages on older versions, so this lets users set a
custom limit (e.g. 256 on 1.8.9). Includes a warning about potential kicks
if set incorrectly.

Closes #2947

Co-authored-by: milutinke <441903+milutinke@users.noreply.github.com>
Agent-Logs-Url: https://github.com/MCCTeam/Minecraft-Console-Client/sessions/39c78e6a-f748-4f41-a905-2f5d27f99eff
2026-03-24 18:50:01 +00:00
Anon
f64757edea Fixed inventory crashing on 1.13-1.13.2 2026-03-24 15:39:50 +01:00
copilot-swe-agent[bot]
aeec731ae5 Merge remote-tracking branch 'origin/master' into copilot/modernize-code-to-csharp-14 2026-03-24 08:52:57 +00:00
copilot-swe-agent[bot]
654a16907b Modernize data carriers to records and add primary constructors
Convert 14 data carrier classes to records:
- VillagerInfo, MapIcon, EnchantmentData: non-positional records (mutable properties)
- ForgeMod, SkinInfo, VillagerTrade, Node, Response: positional records
- CommandNode: sealed positional record
- CommandArgumentDescriptor: readonly record struct
- ColorRGBA: record struct (multiple constructors preserved)
- RecipeConfig, Recipe, BannerLayer: non-positional records

Add primary constructors to 6 classes:
- DataTypes, Protocol18Terrain, Protocol18Forge, ItemMovingHelper,
  LastSeenMessageList, Acknowledgment, SuggestionTooltip

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-24 01:31:17 +00:00
copilot-swe-agent[bot]
81b756292e Fix all compilation warnings (CS9107, CS8600, CS8604, CS8618, CS0168, CS0169, CS0649)
- Fix CS9107: Replace lowercase primary constructor parameter refs with
  PascalCase base class properties in 90+ StructuredComponent files
- Fix CS8618: Add null! initializers for late-initialized properties
- Fix CS8600: Use nullable out parameters in World.cs, ChatParser.cs
- Fix CS8604: Add null guard in Compiler.cs, fix null-conditional in McClient.cs
- Fix CS0168: Replace unused variable with discard in DataTypes.cs
- Fix CS0169: Remove unused motionY field from McClient.cs
- Fix CS0649: Remove never-assigned steps field, simplify ClientIsMoving()
- Initialize client/handler with null! to avoid CS8618 cascade

Co-authored-by: milutinke <441903+milutinke@users.noreply.github.com>
Agent-Logs-Url: https://github.com/milutinke/Minecraft-Console-Client/sessions/7fcee1b2-21e2-4457-b01b-5e0a1f07752f
2026-03-24 01:25:50 +00:00
copilot-swe-agent[bot]
640a4e39b7 Fix CS9107 warnings: use base class properties instead of captured primary constructor parameters
Replace lowercase primary constructor parameter references (dataTypes.,
subComponentRegistry., itemPalette.) with PascalCase base class property
references (DataTypes., SubComponentRegistry., ItemPalette.) in method
bodies of all StructuredComponent and SubComponent subclasses.

This eliminates CS9107 warnings where subclass primary constructor
parameters shadow the base class properties they are assigned to.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-24 01:16:05 +00:00
copilot-swe-agent[bot]
94bf42710a refactor: use pattern matching for null checks (is null / is not null)
Convert remaining == null to is null and != null to is not null
across 17 files in CommandHandler/ArgumentType, StructuredComponents,
and DeclareCommands for idiomatic C# style.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-24 00:47:03 +00:00
copilot-swe-agent[bot]
c7bc25aa17 refactor: convert == null / != null to is null / is not null in 31 files
Replace old-style null comparisons with modern C# pattern matching
syntax across Commands, Protocol, Mapping, ChatBots, Physics,
Inventory, Logger, CommandHandler, Scripting, Crypto, and other modules.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-24 00:42:59 +00:00
copilot-swe-agent[bot]
446c6e7739 refactor: convert redundant new TypeName() to target-typed new()
Replace explicit constructor calls with target-typed new() expressions
where the type is already specified on the left side of the assignment.
This is a C# 9+ feature that reduces redundancy.

Files changed:
- Container.cs: field assignments in constructors
- EntityPalette18/112/113.cs: static field initializers
- ChatParser.cs: StringBuilder local variable
- Movement.cs: field assignments in constructor
- PacketPalette18.cs: field initializers
- EnchantmentMapping.cs: field reassignments

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-24 00:37:35 +00:00
copilot-swe-agent[bot]
2ae31e269f Convert switch statements to expressions and adopt collection expressions
- DirectionExtensions.cs: Convert GetOpposite() to switch expression,
  use file-scoped namespace, use collection expression for HORIZONTAL
- McClient.cs: Convert InteractType switch to expression, use collection
  expressions for array literals
- Protocol18.cs: Replace Array.Empty<byte>() with [], use collection
  expressions for byte/int array literals
- DataTypes.cs: Use collection expression for TAG_End byte array
- ChatBot.cs: Use collection expressions for string/char arrays
- Location.cs: Use collection expressions and modernize null check

Co-authored-by: milutinke <441903+milutinke@users.noreply.github.com>
Agent-Logs-Url: https://github.com/milutinke/Minecraft-Console-Client/sessions/4e9bd25b-22c5-47c2-98f9-6025d927b1d6
2026-03-24 00:34:00 +00:00
copilot-swe-agent[bot]
c5df6a49c6 Modernize null-check patterns: use 'is null' and 'is not null'
Replace '== null' with 'is null' and '!= null' with 'is not null'
across 19 core files following modern C# pattern matching conventions.

Only literal null comparisons are changed. Assignments, value
comparisons, and LINQ expressions are left untouched.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-24 00:28:02 +00:00
copilot-swe-agent[bot]
902e944cbb Modernize null-check patterns in Protocol18.cs
Replace '== null' with 'is null' and '!= null' with 'is not null'
for all 25 null comparisons in the file, following modern C# pattern
matching conventions.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-24 00:23:31 +00:00
copilot-swe-agent[bot]
74def7c512 Modernize lock object declarations from object to System.Threading.Lock
Replace all lock object declarations using 'object' type with the C# 13
System.Threading.Lock type across 12 files. The Lock type provides a
more efficient locking mechanism - when used with lock(), the compiler
automatically uses Lock.EnterScope() instead of Monitor.Enter/Exit.

Also made two previously non-readonly lock fields readonly:
- McClient.DigLock
- Protocol18.MessageSigningLock

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-24 00:15:21 +00:00
copilot-swe-agent[bot]
94c6425a2b Address code review: add SlowDownIncrementSeconds constant, return OtherError for device code failures
Co-authored-by: milutinke <441903+milutinke@users.noreply.github.com>
Agent-Logs-Url: https://github.com/MCCTeam/Minecraft-Console-Client/sessions/e13b31f3-8d76-4240-bb69-a519a145fc6a
2026-03-23 15:41:25 +00:00
copilot-swe-agent[bot]
5147fb42df Replace PPFT/urlPost HTML scraping with OAuth 2.0 device code flow for 2FA support
- Add Microsoft.RequestDeviceCode() and Microsoft.PollDeviceCodeToken() methods
- Remove XboxLive.PreAuth() and XboxLive.UserLogin() (HTML scraping)
- Remove PreAuthResponse struct, PPFT/urlPost regex patterns
- Update XblAuthenticate to always use "d=" prefix for OAuth tokens
- Update MicrosoftMCCLogin to use device code flow
- Skip password prompting for Microsoft device code method
- Add translation strings for device code prompts
- Update config comments and documentation

Co-authored-by: milutinke <441903+milutinke@users.noreply.github.com>
Agent-Logs-Url: https://github.com/MCCTeam/Minecraft-Console-Client/sessions/e13b31f3-8d76-4240-bb69-a519a145fc6a
2026-03-23 15:38:47 +00:00
Anon
484133f07a Run MCC at true 20 TPS 2026-03-23 14:29:04 +01:00
Anon
ff9aa62702 Add configurable authlib-injector API path and HTTP support for Yggdrasil auth
Re-implements the changes from PR #2890, adapted for the current codebase
which uses System.Text.Json.Nodes and HttpClient instead of the legacy
Json.JSONData and hand-rolled SslStream HTTP client.

Changes:
- Settings.cs: Convert AuthlibServer from struct to class with
  [TomlDoNotInlineObject]; convert Host to a property that parses
  'host:port' syntax; add AuthlibInjectorAPIPath (default '/api/yggdrasil')
  for servers that use a different prefix (e.g. Drasl uses '/authlib-injector');
  add UseHttps (default true) so local/dev auth servers without TLS work.

- ConfigComments.resx: Add descriptive inline comments for the new
  AuthlibServer fields (Host, Port, AuthlibInjectorAPIPath, UseHttps).

- ProtocolHandler.cs: Replace three hardcoded '/api/yggdrasil/...' paths
  with AuthlibInjectorAPIPath-based paths (authenticate, refresh, join).
  Replace hand-rolled TcpClient+SslStream HTTP in DoHTTPSRequest with
  HttpClient+SocketsHttpHandler (ConnectCallback routes through ProxyHandler).
  Add useHttps parameter so HTTP-only auth servers are supported.

- KeyUtils.cs: Add AuthServerSupportsProfileKeys() that fetches the
  authlib-injector metadata endpoint and checks feature.enable_profile_key.
  Update GetNewProfileKeys() to skip key fetch when the auth server does not
  support profile keys; build the cert URL dynamically using AuthlibInjectorAPIPath
  for Yggdrasil; always fetch real certs instead of returning a dummy response.
  Remove MakeDummyResponse() which is no longer needed.

Tested against a local Drasl instance with authlib-injector 1.2.7 on a
1.21.11 Minecraft server — full auth flow (login, profile key fetch, session
join) confirmed working end-to-end.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-23 00:15:32 +01:00
Anon
d44fc22c8a Fix offline Microsoft auth profile-key checks and complete status ping/pong during auto-version detection. 2026-03-22 22:19:59 +01:00
Anon
af405e5632 Fixed Profile Component crashing on 1.21.9 2026-03-22 21:53:13 +01:00
copilot-swe-agent[bot]
64ccdcb39b Address code review feedback
- Replace GetAwaiter().GetResult() with synchronous ReadAsStream()
- Use JsonNode.DeepClone() instead of serialize/parse round-trip
- Extract timeout magic number to named constant

Co-authored-by: milutinke <441903+milutinke@users.noreply.github.com>
Agent-Logs-Url: https://github.com/milutinke/Minecraft-Console-Client/sessions/afcd1b7b-ea23-4a0d-bb46-a90b623406fc
2026-03-22 16:46:33 +00:00
copilot-swe-agent[bot]
37fe626325 Replace hand-rolled ProxiedWebRequest with HttpClient/SocketsHttpHandler
- Rewrite ProxiedWebRequest to use System.Net.Http.HttpClient internally
- Use SocketsHttpHandler with native SOCKS4/4a/5 and HTTP proxy support
- Remove 250+ lines of manual HTTP/1.1 parsing, chunked transfer, TLS pinning
- Proper TLS negotiation (no longer pinned to TLS 1.2)
- Remove unused ITcpFactory interface and isProxied flag
- Maintain same public API (Get(), Post(), Response class) for all consumers

Co-authored-by: milutinke <441903+milutinke@users.noreply.github.com>
Agent-Logs-Url: https://github.com/milutinke/Minecraft-Console-Client/sessions/afcd1b7b-ea23-4a0d-bb46-a90b623406fc
2026-03-22 16:44:35 +00:00
copilot-swe-agent[bot]
15aabd9423 Replace legacy custom JSON parser with System.Text.Json
- Rewrite Json.cs to use System.Text.Json.Nodes (JsonNode, JsonObject, JsonArray)
- Add JsonNodeExtensions.GetStringValue() for backward-compatible string access
- Update all 14 consumer files to use the new JsonNode API
- Remove ~300 lines of hand-rolled JSON parsing code from 2013
- Replace KeyUtils.EscapeString with delegation to Json.EscapeString

Co-authored-by: milutinke <441903+milutinke@users.noreply.github.com>
Agent-Logs-Url: https://github.com/milutinke/Minecraft-Console-Client/sessions/afcd1b7b-ea23-4a0d-bb46-a90b623406fc
2026-03-22 16:39:26 +00:00
Anon
454ce331b2 Updated docs for Yggdrasil authlib multi-user selection and cleaned the code a bit 2026-03-22 16:48:38 +01:00
Anon
4fb4c018e4
Merge pull request #2781 from a08381/authlib-multi-user 2026-03-22 16:36:20 +01:00
BruceChen
d1837d104b feat: handle 26.1 protocol changes and snapshot version support
- Protocol18: add MC_26_1_Version constant (775), version-gated palette
  routing for blocks/items/entities/metadata, and new TimeUpdate packet
  format (WorldClock map replaces dayTime+tickDayTime)
- Protocol18Terrain: read new fluidCount short in chunk sections (26.1+)
- DataTypes: add CatSoundVariant to entity metadata VarInt readers
- ProtocolHandler: add NormalizeSnapshotProtocol() to map RC/snapshot
  protocol numbers (e.g. 0x4000012E → 775) to release versions, pass
  raw protocol version through for server handshake compatibility

Made-with: Cursor
2026-03-22 20:04:08 +08:00
BruceChen
d4014f7c87 feat: add 26.1 packet palette, structured components registry, and version routing
Add PacketPalette261 with new packet types (GameRuleValues, LowDiskSpaceWarning,
Attack, SetGameRule). Create StructuredComponentsRegistry261 with 6 new components
(additional_trade_cost, dye, pig/cow/chicken/cat sound_variant). Update version
routing in PacketType18Handler, EntityMetadataPalette, StructuredComponentsHandler,
and Program.cs to support protocol 775 (26.1).

Made-with: Cursor
2026-03-22 20:04:08 +08:00
BruceChen
a3c918e946 feat: implement physics engine for player movement and collision detection
- Introduced a comprehensive physics engine that replicates Minecraft's movement mechanics, including player input handling, gravity, and collision detection.
- Added classes for player physics, movement input, and collision detection, ensuring accurate simulation of player interactions with the game world.
- Integrated AABB (Axis-Aligned Bounding Box) structures for precise collision detection against blocks.
- Enhanced movement capabilities with support for jumping, sneaking, and sprinting, along with step-up mechanics for navigating terrain.

These changes significantly improve the realism and responsiveness of player movement within the game environment.
2026-03-22 15:29:22 +08:00
Anon
e2746ae0d1 Implemented new Delcare Command packet for new versions 1.20.6-1.21.11 and fixed it for 1.20.4. 2026-03-22 00:42:43 +01:00
Anon
b4e69da81f Temporary fix for Declare Commands crashing sending commands in chat. 2026-03-21 22:44:57 +01:00