Commit graph

1755 commits

Author SHA1 Message Date
Anon
2d8412ce29 Embed Discord RPC pipe client in DiscordRpc bot 2026-03-23 03:06:00 +01:00
Anon
1d4ff226e0 Limit custom Discord RPC pipe client to Linux 2026-03-23 03:01:06 +01:00
Anon
8bedcece52 Fix Discord RPC Unix IPC path detection 2026-03-23 02:58:43 +01:00
copilot-swe-agent[bot]
221b82643d Fix DiscordRpc to send presence only after game join, apply C# best practices, remove temp E2E scripts
Co-authored-by: milutinke <441903+milutinke@users.noreply.github.com>
Agent-Logs-Url: https://github.com/MCCTeam/Minecraft-Console-Client/sessions/80d151a5-aee7-4ae6-8497-9e7487d25136
2026-03-23 01:05:48 +00:00
copilot-swe-agent[bot]
6c1449439c Add Discord RPC E2E test scripts and address code review feedback
Co-authored-by: milutinke <441903+milutinke@users.noreply.github.com>
Agent-Logs-Url: https://github.com/MCCTeam/Minecraft-Console-Client/sessions/a41f3e83-c88d-4c57-971b-54c380891556
2026-03-23 00:49:34 +00:00
copilot-swe-agent[bot]
5a9786cb0b Add Discord RPC setup tutorial, Discord Bridge AllowOtherBotMessages config, and enhance integration tests
Co-authored-by: milutinke <441903+milutinke@users.noreply.github.com>
Agent-Logs-Url: https://github.com/MCCTeam/Minecraft-Console-Client/sessions/a41f3e83-c88d-4c57-971b-54c380891556
2026-03-23 00:41:40 +00:00
copilot-swe-agent[bot]
02686de79c Add granular privacy controls: ShowCoordinates, ShowHealth, ShowDimension, ShowGamemode
Co-authored-by: milutinke <441903+milutinke@users.noreply.github.com>
Agent-Logs-Url: https://github.com/MCCTeam/Minecraft-Console-Client/sessions/43388021-4264-47e6-8403-7a1bca66d86f
2026-03-23 00:13:03 +00:00
copilot-swe-agent[bot]
8743129e72 Address code review: fix party max, rename food variable, add ShowServerAddress option
Co-authored-by: milutinke <441903+milutinke@users.noreply.github.com>
Agent-Logs-Url: https://github.com/MCCTeam/Minecraft-Console-Client/sessions/43388021-4264-47e6-8403-7a1bca66d86f
2026-03-23 00:08:08 +00:00
copilot-swe-agent[bot]
a2d032b549 Add Discord Rich Presence ChatBot integration
- Add DiscordRichPresence NuGet package (v1.143.0)
- Create DiscordRpc.cs ChatBot with configurable presence display
- Wire config in Settings.cs ChatBotConfig class
- Register bot in McClient.cs RegisterBots()
- Add translation strings to Translations.resx and Designer
- Add config comments to ConfigComments.resx and Designer
- Support placeholders: {server_host}, {server_port}, {username},
  {health}, {max_health}, {food}, {dimension}, {gamemode},
  {x}, {y}, {z}, {player_count}, {protocol}

Co-authored-by: milutinke <441903+milutinke@users.noreply.github.com>
Agent-Logs-Url: https://github.com/MCCTeam/Minecraft-Console-Client/sessions/43388021-4264-47e6-8403-7a1bca66d86f
2026-03-23 00:03:55 +00: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
Anon
757cbe1a68 Fix ParseJson crash on non-JSON plain-text input (e.g. vanilla MOTD)
When the MC server sends a plain-text string (not valid JSON) for fields like
the ServerData MOTD, JsonNode.Parse() throws JsonReaderException. This was a
regression introduced by the System.Text.Json modernization.

Fix: catch JsonException in ParseJson() and return JsonValue.Create(json) so
plain-text strings are treated as literal string values rather than crashing.

Tested against a real Minecraft 1.21.11 server (offline mode): MCC connects
and stays connected without crashing.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-22 19:53:15 +01:00
copilot-swe-agent[bot]
d2c1cbf2a5 Fix Json.ParseJson crash on empty/null input
ParseJson now returns null for null, empty, or whitespace-only input
instead of throwing JsonReaderException. This matches the behavior of
the old hand-rolled parser and is needed because MC protocol packets
may contain empty strings where JSON text is expected (e.g. empty chat
messages in DeathCombatEvent packets).

Discovered during end-to-end testing against a Minecraft 1.21.11
protocol server.

Co-authored-by: milutinke <441903+milutinke@users.noreply.github.com>
Agent-Logs-Url: https://github.com/milutinke/Minecraft-Console-Client/sessions/34df723e-4a63-45a0-a942-e119d81a575b
2026-03-22 17:22:08 +00: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
e3d3a86ac2 feat: add 26.1 palette files and new enum values
Add item, block, entity, and entity metadata palettes for Minecraft 26.1.
New enums: GoldenDandelion (item/block), PottedGoldenDandelion (block),
CatSoundVariant, CowSoundVariant, PigSoundVariant, ChickenSoundVariant
(entity metadata). Update gen_entity_metadata_palette.py FIELD_TO_ENUM
mapping for the new sound variant types.

Made-with: Cursor
2026-03-22 20:04:08 +08:00
BruceChen
3afbae4f89 fix: correct global state indexing in block shape processing
- Adjusted the indexing logic in BlockShapes.cs to ensure proper mapping of state counts to shape IDs.
- Introduced a global state offset to accurately reference shape IDs in the list, preventing out-of-bounds errors during shape assignment.

These changes enhance the reliability of block shape processing in the physics engine.
2026-03-22 16:34:12 +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
Anon
c50b9a5b63 Fixed a crash on PlayerInfo packet. 2026-03-21 22:22:18 +01:00
Anon
5b9cc4aa0e Tested the client against 1.21.11 on .net 10. Created a integration testing skill (end-to-end). 2026-03-21 21:02:13 +01:00
Anon
28834e7a86 Implemented .net 10 support. Updated all affected libraries and the code. Not testes yet. 2026-03-21 20:07:20 +01:00
BruceChen
c0c4c078c0 fix: use HashedStack for container_click and fix enchantments parsing for 1.21.5+
Two bugs fixed:

1. EnchantmentsComponent was reading a trailing ShowTooltip boolean that
   was removed from the wire format in MC 1.21.5. Created
   EnchantmentsComponent1215 and StoredEnchantmentsComponent1215 that
   omit the boolean. Used by StructuredComponentsRegistry1215 and 12111.

2. MC 1.21.5+ changed ServerboundContainerClickPacket to use HashedStack
   (item holder id + count + hashed component patch map) instead of full
   ItemStack for changed slots and carried item. Added GetHashedItemSlot()
   in DataTypes.cs and gated SendWindowAction in Protocol18.cs to use it
   for 1.21.5+. Since MCC doesn't track component hashes, an empty
   HashedPatchMap is sent; the server detects stateId mismatch and resyncs.

Tested: AutoFishing bot successfully catches fish on MC 1.21.11 with
enchanted fishing rods (Lure III + Luck of the Sea III).

Made-with: Cursor
2026-03-22 02:18:01 +08:00
BruceChen
6c36dc341a feat: add version routing, structured components, and metadata for MC 1.21.11
- Add MC_1_21_11_Version constant (protocol 774)
- Create StructuredComponentsRegistry12111 with 104 components (8 new:
  use_effects, minimum_attack_charge, damage_type, attack_range,
  piercing_weapon, kinetic_weapon, swing_animation, zombie_nautilus/variant)
- Add 6 new component classes for 1.21.11 wire formats
- Add RegistryEitherHolderComponent for holderRegistry-backed EitherHolder
- Add ZombieNautilusVariant and HumanoidArm cases in DataTypes.ReadNextMetadata
- Update all version routing in Protocol18, PacketType18Handler,
  EntityMetadataPalette, StructuredComponentsHandler, and ProtocolHandler
- Bump MCHighestVersion to 1.21.11

Made-with: Cursor
2026-03-22 00:56:04 +08:00
BruceChen
50b4b3c8fe feat: add palettes and enums for MC 1.21.11 (protocol 774)
Add 17 new items (spears, nautilus armor, spawn eggs, netherite horse armor),
4 new entities (CamelHusk, Nautilus, Parched, ZombieNautilus), and 2 new
entity metadata serializer types (ZombieNautilusVariant, HumanoidArm).

Generated ItemPalette12111 (1505 items), EntityPalette12111 (157 entities),
and EntityMetadataPalette12111 (39 serializers) from server reports.

