Skip to content

get enchants() updated. #126

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

get enchants() updated. #126

wants to merge 2 commits into from

Conversation

IKorzI
Copy link

@IKorzI IKorzI commented Feb 25, 2025

Added enchantment handling for versions 1.20.5 to the latest.
The enchantment handling for versions 1.13 to 1.20.4 has been changed. The "typeOfEnchantLevelValue" feature remains "short" for versions 1.8 to the latest. Because of this, the "typeOfEnchantLevelValue" condition has been changed.

Added processing of enchantments for versions from 1.20.5 to the latest
The processing of enchantments has been changed for versions from 1.13 to 1.20.4. The "typeOfEnchantLevelValue" function remains "short" for versions 1.8 to latest. Because of this, "string" was removed for versions 1.13 to 1.20.4, and the "typeOfEnchantLevelValue" condition was replaced in get enchants()
@IKorzI
Copy link
Author

IKorzI commented Feb 25, 2025

Made with: PrismarineJS/minecraft-data#986

@extremeheat
Copy link
Member

enchants really should not be a getter at all. Too much logic it's doing that should only need to be done on construction

@extremeheat
Copy link
Member

CI failing

@IKorzI
Copy link
Author

IKorzI commented Feb 26, 2025

I apologize in advance.
I'm just getting started with pull requests so I might not understand some things.
At the moment, Cl errors are solved by replacing the string

} else if (typeOfEnchantLevelValue === 'short' && enchantNbtKey === 'Enchantments') {

with the string

} else if (typeOfEnchantLevelValue === 'string' && enchantNbtKey === 'Enchantments') {

The typeOfValueForEnchantLevel feature had the value string for versions 1.13 and higher.
That's why there was a condition typeOfEnchantLevelValue === 'string'

But I removed it and therefore changed the condition to typeOfEnchantLevelValue === 'short'

image
PrismarineJS/minecraft-data@ddd0c39

The tests apparently also use the typeOfValueForEnchantLevel feature with the value string

Do I need to return the old condition typeOfEnchantLevelValue === 'string'?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants