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

Fix two bugs with block iterator #5566

Merged
merged 7 commits into from
Apr 14, 2023
Merged

Fix two bugs with block iterator #5566

merged 7 commits into from
Apr 14, 2023

Conversation

TheLimeGlass
Copy link
Collaborator

@TheLimeGlass TheLimeGlass commented Mar 30, 2023

Description

First bug fix is the referenced issue that restricts a vector of zero when grabbing blocks with a single location and single direction.
Bukkit throws an IllegalArgumentException if Vector#isZero is true. So we have to disallow that here.

Second bug is the fact that when using direction with a number, the ExprBlocks expression would not respect the value. So for example loop blocks 5 above the player would loop blocks between the player and 100 blocks above because that was the max target block distance. It now properly loops 5 blocks. No clue how no one ever reported this. I guess i'm the only one that uses Skript's overly complex directional support.

I also cleaned up ExprBlocks and BlockLineIterator


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

@TheLimeGlass TheLimeGlass added bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. 2.7 Targeting a 2.7.X version release labels Mar 30, 2023
@TheLimeGlass TheLimeGlass changed the title Restrict a vector of zero Restrict a vector of zero in ExprBlocks iterator Mar 30, 2023
@TheLimeGlass TheLimeGlass changed the title Restrict a vector of zero in ExprBlocks iterator Fix two bugs with block iterator Mar 30, 2023
Copy link
Member

@Moderocky Moderocky left a comment

Choose a reason for hiding this comment

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

Do you think we could get a test to make sure the blocks being looped are actually the ones we expect?

@TheLimeGlass
Copy link
Collaborator Author

Do you think we could get a test to make sure the blocks being looped are actually the ones we expect?

Sure, there isn't really much to test aside from the block iterator size. The other bug is an exception that's fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.7 Targeting a 2.7.X version release 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.

3 participants