Made-with: Cursor
2026-03-22 00:49:33 +08:00
BruceChen
aebfcd93e4 fix: regenerate item/block palettes from server registry data for 1.21.9
MC 1.21.9 changed how some items and blocks are registered — 24 block
items (copper bars/chains/lanterns variants, potted azalea renames) and
additional blocks are now registered outside of Items.java/Blocks.java
field declarations, making the previous source-field-order-based palette
generation produce incorrect protocol IDs.

Regenerated ItemPalette1219.cs using server registries.json (1488 items,
up from 1464) and Palette1219.cs using blocks.json (1166 blocks with
correct state IDs). Added 37 new enum values to ItemType.cs (35 new +
DryShortGrass/DryTallGrass for backward compat) and 9 new values to
Material.cs.

Verified all item/block/entity identification against a 1.21.10 server.

Made-with: Cursor
2026-03-21 14:43:56 +08:00
BruceChen
6d3c58b29f fix: handle LpVec3 movement encoding in SpawnEntity for 1.21.9+
Minecraft 1.21.9 changed the SpawnEntity (Add Entity) packet layout:
the velocity/movement field was moved before the angle fields and
switched from 3 x Short to a new variable-length LpVec3 encoding.

Add ReadNextLpVec3() to consume the LpVec3 wire format (1 byte header,
optionally 5+ more bytes with a continuation VarInt), and update
ReadNextEntity() to use the new field order for protocol >= 773.

Made-with: Cursor
2026-03-21 14:11:23 +08:00
BruceChen
88e9c671da feat: add version routing and metadata reading for MC 1.21.9
- Route block/entity/item/packet/metadata palettes to new 1219 variants
  for protocol >= 773, and raise upper-bound guards from MC_1_21_7 to
  MC_1_21_9 so terrain, inventory, and entity handling are enabled.
- Add DataTypes readers for three new entity metadata serializer types:
  CopperGolemState and WeatheringCopperState (both VarInt), and
  ResolvableProfile (composite: Either<GameProfile, Partial> with
  optional name/UUID/properties + PlayerSkin.Patch with 4 optional
  fields for body/cape/elytra texture ResourceLocations and model type).

Made-with: Cursor
2026-03-21 14:05:06 +08:00
BruceChen
67ad5fcf97 feat: add palettes for MC 1.21.9/1.21.10 (protocol 773)
- Palette1219.cs: 1053 blocks with new copper chests, copper golem
  statues, copper torches, shelves, oxidized lightning rods, iron chain
- EntityPalette1219.cs: 153 entities (+copper_golem at 27, mannequin at 82)
- ItemPalette1219.cs: 1464 items (generated via gen_item_palette.py)
- EntityMetadataPalette1219.cs: 37 serializers (COMPOUND_TAG removed,
  +CopperGolemState, WeatheringCopperState, ResolvableProfile)
- PacketPalette1219.cs: updated clientbound IDs for 4 new debug packets
  and GameTestHighlightPos, plus config CodeOfConduct/AcceptCodeOfConduct

Also update gen_entity_metadata_palette.py FIELD_TO_ENUM with the three
new serializer type mappings.

Made-with: Cursor
2026-03-21 14:04:56 +08:00
BruceChen
2af0409d00 feat: add MC 1.21.9/1.21.10 (protocol 773) version constants and enum values
Register protocol 773 for Minecraft 1.21.9 and 1.21.10 (which share the
same protocol as a hotfix release). Update MCHighestVersion to 1.21.10.

Add 49 new item types (copper tools/armor, shelves, copper chests,
copper golem statue variants, oxidized lightning rods, iron chain, etc.),
2 new entity types (CopperGolem, Mannequin), 38 new block materials,
3 new entity metadata serializer types (CopperGolemState,
WeatheringCopperState, ResolvableProfile), and 6 new packet types
(DebugBlockValue, DebugChunkValue, DebugEntityValue, DebugEvent,
GameTestHighlightPos, CodeOfConduct, AcceptCodeOfConduct).

Chain item/block renamed to IronChain in 1.21.9; old enum values
retained for backward compatibility with older palettes.

Made-with: Cursor
2026-03-21 14:04:42 +08:00
BruceChen
5e8d715358 feat: add MC 1.21.7/1.21.8 (protocol 772) support
1.21.7 and 1.21.8 share protocol 772. The only registry change from
1.21.6 is one new item (music_disc_lava_chicken). All other palettes
(blocks, entities, packets, entity metadata, structured components)
are unchanged and reuse 1.21.6 versions.

