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

Check Food 'Edibility' #149

Merged
merged 9 commits into from
May 21, 2020
Merged

Check Food 'Edibility' #149

merged 9 commits into from
May 21, 2020

Conversation

yeelp
Copy link
Contributor

@yeelp yeelp commented May 21, 2020

An important implementation detail that I'm not entirely sure about. Would it be better to throw a RuntimeException when an IllegalAccessException or UnableToFindFieldException are caught? Or would it be better to silently ignore and return false?

EDIT: Forgot to add this closes #148

@yeelp
Copy link
Contributor Author

yeelp commented May 21, 2020

The ObfuscationReflectionHelper I used in my project is different than the one used here somehow? Strange, but this can be fixed

@squeek502
Copy link
Owner

squeek502 commented May 21, 2020

Thanks! Ended up changing up the reflection implementation and renamed the method to canPlayerEatFood since isFoodEdible seemed like a confusing name because there is already an isEdible.

@squeek502 squeek502 merged commit 515c42b into squeek502:1.12.2 May 21, 2020
@squeek502
Copy link
Owner

Oh, and just to answer this:

Would it be better to throw a RuntimeException when an IllegalAccessException or UnableToFindFieldException are caught? Or would it be better to silently ignore and return false?

I always prefer hard crashes over silent failures for stuff like this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature Request] Checking 'edibility status' of food items
2 participants