Commit graph

1437 commits

Author SHA1 Message Date
BruceChen
41a701b6b2 Fix RegistryData parsing and KnownDataPacks negotiation for 1.20.6
Two critical issues in the 1.20.6 configuration phase that could cause
connection instability and packet desync:

1. RegistryData: The handler used an early `break` when it encountered
   a registryId other than "minecraft:dimension_type" or
   "minecraft:chat_type". This skipped reading the remaining entries
   for that registry, leaving unconsumed data in the packet buffer.
   Subsequent packet reads would start at the wrong offset, causing
   cascading parse failures and eventual disconnection.

   Fix: Always read all entries (entryId + hasData + optional NBT)
   for every registry, regardless of whether we process it. For
   dimension_type entries, if the server sends inline NBT data (i.e.
   non-vanilla dimensions from mods/datapacks), parse and store
   the dimension directly via World.StoreOneDimension(). Only fall
   back to hardcoded defaults when no dimension data was received.

2. KnownDataPacks: The client echoed back ALL packs the server
   listed, including non-vanilla ones. This told the server "I have
   these packs cached" when the client actually did not, so the
   server would skip sending full registry data for those packs.
   The result: incomplete registries for modded/datapack content.

   Fix: Filter the response to only include packs with the
   "minecraft" namespace. Non-vanilla packs are omitted, forcing
   the server to send their full registry data inline.

Also adds supporting methods to World.cs:
- SetDimensionIdMap(): Store VarInt ID -> dimension name mapping
  from RegistryData entries (needed by JoinGame/Respawn)
- GetDimensionNameById(): Look up dimension name by numeric ID
- HasAnyDimension(): Check if any dimensions were loaded from
  server-provided data

Made-with: Cursor
2026-03-19 00:13:22 +08:00
BruceChen
a7a95d991c Fix EntityProperties attribute ID mapping for 1.20.6
The 1.20.6 EntityProperties packet sends attribute IDs as VarInts
instead of strings. The existing mapping dictionary had three issues:

1. IDs 5/6/7 used the wrong prefix "generic." but the official
   1.20.6 registry uses "player." for these attributes:
   - 5: player.block_break_speed (was generic.block_break_speed)
   - 6: player.block_interaction_range (was generic.block_interaction_range)
   - 7: player.entity_interaction_range (was generic.entity_interaction_range)

2. IDs 22-24 (submerged_mining_speed, sweeping_damage_ratio,
   water_movement_efficiency) do not exist in the 1.20.6 attribute
   registry — they were introduced in 1.21. Their presence could
   cause incorrect attribute resolution.

3. Direct dictionary indexing (attributeDictionary[id]) throws
   KeyNotFoundException if the server sends an unknown attribute ID,
   crashing the packet handler. Replaced with TryGetValue and a
   safe fallback to "unknown".

Made-with: Cursor
2026-03-19 00:12:06 +08:00
BruceChen
ff1c570a78 Handle non-interactive terminal environments gracefully
When MCC runs in non-interactive terminals (e.g. CI runners, IDE
embedded shells, piped input), several Console APIs throw exceptions
because there is no real console attached.

Changes:
- Program.cs: Wrap Console.KeyAvailable / Console.ReadKey in
  HandleFailure() with try-catch so MCC does not crash on startup
  failure in headless environments.
- Chunk.cs: Wrap Console.BufferWidth / BufferHeight in try-catch
  with fallback values (120x50) to prevent exceptions when rendering
  chunk maps without a console buffer.
- Map.cs: Same treatment for the map rendering path - use safe
  fallback values when Console.BufferWidth/Height are unavailable.
- ReplayHandler.cs: Replace Array.Reverse() (returns void in newer
  .NET) with .AsEnumerable().Reverse() to fix compilation with
  .NET 10 SDK where the void return breaks the fluent chain.

