Skip to content

Conversation

sovdeeth
Copy link
Member

@sovdeeth sovdeeth commented Aug 4, 2025

Problem

There was no way of replicating the behavior of the vanilla enchanting table without hardcoding weights and chances manually.

Solution

Adds an option to EffEnchant to use ItemFactory#enchantWithLevels (available on paper 1.20.4+), which gives an itemstack a random set of appropriate enchants based on the given level, identical to the behavior of the enchanting table. I did not add the TagKey-based enchant limiting option as I didn't want to get into implementing the key set system and the only option to do it somewhat nicely seems to be reflection.

Testing Completed

manual confirmation
image

Supporting Information

Enchanting a book at a level returns an enchanted book instead. Support for those should also be added, but is out of scope of this PR.


Completes: none
Related: none

@sovdeeth sovdeeth requested a review from a team as a code owner August 4, 2025 05:19
@sovdeeth sovdeeth requested review from Efnilite and Absolutionism and removed request for a team August 4, 2025 05:19
@sovdeeth sovdeeth added the enhancement Feature request, an issue about something that could be improved, or a PR improving something. label Aug 4, 2025
@skriptlang-automation skriptlang-automation bot added the needs reviews A PR that needs additional reviews label Aug 4, 2025
@sovdeeth sovdeeth moved this to In Review in 2.13 Releases Aug 4, 2025
@sovdeeth sovdeeth changed the base branch from master to dev/feature August 4, 2025 05:30
@github-project-automation github-project-automation bot moved this from In Review to Awaiting Merge in 2.13 Releases Aug 5, 2025
@skriptlang-automation skriptlang-automation bot added feature-ready A PR/issue that has been approved, tested and can be merged/closed in the next feature version. and removed needs reviews A PR that needs additional reviews labels Aug 5, 2025
Copy link
Member

@APickledWalrus APickledWalrus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple minor thoughts+questions

@github-project-automation github-project-automation bot moved this from Awaiting Merge to In Review in 2.13 Releases Aug 21, 2025
@skriptlang-automation skriptlang-automation bot removed the feature-ready A PR/issue that has been approved, tested and can be merged/closed in the next feature version. label Aug 21, 2025
@github-project-automation github-project-automation bot moved this from In Review to Awaiting Merge in 2.13 Releases Sep 30, 2025
@skriptlang-automation skriptlang-automation bot added the feature-ready A PR/issue that has been approved, tested and can be merged/closed in the next feature version. label Oct 1, 2025
@sovdeeth sovdeeth merged commit 51553bb into SkriptLang:dev/feature Oct 1, 2025
5 checks passed
@github-project-automation github-project-automation bot moved this from Awaiting Merge to Done - Awaiting Release in 2.13 Releases Oct 1, 2025
@skriptlang-automation skriptlang-automation bot added completed The issue has been fully resolved and the change will be in the next Skript update. and removed feature-ready A PR/issue that has been approved, tested and can be merged/closed in the next feature version. labels Oct 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
completed The issue has been fully resolved and the change will be in the next Skript update. enhancement Feature request, an issue about something that could be improved, or a PR improving something.
Projects
Status: Done - Awaiting Release
Development

Successfully merging this pull request may close these issues.

5 participants