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>
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
- 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
- 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
- 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
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
- 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.
- 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.
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
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
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
- 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
- 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
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
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
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
- 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
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
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
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
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
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
- 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
1.20.6 introduced three new EntityDataSerializer types compared to 1.20.4:
- PARTICLES (id 18) - list of particles, inserted after PARTICLE
- WOLF_VARIANT (id 23) - wolf variant holder, inserted after CAT_VARIANT
- ARMADILLO_STATE (id 28) - armadillo state, inserted after SNIFFER_STATE
These insertions shifted subsequent serializer IDs, causing the 1.19.4
palette (EntityMetadataPalette1194) to misidentify metadata types on
1.20.6+ servers. This could lead to incorrect byte consumption and
potential packet parse failures when entities with affected metadata
types (e.g. wolves, armadillos, area effect clouds with particles)
were present.
Changes:
- Add Particles, WolfVariant, ArmadilloState to EntityMetaDataType enum
- Create EntityMetadataPalette1206 with correct 31-entry ID mapping
- Route 1.20.6+ to the new palette in EntityMetadataPalette.GetPalette()
- Add read logic for the three new types in DataTypes.cs
Verified on 1.21.1 vanilla server: cat, wolf, frog, armadillo, painting
entities all spawn without metadata parse errors.
Made-with: Cursor
Fix the Explosion packet handler that was truncating reads at the
knockback fields, leaving BlockInteraction, particles, and SoundEvent
bytes unconsumed for 1.20.4+. The old commented-out code had three bugs:
conditional particle read (should always read both small and large),
reading SoundEvent as a plain string (it's a Holder<SoundEvent> encoded
as VarInt id + optional inline DIRECT_STREAM_CODEC), and an incorrect
fixedRange version gate. Verified against decompiled ClientboundExplodePacket
from both 1.20.6 and 1.21.1 — the wire format is identical across versions.
Update LoadDefaultAttributes() fallback to match the 1.21.1 registry
order (31 attributes), adding 9 new entries: burning_time,
explosion_knockback_resistance, mining_efficiency, movement_efficiency,
oxygen_bonus, sneaking_speed, submerged_mining_speed,
sweeping_damage_ratio, and water_movement_efficiency. This fallback is
only used when the server omits the attribute RegistryData packet.
Made-with: Cursor
- Add AttributeSubComponent121 that uses ResourceLocation(string) instead
of UUID+Name, matching the 1.21 attribute modifier wire format change.
Register it in SubComponentRegistry121 via new ReplaceSubComponent method.
- Add ProjectilePower packet handler: reads 1 double (accelerationPower)
for 1.21+, or 3 doubles (xPower/yPower/zPower) for 1.20.6.
- Add CustomReportDetails and ServerLinks packet handlers in both Play
and Configuration phases, consuming all fields to prevent byte offset
errors on 1.21 servers.
Made-with: Cursor
Add ItemPalette121.cs with item ID mappings for MC 1.21 (protocol 767).
Add three new music disc entries to ItemType enum: MusicDiscCreator,
MusicDiscCreatorMusicBox, and MusicDiscPrecipice, introduced in 1.21.
Made-with: Cursor
Audited batch 5 components (ChargedProjectiles, BundleContents, Container,
WritableBookContent, BlockState, PotDecorations) against official 1.20.6
decompiled STREAM_CODEC definitions. All network encodings were correct.
Removed redundant NumberOfItems/NumberOfPages/NumberOfProperties fields from
ContainerComponent, WritableBlookContentComponent, BlockStateComponent, and
PotDecorationsComponent. Serialize now uses the actual collection .Count
instead of a potentially stale cached value, matching the pattern already
used by ContainerComponent's Serialize and other components.
Also modernized loop style (foreach with deconstruction where applicable)
and fixed a typo in an exception message ("setialize" -> "serialize").
Made-with: Cursor
In 1.20.6+, ComponentSerialization.STREAM_CODEC uses
ByteBufCodecs.fromCodecWithRegistries (NBT tag format), not plain string.
The previous implementation incorrectly used ReadNextString/GetString
for custom_name (5), item_name (6), and lore (7) components.
Fixed all three to use ReadNextNbt/GetNbt, preserving raw NBT data for
round-trip serialization while still extracting readable text via
ChatParser.ParseText(Dictionary).
Other batch 4 components (custom_data, entity_data, bucket_entity_data,
block_entity_data, debug_stick_state, map_decorations, recipes, lock,
container_loot, intangible_projectile — all NBT; hide_additional_tooltip,
hide_tooltip, fire_resistant, creative_slot_lock — all Unit/Empty;
note_block_sound — ResourceLocation string) were verified correct.
Made-with: Cursor
Audited all 14 simple binary components (batch 3): max_stack_size,
max_damage, damage, unbreakable, rarity, custom_model_data, repair_cost,
enchantment_glint_override, ominous_bottle_amplifier, dyed_color,
map_color, map_id, map_post_processing, base_color.
Found and fixed 1 bug:
- EnchantmentGlintOverrideComponent: was reading/writing VarInt but the
official STREAM_CODEC uses ByteBufCodecs.BOOL (single byte boolean).
Changed property type from int to bool, Parse from ReadNextVarInt to
ReadNextBool, and Serialize from GetVarInt to GetBool.
All other 13 components matched the official 1.20.6 STREAM_CODEC
definitions exactly.
Verified in-game: connected to 1.20.6 vanilla server, received items
with enchantment_glint_override=true/false, dyed_color, map_color,
map_id, base_color, unbreakable, rarity, custom_model_data, repair_cost,
damage, max_damage. All parsed and serialized correctly with no errors.
Made-with: Cursor
Audited all 8 batch-2 components (enchantments, stored_enchantments,
can_place_on, can_break, lodestone_tracker, firework_explosion, fireworks,
banner_patterns, suspicious_stew_effects, bees) against official 1.20.6
decompiled STREAM_CODEC definitions.
Found and fixed 3 bugs in BlockPredicate/PropertySubComponent:
1. BlockPredicateSubcomponent.Serialize(): missing HasNbt bool write.
Parse reads the bool but Serialize skipped writing it, causing all
subsequent fields to be offset by one byte.
2. BlockPredicateSubcomponent.Serialize(): missing Properties list count
VarInt write. Parse reads VarInt count before iterating, but Serialize
only wrote the elements without the preceding count.
3. PropertySubComponent: RangedMatcher min/max values must use Optional
encoding (Bool prefix + conditional String), matching the official
ByteBufCodecs.either(ExactMatcher, RangedMatcher) where RangedMatcher
uses ByteBufCodecs.optional(STRING_UTF8) for both min and max fields.
Previously read/wrote plain Strings unconditionally.
Remaining 6 components (enchantments, stored_enchantments, lodestone_tracker,
firework_explosion, fireworks, banner_patterns, suspicious_stew_effects, bees)
verified correct — no changes needed.
Made-with: Cursor
Audited all 8 high-complexity structured components against official 1.20.6
decompiled STREAM_CODEC definitions. Found and fixed bugs in 3 components
plus a systemic NBT serialization issue:
TrimComponent (ID 35):
- Serialize had TrimPatternType and ShowInTooltip incorrectly nested inside
the TrimMaterialType==0 branch; moved them outside to match Parse logic
- Description fields (TrimMaterial.description, TrimPattern.description) were
read/written as String but official codec uses ComponentSerialization
(NBT Tag format); changed to ReadNextNbt/GetNbt
ProfileComponent (ID 46):
- Serialize was missing the HasUniqueId Bool prefix before UUID
- Serialize only wrote properties when count > 0 but omitted the VarInt count
prefix entirely when empty; now always writes VarInt count
WrittenBookContentComponent (ID 34):
- Page content uses Filterable<Component> where Component is NBT-encoded via
ComponentSerialization.STREAM_CODEC, not plain String; changed Parse to use
ReadNextNbt and Serialize to use GetNbt
- Added RawContentNbt/FilteredContentNbt fields to BookPage record for
round-trip NBT preservation
- Removed unnecessary ChatParser.ParseText on title (it's a plain string)
DataTypes.GetNbt:
- Added TAG_String root support for 1.20.4+ (chat components like "Page 1"
are encoded as TAG_String, not TAG_Compound)
- Fixed root name handling: versions >= 1.20.2 omit the root compound name,
but GetNbt was unconditionally writing it
Components confirmed correct (no changes needed):
- FoodComponentComponent (ID 20), ToolComponent (ID 22),
InstrumentComponent (ID 40), PotionContentsComponent (ID 31),
AttributeModifiersComponent (ID 12)
Made-with: Cursor
EnchantmentsComponent (used by both regular and stored enchantments)
was directly casting the registry VarInt ID to the Enchantments enum
via (Enchantments)id. However, the Enchantments enum is ordered
alphabetically (AquaAffinity=0, BaneOfArthropods=1, ..., Sharpness=32)
while the 1.20.6 registry uses a completely different order
(protection=0, fire_protection=1, ..., sharpness=13). This caused all
enchantment names to display incorrectly (e.g. Sharpness V shown as
"Unknown Enchantment with ID: 32").
Changes:
- Parse now uses EnchantmentMapping.GetEnchantmentByRegistryId1206()
to properly map registry IDs to enum values via the existing
1.20.6+ mapping table
- Serialize now uses EnchantmentMapping.GetRegistryId1206ByEnchantment()
to convert enum values back to registry IDs (reverse lookup)
- Fixed translation key prefix: "Enchantments.minecraft." (wrong) ->
"enchantment.minecraft." (matches en_us.json resource keys)
- Fixed 3 long-standing typos in the Enchantments enum that prevented
translation lookup from matching resource keys:
- DepthStrieder -> DepthStrider (depth_strieder vs depth_strider)
- Efficency -> Efficiency (efficency vs efficiency)
- Loyality -> Loyalty (loyality vs loyalty)
Verified on vanilla 1.20.6 server: items with sharpness, efficiency,
unbreaking, fortune, mending, and bane_of_arthropods all display
correct localized names (锋利, 效率, 耐久, 时运, 经验修补, 节肢杀手).
Made-with: Cursor