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 NoSuchElementException #27

Merged
merged 4 commits into from
Oct 30, 2022
Merged

Fix NoSuchElementException #27

merged 4 commits into from
Oct 30, 2022

Conversation

TrollsterCooleg
Copy link
Contributor

@TrollsterCooleg TrollsterCooleg commented Oct 21, 2022

Line 105 (107 after pull request) pulls the next item from an iterator of block drop ItemStacks. However, if the drops are empty, it creates a NoSuchElementException. All this code does is return if the list is empty so it doesn't error in console, just skipping the drop multiplying code (no need to try and multiply nothing!)

@TrollsterCooleg
Copy link
Contributor Author

Just realized im dumb and that you used a runnable for some reason? either way my fixes probably wont work too well. the first commit should be fine but the second one wouldnt work due to the fact that you use a runnable for some reason

@TrollsterCooleg
Copy link
Contributor Author

closing

@Chafficui Chafficui self-assigned this Oct 27, 2022
@Chafficui Chafficui reopened this Oct 27, 2022
@Chafficui Chafficui added the bug Something isn't working label Oct 27, 2022
@Chafficui Chafficui linked an issue Oct 27, 2022 that may be closed by this pull request
@Chafficui
Copy link
Member

@TrollsterCooleg Your fixes look good to me and I don't see why the runnable should be a problem. One line you added was at a wrong position, but I fixed it.
Please test it and tell me if it works now. If it still does not work you could try to remove the runTaskLater.

@TrollsterCooleg
Copy link
Contributor Author

The problem is that the event priority is set to lowest so it can process first, adding all the items to the drops for other plugins to handle. However the other plugins would still process first because it waits 2 ticks to add the items to the drops.

@Chafficui
Copy link
Member

Ok I do understand now. I don't really know why I did add the 2 tick delay there, so you can remove it if you'd like to. I will merge it when you did.

@Chafficui Chafficui removed their assignment Oct 27, 2022
Commit 8800886 changed the EventPriority which is not content of this PullRequest
@Chafficui Chafficui merged commit 9ee833c into ChafficPlugins:master Oct 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Mining blocks generated an exception!
2 participants