Changes:
- Add MC_1_21_7_Version (772) constant
- Add "1.21.7" / "1.21.8" version mappings in ProtocolHandler
- Add MusicDiscLavaChicken to ItemType enum
- Generate ItemPalette1217 (1416 items) for the new item palette
- Update all version upper-bound checks from MC_1_21_6 to MC_1_21_7
- Update MCHighestVersion to "1.21.8"

Made-with: Cursor
2026-03-21 13:10:30 +08:00
BruceChen
067395ab2a fix: correct biome data array length calculation for 1.21.5+ terrain parsing
The biome PalettedContainer data array length was calculated as
ceil(64 * bitsPerEntry / 64) which is incorrect for non-power-of-2
bit widths. The correct calculation uses SimpleBitStorage's formula:
valuesPerLong = 64 / bitsPerEntry, then ceil(64 / valuesPerLong).

For example, with bitsPerEntry=3: old formula gave 3 longs but the
actual data contains 4 longs (valuesPerLong=21, ceil(64/21)=4).

This bug was masked in 1.21.5 by excess padding bytes in chunk buffers
(due to PalettedContainer.Data.getSerializedSize over-counting). MC
1.21.6 fixed the size calculation server-side, removing the padding
and exposing this pre-existing MCC bug.

Made-with: Cursor
2026-03-21 12:11:18 +08:00
BruceChen
1b0e27fde7 feat: add palettes and version routing for MC 1.21.6
- ItemPalette1216: 1415 items (generated from decompiled Items.java)
- EntityPalette1216: 151 entities (HappyGhast at index 56, all after +1)
- Palette1216: block states (DriedGhast 32 states at 13826-13857, all after +32)
- PacketPalette1216: clientbound +3 (Waypoint, ClearDialog, ShowDialog),
  serverbound +2 (ChangeGameMode at 0x04 shifting all after, CustomClickAction at end),
  config clientbound +2 (ClearDialog, ShowDialog),
  config serverbound +1 (CustomClickAction)
- Version routing in Protocol18.cs, PacketType18Handler.cs, EntityMetadataPalette.cs
  updated to select 1216 palettes for protocol >= 771
- EntityMetadataPalette reuses 1215 (EntityDataSerializers unchanged)

Made-with: Cursor
2026-03-21 11:44:12 +08:00
BruceChen
96a7e4a659 feat: add MC 1.21.6 (protocol 771) version constants and enum values
- Add protocol 771 constant MC_1_21_6_Version in Protocol18.cs
- Register 1.21.6 in ProtocolHandler (version map, supported list)
- Extend upper-bound checks from MC_1_21_5 to MC_1_21_6
- Add 19 new ItemType entries (16 colored Harnesses, DriedGhast,
  HappyGhastSpawnEgg, MusicDiscTears)
- Add HappyGhast to EntityType enum
- Add DriedGhast to Material enum
- Add new packet types: Waypoint, ClearDialog, ShowDialog (clientbound),
  ChangeGameMode, CustomClickAction (serverbound),
  ClearDialog, ShowDialog (config clientbound),
  CustomClickAction (config serverbound)

Made-with: Cursor
2026-03-21 11:34:20 +08:00
BruceChen
26e8a2f2e6 fix: adapt chat packet format for MC 1.21.5 (protocol 770)
1.21.5 changed LastSeenMessages.Update to include a trailing checksum
byte (0 = skip verification). This affects serverbound chat and signed
chat command packets.

Additionally, the clientbound PlayerChat packet now has a globalIndex
VarInt prepended before the sender UUID.

Without these fixes:
- Sending plain chat messages causes DecoderException on the server
- Receiving player chat messages causes Queue empty crash in MCC

Made-with: Cursor
2026-03-21 01:08:08 +08:00
BruceChen
9af6c643e3 fix: handle 1.21.5 chunk data format changes
In 1.21.5, two wire format changes in level chunk packets:
1. Heightmaps changed from NBT CompoundTag to map<VarInt, long[]> encoding
2. PalettedContainer data arrays no longer have VarInt length prefix
   (uses writeFixedSizeLongArray instead of writeLongArray)

Both changes affect ChunkData (level_chunk_with_light) packet parsing.
Without this fix, MCC crashes with "Queue empty" when processing chunks.

