Commit graph

726 commits

Author SHA1 Message Date
BruceChen
35dd3c4f06 Add support for ItemStackTemplate in DataTypes and Protocol18
- Implemented ReadNextItemStackTemplate method to read ItemStackTemplate data with item-first encoding.
- Updated Protocol18 to utilize ReadItemStackTemplateLabel for improved item display handling.
- Enhanced item component parsing to accommodate new structured components.
2026-03-31 01:28:24 +08:00
milutinke
0881cbaa1c Fix legacy achievements and add test harness 2026-03-30 17:25:08 +02:00
copilot-swe-agent[bot]
962c8b1ab2 Fix 26.1 RecipeBookAdd crash: update SlotDisplay registry IDs for 26.1
MC 26.1 changed the minecraft:slot_display registry, inserting 3 new
types (with_any_potion, only_with_component, dyed) and shifting all
existing IDs. This caused MCC to misparse recipe display data, leading
to a Queue empty crash in SkipItemHolderSet.

Add version-gated ReadSlotDisplayLabel with correct 26.1 type mapping
and reader methods for the 3 new slot display types.

Agent-Logs-Url: https://github.com/MCCTeam/Minecraft-Console-Client/sessions/47b0c937-1491-4216-8ee0-1aca866e99ab

Co-authored-by: milutinke <441903+milutinke@users.noreply.github.com>
2026-03-30 08:09:33 +00:00
copilot-swe-agent[bot]
0f3289dfdf Fix criteria version boundary: criteria list removed from wire format in MC 1.20.2, not 1.20.6
Agent-Logs-Url: https://github.com/MCCTeam/Minecraft-Console-Client/sessions/5da0ec37-35e2-4aae-b165-66ddd82df985

Co-authored-by: milutinke <441903+milutinke@users.noreply.github.com>
2026-03-29 21:16:45 +00:00
copilot-swe-agent[bot]
5705df43bd Fix Advancements packet parsing: sendsTelemetryEvent added in 1.20, deduplicate requirements reading
Agent-Logs-Url: https://github.com/MCCTeam/Minecraft-Console-Client/sessions/5da0ec37-35e2-4aae-b165-66ddd82df985

Co-authored-by: milutinke <441903+milutinke@users.noreply.github.com>
2026-03-29 21:07:17 +00:00
copilot-swe-agent[bot]
7b3e5ee492 Address code review: eliminate unnecessary allocation in progress-only updates
Agent-Logs-Url: https://github.com/MCCTeam/Minecraft-Console-Client/sessions/9db483a8-4a5f-47b1-a6f4-30b6e39075bd

Co-authored-by: milutinke <441903+milutinke@users.noreply.github.com>
2026-03-29 20:27:12 +00:00
copilot-swe-agent[bot]
65ef3dde6b Implement unified achievements feature: data model, protocol handling, state management, ChatBot API, and /achievement command
Agent-Logs-Url: https://github.com/MCCTeam/Minecraft-Console-Client/sessions/9db483a8-4a5f-47b1-a6f4-30b6e39075bd

Co-authored-by: milutinke <441903+milutinke@users.noreply.github.com>
2026-03-29 20:22:31 +00:00
Anon
ef106c80c2
feat: Implemented the Recipe Book into MCC 2026-03-29 21:05:38 +02:00
BruceChen
90ea05b17d Enhance server status display and player information handling
- Updated `ServerStatusDisplay` to use `ChatBot.GetVerbatim` for version name formatting.
- Modified `ServerStatusPanelBuilder` to improve player name display with color parsing.
- Changed translation for online player label to "Online Players:" for clarity.
- Refactored protocol version checks to streamline logic in server status handling.
2026-03-30 02:46:34 +08:00
copilot-swe-agent[bot]
b05c8cfe0d fix: support 1.21.11 recipe book display ids
Agent-Logs-Url: https://github.com/MCCTeam/Minecraft-Console-Client/sessions/4cdf26f2-112b-4502-88f7-8f589c424f69

Co-authored-by: milutinke <441903+milutinke@users.noreply.github.com>
2026-03-29 18:45:14 +00:00
copilot-swe-agent[bot]
dfc1164839 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>
2026-03-29 18:12:01 +00:00
copilot-swe-agent[bot]
893be203e5 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>
2026-03-29 18:07:09 +00:00
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