mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2026-08-15 13:04:36 +00:00
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
49 lines
942 B
C#
49 lines
942 B
C#
namespace MinecraftClient.Inventory
|
|
{
|
|
// Not implemented for 1.14
|
|
public enum Enchantments : short
|
|
{
|
|
AquaAffinity = 0,
|
|
BaneOfArthropods,
|
|
BindingCurse,
|
|
BlastProtection,
|
|
Breach,
|
|
Channeling,
|
|
DepthStrider,
|
|
Density,
|
|
Efficiency,
|
|
FeatherFalling,
|
|
FireAspect,
|
|
FireProtection,
|
|
Flame,
|
|
Fortune,
|
|
FrostWalker,
|
|
Impaling,
|
|
Infinity,
|
|
Knockback,
|
|
Looting,
|
|
LuckOfTheSea,
|
|
Loyalty,
|
|
Lure,
|
|
Mending,
|
|
Multishot,
|
|
Piercing,
|
|
Power,
|
|
ProjectileProtection,
|
|
Protection,
|
|
Punch,
|
|
QuickCharge,
|
|
Respiration,
|
|
Riptide,
|
|
Sharpness,
|
|
SilkTouch,
|
|
Smite,
|
|
SoulSpeed,
|
|
Sweeping,
|
|
SwiftSneak,
|
|
Thorns,
|
|
Unbreaking,
|
|
VanishingCurse,
|
|
WindBurst
|
|
}
|
|
}
|