Made-with: Cursor
2026-03-21 00:54:27 +08:00
BruceChen
8df39ba74a feat: add MC 1.21.5 (protocol 770) support
Full protocol adaptation for Minecraft 1.21.5:

- Protocol version mapping: 770 -> 1.21.5
- Packet palette: AddExperienceOrb removed (S2C), TestInstanceBlockStatus
  added (S2C), SetTestBlock and TestInstanceBlockAction added (C2S)
- Entity metadata palette: 5 new serializer types (OptionalLivingEntityReference,
  CowVariant, WolfSoundVariant, PigVariant, ChickenVariant), OPTIONAL_UUID
  replaced by OPTIONAL_LIVING_ENTITY_REFERENCE
- Item palette: 11 new items (Bush, FireflyBush, DryShortGrass, DryTallGrass,
  Wildflowers, LeafLitter, CactusFlower, TestBlock, TestInstanceBlock,
  BlueEgg, BrownEgg)
- Entity palette: Potion split into SplashPotion and LingeringPotion
- Block palette: 9 new blocks (bush, cactus_flower, firefly_bush, leaf_litter,
  short_dry_grass, tall_dry_grass, test_block, test_instance_block, wildflowers)
- Structured components: 31 new components including tooltip_display, weapon,
  blocks_attacks, potion_duration_scale, provides_trim_material,
  provides_banner_patterns, break_sound, and 25 entity variant components;
  unbreakable changed from Bool to Unit; instrument changed to EitherHolder

Made-with: Cursor
2026-03-21 00:48:27 +08:00
BruceChen
067bd8faff fix: resolve PickItem duplicate key in PacketPalette1214
The PickItem packet was split into PickItemFromBlock (0x22) and
PickItemFromEntity (0x23) in 1.21.4. Mapping both to the same
PacketTypesOut.PickItem enum caused a duplicate key error in the
reverse mapping. Added PickItemFromEntity enum to resolve this.

Made-with: Cursor
2026-03-20 23:55:27 +08:00
BruceChen
f73148e5ec feat: add MC 1.21.4 (protocol 769) support
Add complete protocol 769 support for Minecraft 1.21.4:

- Version constants: Add 769 to supported versions, MC_1_21_4_Version constant,
  and version string mappings (including 1.21.3 -> 768 compatibility)
- Item palette: 10 new items (Resin series + Eyeblossom), generated ItemPalette1214
- Entity palette: Remove CreakingTransient (149 entities, down from 150)
- Block palette: 10 new blocks with correct blockstate ID ranges from server data
- Packet palette: Serverbound packet ID reshuffling - PickItem split into
  PickItemFromBlock/PickItemFromEntity, new PlayerLoaded packet inserted after
  PlayerInput, subsequent IDs shifted accordingly. Clientbound unchanged.
- PlayerLoaded: Send empty PlayerLoaded packet after JoinGame processing (>= 1.21.4)
- EntityMetadata/DataComponents: Reuse 1.20.6 palettes (unchanged registries)
- Update all version guard checks from MC_1_21_2 to MC_1_21_4

Made-with: Cursor
2026-03-20 23:51:56 +08:00
BruceChen
a92bf5b071 feat: complete 1.21.2 protocol handling for terrain, inventory, and entity support
The previous commits added palette files, packet IDs, and structured components
for MC 1.21.2 (protocol 768), but terrain/inventory/entity features were still
disabled at runtime because the version guards in the constructor checked
> MC_1_21_Version (767) instead of > MC_1_21_2_Version (768).

This commit completes the 1.21.2 adaptation with the following changes:

- Update feature-disable guards from > MC_1_21_Version to > MC_1_21_2_Version
  so terrain, inventory, and entity handling are enabled for protocol 768
- Update healthField metadata index guard to > MC_1_21_2_Version
- Handle container ID encoding change: byte -> VarInt for 1.21.2+ in both
  clientbound reads (CloseWindow, WindowItems, WindowProperty, SetSlot) and
  serverbound sends (ClickWindow, CloseWindow)
- Handle EntityTeleport format change: 1.21.2 uses PositionMoveRotation
  (pos + delta + float angles) + relative flags bitmask (int) + onGround
