Enchantments are capped at level 255, both functioning and displaying as such. Despite this, items with high enchant levels (255-2,147,483,647) still have their correct level displayed in NBT data.
What I expected to happen was...:
When given a item with a valid high level enchant, it should function at the level intended like previous versions. All levels up to the programmed limit of 2,147,483,647 should function as normal.
What actually happened was...:
Instead, any level that exceeds the level 255 gets capped and brought back down to 255, resulting in a weaker effect compared to what was intended.
Steps to Reproduce:
1. Run the command /give @p diamond_sword{Enchantments:[{id:"sharpness",lvl:50000}]}
2. Hover over the item, you will see that the enchantment level displays as level 255.
3. If you summon a mob with high health such as the command /summon wither, you will not be able to instantly kill it.
4. If you run /data get entity @s Inventory, you will see that the item's data displays the enchantment level as intended. This issue applies to all enchantments and items.
This is intentional, and was changed in 1.17.1 Pre-release 1 (MC-131290).