Modernise enchantments#8668
Open
bluelhf wants to merge 8 commits into
Open
Conversation
…xprEnchantmentOffer
Absolutionism
requested changes
May 28, 2026
thanks @SirSmurfy2! Co-authored-by: SirSmurfy2 <82696841+theabsolutionism@users.noreply.github.com>
…tments Co-authored-by: SirSmurfy2 <82696841+Absolutionism@users.noreply.github.com>
…edEnchantments" This reverts commit decd611, which was an incorrectly applied suggestion in GitHub UI.
Absolutionism
requested changes
May 30, 2026
| } | ||
|
|
||
| private static final Patterns<Operation> patterns; | ||
| private static final Patterns<Operation> patterns = new Patterns<>(new Object[][]{ |
Contributor
There was a problem hiding this comment.
Suggested change
| private static final Patterns<Operation> patterns = new Patterns<>(new Object[][]{ | |
| private static final Patterns<Operation> PATTERNS = new Patterns<>(new Object[][]{ |
| register(CondItemEnchantmentGlint.class, PropertyType.BE, "forced to [:not] glint", "itemtypes"); | ||
| } | ||
| public static void register(SyntaxRegistry registry) { | ||
| registry.register(SyntaxRegistry.CONDITION, PropertyCondition |
| }); | ||
| Skript.registerEffect(EffEnchant.class, patterns.getPatterns()); | ||
| public static void register(SyntaxRegistry registry) { | ||
| registry.register(SyntaxRegistry.EFFECT, SyntaxInfo.builder(EffEnchant.class) |
| "(clear|delete|reset) %itemtypes%'s enchantment glint override"); | ||
| public static void register(SyntaxRegistry registry) { | ||
| registry.register(SyntaxRegistry.EFFECT, SyntaxInfo.builder(EffForceEnchantmentGlint.class) | ||
| .addPatterns( |
| Skript.registerExpression(ExprAppliedEnchantments.class, EnchantmentType.class, ExpressionType.SIMPLE, "[the] applied enchant[ment]s"); | ||
| public static void register(SyntaxRegistry registry) { | ||
| registry.register(SyntaxRegistry.EXPRESSION, | ||
| builder(ExprAppliedEnchantments.class, EnchantmentType.class) |
| Skript.registerExpression(ExprItemWithEnchantmentGlint.class, ItemType.class, ExpressionType.PROPERTY, "%itemtypes% with[:out] [enchant[ment]] glint"); | ||
| public static void register(SyntaxRegistry registry) { | ||
| registry.register(SyntaxRegistry.EXPRESSION, builder(ExprItemWithEnchantmentGlint.class, ItemType.class) | ||
| .addPattern("%itemtypes% with[:out] [enchant[ment]] glint") |
|
|
||
| public static void register(SyntaxRegistry registry) { | ||
| registry.register(SyntaxRegistry.EXPRESSION, infoBuilder( | ||
| ExprMaximumEnchantmentLevel.class, Integer.class, |
|
|
||
| public static void register(SyntaxRegistry registry) { | ||
| registry.register(SyntaxRegistry.EXPRESSION, infoBuilder( | ||
| ExprMinimumEnchantmentLevel.class, Integer.class, |
| .before("enchantmenttype")); | ||
|
|
||
| Classes.registerClass(new ClassInfo<>(EnchantmentType.class, "enchantmenttype") | ||
| .user("enchant(ing|ment) types?") |
Contributor
There was a problem hiding this comment.
Suggested change
| .user("enchant(ing|ment) types?") | |
| .user("enchant(ing|ment) ?types?") |
Comment on lines
+148
to
+149
| } | ||
| } |
Contributor
There was a problem hiding this comment.
Suggested change
| } | |
| } | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The current enchantment syntaxes are not yet migrated to the new module-based registration system, and their code is in many places out of date both in style and in logic.
Solution
This PR adds a new module for syntaxes related to enchantments, moves the existing syntaxes to the new module, improves their code style and flow and implements three new syntaxes:
Testing Completed
There is a new unit test for stored enchantments. I ran
quickTestto ensure that my changes don't break any of the existing tests.Supporting Information
I would appreciate if people with scripts that use these syntaxes extensively could test to make sure they still work identically to how they were before.
Completes: none
Related: none
AI assistance: Gemini 3.1 Pro was used to evaluate human-made changes