Commit graph

83 commits

Author SHA1 Message Date
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
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
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
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
BruceChen
2fb09342a3 feat: add ItemPalette121 and new 1.21 music disc item types
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
2026-03-20 01:22:16 +08:00
BruceChen
a36ba23ba6 fix: StructuredComponents batch 1 audit — TrimComponent, ProfileComponent, WrittenBookContent, and NBT serialization
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
2026-03-20 00:09:05 +08:00
BruceChen
79a0dff8cd Fix enchantment name display for 1.20.6 structured components
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
2026-03-19 02:01:15 +08:00
BruceChen
8eac21b4a4 Wire up 1.20.6 structured components to Item and fix GetItemSlot serialization
In 1.20.6+, items use structured components instead of NBT for metadata.
Previously, ReadNextItemSlot parsed the components but never stored them
on the Item instance, leaving DisplayName/Lores/Damage/Enchantments all
empty. GetItemSlot also still used the pre-1.20.6 format (bool + VarInt +
byte + NBT), causing the server to reject any item operation packets.

Changes:

Item.cs:
- Add List<StructuredComponent>? Components field to hold the raw
  component list for round-trip serialization
- DisplayName property: read from CustomNameComponent (with
  ItemNameComponent as fallback) when Components is present
- Lores property: read from LoreNameComponent1206 when Components is
  present
- Damage property: read from DamageComponent when Components is present
- Add EnchantmentList property: read from EnchantmentsComponent (covers
  both normal and StoredEnchantmentsComponent for enchanted books)
- ToFullString(): use EnchantmentList with EnchantmentMapping for display
  when available, fall back to NBT path for older versions
- Add CloneWithCount() method that preserves both NBT and Components

DataTypes.cs - ReadNextItemSlot:
- Assign parsed strcturedComponentsToAdd to item.Components

DataTypes.cs - GetItemSlot:
- Add 1.20.6+ branch: write VarInt(count) + VarInt(itemId) + component
  counts + serialized components (using each component's TypeId and
  Serialize() method)
- Empty slot sends VarInt(0) per the 1.20.6 protocol spec

StructuredComponent.cs:
- Add int TypeId property (default -1) to store the registry type ID
  assigned during parsing, enabling round-trip serialization

StructuredComponentRegistry.cs:
- Set component.TypeId = id after instantiation in ParseComponent()

McClient.cs:
- Replace manual Item constructor calls (new Item(type, count, nbt))
  with Item.CloneWithCount() to preserve Components during inventory
  operations like slot moves, stack splits, and right-click placement