Made-with: Cursor
2026-03-19 00:11:13 +08:00
breadbyte
494be0930b
Merge branch 'master' into 1.20.6 2025-12-02 00:06:16 +08:00
Anon
8b20973b02 Temporarily removed WebSocket bot because of a false positive virus detection. I will make it in to a standalone bot later. 2025-05-22 13:56:27 +02:00
Tasuku Bobcorn
19781985f7 Fix reading window items packet in versions below 1.17.1 2025-04-29 13:56:38 +08:00
Anon
2409de2a2f
Fix prevent AntiCheat Block Breaking (In Scripts)
Fix prevent AntiCheat Block Breaking (In Scripts)
2024-12-25 16:56:07 +01:00
breadbyte
a5ab30f3da Fix session cache serializer failure 2024-12-25 01:28:28 +08:00
Anon
7152072598 Ported to .NET 8 2024-12-22 13:20:04 +01:00
Anon
f83e7c5707 Preliminary 1.21 Support 2024-12-06 16:45:48 +01:00
vinicius
d0c9695a79 Fixed bug in SetDimension method of World class, where it would crash if joining a paper server. Added error handling. 2024-12-05 02:13:21 +00:00
Anon
7bd213a154 Fixed the potion component crash 2024-12-04 21:25:22 +01:00
Anon
0da4a718cb Implemented all structured components, renamed them all to a better format 2024-10-05 13:37:52 +02:00
Anon
4dea688ca2 Added more structured components 2024-09-11 20:58:24 +02:00
Anon
49319fe781 Added more components + added item palette reference 2024-09-11 20:35:23 +02:00
Anon
76e873ed54 WIP: Added some strctured components 2024-09-11 19:12:31 +02:00
breadbyte
27e66433cd
Hotfix for 'minecraft:chat_type' not present in the dictionary (#2794) 2024-09-07 03:45:45 +08:00
Anon
63b027d84a First Version of Structured Components 2024-09-01 20:42:39 +02:00
breadbyte
c69cdaddbf [skip ci] fix issue 2779 2024-08-14 18:49:09 +08:00
breadbyte
ca966a464c
Ensure that the cached version of MCC is refreshed every update (#2760)
fixes #2758

this happened because we added sentry in a future release, but the cache was using an old executable, so it couldn't find the assembly.
2024-07-14 01:46:43 +08:00
breadbyte
c50b360eae
Fix minor bugs (#2759)
* add miscellaneous fixes

* Fixed connecting to server when compression threshold is set to 0

The client assumes that 0 means disabled, when on a notchian (vanilla) server, it is possible to set the compression threshold to 0 (compress all packets).

* Try to capture all exceptions through Sentry

No exceptions are being logged through Sentry, so be more aggressive when sending exceptions

(cherry picked from commit eb1c2f5e771760fb3be32ffea79f8292adca92f1)

* Call OnSpawnPlayer packet when a player is spawned using the SpawnEntity packet

references #2721

(cherry picked from commit ef28ae09ac89e8988dd612de61f2849a9f0e528c)
2024-07-14 01:30:16 +08:00
Anon
5a6fd577e5 Inventory, Terrain and Entity handling 2024-07-02 11:08:46 +02:00
Anon
58a5260b5b Merge branch 'master' of github.com:milutinke/Minecraft-Console-Client into 1.20.6 2024-06-30 11:57:57 +02:00
Anon
67e36a92d2 First working version, not fully tested 2024-06-30 11:26:41 +02:00
breadbyte
08551097c6
Add Sentry Error Tracking (#2670)
* Add Sentry Error Tracking

* Omit personally identifiable information and add additional sentry context

* Remove debug message

* Make sentry opt-out and add related notices and strings

Also add Minecraft Version to error context

* Update build to send release info to sentry

* Adjust sentry error tracking

- Send the user-friendly Minecraft Version in the error logs
- Capture exceptions in more parts of the application

We now capture exceptions from the following locations:
- Protocol18 (1.8+) Packet errors
- Errors during client initialization phase (When client is about to start, session keys are NEVER sent to sentry)

* Make Sentry DSN configurable and repository-specific

The Sentry DSN will automatically be filled out on the main repository through the Github Actions build.

* Update build-and-release.yml

Update sed command

* style: change variable name

nitpick, just to make it a little bit more descriptive

* Add Sentry branding in README.

* remove old code (merge conflict)
2024-06-22 06:41:13 +08:00
breadbyte
8756ff5b3c
[skip ci] Miscellaneous scripting QoL improvements and fixes (#2740)
* Update CI to detect the word "skipci"

* Make script compilation errors more verbose

Rather than just giving the line in which the error has been found, return the actual text content of the line itself

* Attempt to bubble up errors in the script chain, so it says the reason for any NotRun errors.

The exception message gets eaten up when the script is running, and an exception happens.

Also put in a default result message for the CmdResult, instead of having it default to null.

* Trim the whitespace off returned script compilation error line
2024-06-22 06:40:23 +08:00
Anon
08c5c15557 1.20.6 - Not working yet 2024-06-16 01:19:09 +02:00
Anon
8270a2d9a3
Item Mappings for 1.8 - 1.12 + Crash Fix
Item Mappings for 1.8 - 1.12 + Crash Fix
2024-06-08 21:34:33 +00:00
yaggod
d0caf4c9ee fixed typo in word heAlper lol 2024-04-16 21:21:08 +03:00
oldkingOK
bf54def51f
Fix(PacketType18Handler.cs): 1.20 Packet Palette (#2715) 2024-03-20 14:10:06 +08:00
breadbyte
f5c7a2801f Add an extra autorelog guard on HandleFailure 2024-03-17 02:10:14 +08:00
breadbyte
dc71332dd3 fix mcc not showing the disconnect message
The fix is to remove the ParseText call from the OnConnectionLost call, as the ReadNextChat function already calls ParseText. Calling ParseText on an unparsable string returns an empty string, therefore the disconnect message never gets propagated to the user.
2024-03-17 02:09:20 +08:00
breadbyte
706a41ee26 Revert "Fix offline client reconnecting as a microsoft account"
Could no longer reproduce said issue without this code, and a bug was reported regarding this change, so reverting it.
This reverts commit 873bd79fd6.
2024-03-17 01:33:00 +08:00
Anon
5044ec965b Un-commended try-catch block 2024-03-12 19:07:20 +01:00
breadbyte
60ba4bd6c2
Merge pull request #2700 from breadbyte/master 2024-03-12 23:43:52 +08:00
Anon
2ce0311949 Fixed a crash in SendPlayerBlockPlacement 2024-03-12 15:05:47 +01:00
Anon
691f1a136e Added Item Palette for 1.11 2024-03-12 14:04:36 +01:00
Anon
c9c16818a4 Added item Mappings for 1.10 2024-03-12 13:49:47 +01:00
Anon
221d5948e2 Added Item mappings for 1.12 2024-03-12 13:28:17 +01:00
Anon
a19a91e37f Added Item palette for 1.9 2024-03-12 12:58:29 +01:00
Anon
6891d446a5 Added 1.8 Item Mappings and Support 2024-03-12 11:15:05 +01:00
oldkingOK
4bb25c377e feat(DeclareCommands.cs): Add 1.20.3+ version check 2024-03-10 12:03:07 +08:00
oldkingOK
79910b50f7
Merge branch 'MCCTeam:master' into forge-cmds 2024-03-10 08:07:01 +08:00
breadbyte
a72a8cf833 Make AutoRelog more reliable
Makes AutoRelog more hands on with the  relogging rather than have the general relogging handler handle it.

Fallback to the general handler only when the AutoRelog module is disabled.
2024-03-07 09:54:40 +08:00
breadbyte
c78245c056 Fix Server Version prompt
Actually use the provided server version when reconnecting to a server that doesn't broadcast their protocol version
2024-03-07 09:37:55 +08:00
breadbyte
873bd79fd6 Fix offline client reconnecting as a microsoft account
Consider an empty string as a blank password as well as the default dash.
2024-03-07 07:21:11 +08:00
Anon
e2b6dc27c8
[skipci]Forge Code Cleanup
Optimize code and edit comments
2024-03-05 22:50:06 +01:00
Roman Danilov
df9443381b Done auxiliary methods for Direction 2024-03-05 21:49:29 +05:00
Roman Danilov
91ef890bb6 Auxiliary class for Direction, preparation for autodetection of the broken side of the block 2024-03-05 20:30:58 +05:00
Roman Danilov
fde50c1728 AntiCheat fix prevent Block Breaking 2024-03-05 18:54:29 +05:00