- Handle TimeUpdate format change: 1.21.2 appends a tickDayTime boolean
- Add handlers for new 1.21.2 packets: EntityPositionSync, PlayerRotation,
  SetCursorItem, SetPlayerInventory, MoveMinecartAlongTrack, and
  RecipeBookAdd/Remove/Settings (ignored, MCC doesn't track recipes)

Tested: successful connection to 1.21.2 vanilla server with inventory,
entity tracking, and chat all working correctly.

Made-with: Cursor
2026-03-20 03:45:32 +08:00
BruceChen
57a0dedb33 feat: add packet palette, data components, and protocol fixes for MC 1.21.2
Packet Palette (Phase 2.1):
- Create PacketPalette1212.cs with complete ID mapping for protocol 768
  (131 clientbound + 60 serverbound play packets, plus config packets)
- Add new PacketTypesIn enum values: EntityPositionSync, MoveMinecartAlongTrack,
  PlayerRotation, RecipeBookAdd/Remove/Settings, SetCursorItem, SetHeldSlot,
  SetPlayerInventory
- Add new PacketTypesOut enum values: BundleItemSelected, ClientTickEnd
- Update PacketType18Handler routing for 1.21.2

Data Components (Phase 1.4):
- Create StructuredComponentsRegistry1212 with 67 components (was 57 in 1.21)
  reflecting the new 1.21.2 DataComponents ordering
- Implement 11 new component parsers: ConsumableComponent, UseRemainderComponent,
  UseCooldownComponent, DamageResistantComponent, EnchantableComponent,
  EquippableComponent, RepairableComponent, GliderComponent, TooltipStyleComponent,
  DeathProtectionComponent, ItemModelComponent
- Create FoodComponent1212 (simplified: nutrition/saturation/canAlwaysEat only;
  eatSeconds/effects/usingConvertsTo moved to consumable/use_remainder)
- Create SubComponentRegistry1212 and route in StructuredComponentsHandler

Protocol Fixes:
- Fix PlayerPositionAndLook packet for 1.21.2 (new format: teleportId first,
  added deltaMovement Vec3, flags as Int instead of Byte)
- Fix login success packet (remove strictErrorHandling read for >= 1.21.2)
- Fix ClientSettings/ClientInformation packet (add particleStatus VarInt)
- Add SetHeldSlot as alias for HeldItemChange in packet handler

Verified: MCC connects to 1.21.2 vanilla server, stays connected, chat works.
Made-with: Cursor
2026-03-20 03:25:20 +08:00
BruceChen
df833ae2a8 feat: add palettes and version constants for MC 1.21.2 (protocol 768)
Add item, entity, block, and metadata palettes for Minecraft 1.21.2:
- ItemPalette1212: 1375 items (42 new: pale oak set, colored bundles,
  creaking heart/spawn egg, banner patterns)
- EntityPalette1212: 150 entity types (boats split into per-wood-type
  entries, generic boat/chest_boat removed; added creaking,
  creaking_transient, pale oak boats)
- Palette1212 (blocks): 1084 block types with state IDs generated from
  official 1.21.2 data reports (24 new pale oak blocks, creaking heart,
  pale moss variants)
- EntityMetadataPalette: reuses 1206 (serializers unchanged in 1.21.2)

Updated version infrastructure:
- Protocol18.cs: MC_1_21_2_Version = 768, palette switch routing
- ProtocolHandler.cs: version mapping 1.21.2 <-> 768
- Program.cs: MCHighestVersion bumped to 1.21.2
- ItemType.cs, EntityType.cs, Material.cs: new enum entries

Note: packet palette, structured components, and protocol handler
changes for 1.21.2 are not yet implemented — this commit covers
palette/registry groundwork only.

Made-with: Cursor
2026-03-20 03:02:43 +08:00
BruceChen
896263acc8 fix: resolve entity tracking, container interaction, and enchantment mapping issues for 1.21
- SpawnEntity packet handler now registers non-player entities via OnSpawnEntity
  for protocol >= 1.20.2 (previously only players were tracked, causing 'entity near'
  to find nothing)
- PlaceBlock gains lookAtBlock option that sends a position/rotation update before the
  block placement packet, fixing containers not opening via useblock
- Enchantment registry IDs are now dynamically parsed from server RegistryData
  (minecraft:enchantment), fixing incorrect enchantment name display in 1.21
- AttributeModifiersComponent uses base SubComponent type to avoid InvalidCastException
  when parsing 1.21-specific attribute subcomponents

Made-with: Cursor
2026-03-20 02:35:52 +08:00