Made-with: Cursor
2026-03-19 00:34:10 +08:00
Anon
f83e7c5707 Preliminary 1.21 Support 2024-12-06 16:45:48 +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
76e873ed54 WIP: Added some strctured components 2024-09-11 19:12:31 +02:00
Anon
5a6fd577e5 Inventory, Terrain and Entity handling 2024-07-02 11:08:46 +02:00
Anon
08c5c15557 1.20.6 - Not working yet 2024-06-16 01:19:09 +02: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
ReinforceZwei
4546e6946e 1.20.4: Update entity, item and block palette 2024-02-11 18:13:48 +08:00
ozi2285
968f864f34
Added ShiftRightClick (#2582)
* Added ShiftRightClick

* Added ShiftRightClick

* Added ShiftRightClick

* Added ShiftRightClick

* Added ShiftRightClick

* Added ShiftRightClick

* Added ShiftRightClick

* Added ShiftRightClick

* Updated Protocol18.cs ShiftRightClick Description for ReinforceZwei's  Suggestion

* Just Deleted Added ShiftRightClick's Description Line

* Just Deleted Added ShiftRightClick's Description Lines

* Made Change With Informaiton ReinforceZwei Given to Me About Switch-Case and Shorten the Code.

* Re Added Lines That Got Deleted By Mistake

* Add translation key for shift right-click

---------

Co-authored-by: ReinforceZwei <39955851+ReinforceZwei@users.noreply.github.com>
2023-09-16 19:39:55 +08:00
Anon
272900d52e Added slab handling for 1.20/.1
Added Farm bot crops handling for 1.20/.1
Added utilities for Containers/Inventories
Added bot movement lock to prevent multiple bots that use movements from running at the same time.
General code improvements.
2023-06-23 16:25:18 +02:00
Anon
ae7ce35cc8 Fully Implemented 1.20 2023-06-08 19:27:28 +02:00
Anon
df6eeb9b4a Added item lore/description to be displayed in the list of items in the inventory 2023-04-30 15:18:33 +02:00
Anon
2e55a6bc85 Added palettes 2023-03-21 23:31:10 +01:00
BruceChen
957054eb12 1.19.3 entity & inventory & terrain support 2023-01-14 22:18:05 +08:00
BruceChen
892999ac98 Merge into master 2022-12-06 20:32:46 +08:00
BruceChen
84cf749344 Implement command completion suggestions. 2022-12-06 15:50:17 +08:00
BruceChen
ef39e8329c [SKIP_BUILD] Change file encoding to UTF-8 with BOM 2022-11-28 13:55:05 +08:00
BruceChen
077e3a5e9f
Crowdin localization support (#2310)
* Switching to use resource files

* Update Crowdin configuration file

* Code cleanup
2022-10-28 11:13:20 +08:00
BruceChen
d4f8dd0bfb Upgrade AutoFishing & Bug fix 2022-10-21 19:05:49 +08:00
Milutinke
a31b4a792b Improvements to the Bed, Blockinfo and Enchant commands. 2022-10-17 15:14:55 +02:00
BruceChen
db568b320c Trim 2022-10-17 20:04:49 +08:00
BruceChen
117a38b5f9 Better translation 2022-10-17 20:00:33 +08:00
BruceChen
bce2bc8b7f Support displaying caught items 2022-10-17 17:42:00 +08:00
BruceChen
db6d6c80bf Bug fix 2022-10-16 20:37:07 +08:00
Milutinke
6365e12735 Fixed Enchantment mappings for 1.19.
Added Swift Sneak.
2022-10-14 16:29:08 +02:00
Milutinke
c47add39a4 Added Enchanting Table ASCII Art.
Added ChatBot method for enchantments.
Changed the how the list of enchantments looks, now looks cleaner + has Roman numbers.
Added safe guards to the echant command.
2022-10-14 15:33:33 +02:00
Milutinke
4dc1b420f5 Added enchanting 2022-10-12 19:51:01 +02:00
BruceChen
bdcc22b465 Add update detection 2022-10-06 14:53:05 +08:00
BruceChen
53898f3446 Fix xxx.Parse 2022-10-04 11:53:07 +08:00
BruceChen
1d52d1eadd
Fix all warnings & Trim (#2226)
* Fix AutoFishing crash
* Fix all warnings
* Remove DotNetZip.
* Fix the usage of HttpClient.
2022-10-02 18:31:08 +08:00
Milutinke
55057b3157 Added ASCII Art for Furnace/Smoker/Blast Furnace, Hopper/Minecart, Shulker, Grindstone. Added a command for list of available inventories. Added SmithingTable inventory type. 2022-09-22 21:58:51 +02:00
Milutinke
d7310e477b Added Item, Entity, Block, Material Palettes for 1.19. Fixed SpawnEntity and disabled BlockChange packet on 1.19 to prevent crashing until it's fixed. Enabled Entity and Inventory handling. 2022-08-22 19:46:30 +02:00
ORelio
1ce7850193 MC 1.17/1.18 Terrain/Entity/Inventory (#1943)
Merge branch 'master' of github.com:milutinke/Minecraft-Console-Client into milutinke-master

Manually fix merge conflicts
Additional changes:
 - WindowItems: Fix data type for "elements" below 1.17
 - DestroyEntities: Fix packet palettes and remove DestroyEntity
 - EntityMetadata: Throw exception if health field mapping is not updated

Co-authored-by: Milutinke <bgteam@live.com>
Co-authored-by: BruceChen <MrChen131217@gmail.com>
2022-08-19 16:35:55 +02:00
BruceChen
a8bbb1ac76
Basic support for minecraft 1.19 (#2084)
* merge commit from milutinke
* chat signature & encrypted login
* Bug fix :EncryptionResponse format error below 1.18.2
* Implemented chat command signature
* Chat message parsing and verification for 1.19
* Add signature settings
* Update Simplified Chinese Translation
* Clear up comments
* Fix wrong variable naming
* Bug fix: SignatureV2 Processing
2022-08-15 17:55:44 +02:00
Dušan Milutinović
3d8c112159 Implemented "Click Window" for 1.18 (now sending the new required fields), formated few files with Visual Studio formatting. PS: left debug for people to see, I'll remove it once everything is working 2022-07-01 18:59:58 +02:00
Dušan Milutinović
9d3357eeee Fixed requested changes in the review. Except: Container (TODO) 2022-06-28 13:45:23 +02:00