Skip to content
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

Refactor ExprBeaconValues into multiple expressions, fix bugs. #7729

Open
wants to merge 4 commits into
base: dev/feature
Choose a base branch
from

Conversation

sovdeeth
Copy link
Member

@sovdeeth sovdeeth commented Mar 20, 2025

Description

ExprBeaconValues is an expression that tries to do too many things at once. Since it's trying to handle potion effects, range, and tier all at once, it is very large and overly complex for what it needs to be. This complexity led to multiple bugs not being caught in testing or review, like failing to check if the block state is a beacon before casting it and returning Object.class in acceptChange, which led to lines like set primary effect of {block} to "hello world" being parsed with no errors.

This PR splits the expression into its component parts (ExprBeaconEffects, ExprBeaconTier, ExprBeaconRange) which allows the code to be much simpler in each class. The bugs mentioned above are fixed.

There is a breaking change in the syntax, [beacon] range/tier -> beacon range/tier as I thought that the expressions were too generic without the beacon prefix. Let me know if you disagree or think it not worth changing. The DELETE mode was also removed from the range expression, as deleting a range doesn't make much sense to me.


Target Minecraft Versions: any
Requirements: none
Related Issues: none

@sovdeeth sovdeeth added bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. breaking changes Pull or feature requests that contain breaking changes (API, syntax, etc.) labels Mar 20, 2025
@sovdeeth sovdeeth requested a review from a team as a code owner March 20, 2025 20:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking changes Pull or feature requests that contain breaking changes (API, syntax, etc.) bug An issue that needs to be fixed. Alternatively, a PR fixing an issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants