Skip to content

(1.16) Optimize and improve enums #4456

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

Merged
merged 2 commits into from
Apr 29, 2022

Conversation

Matyrobbrt
Copy link
Contributor

@Matyrobbrt Matyrobbrt commented Apr 29, 2022

This PR improves the performance of the methods in the different enums, especially the ones in EnumBestiaryPages:

  • new Random()s are replaced with ThreadLocalRandom.current()
  • useless Map<Integer, Enum>s are removed, in favour of Enum.values()
  • integers are no longer uselessly converted to an enum, and later, converted to their int representation
  • the method EnumBestiaryPages#hasAllPages now uses Collection#containsAll(Collection), and works (before the method didn't work, as it returned too early)

ForgeGradle is also updated to 5+.

@Matyrobbrt Matyrobbrt changed the title Improve enums (1.16) Optimize and improve enums Apr 29, 2022
@AlexModGuy
Copy link
Owner

has conflicts

@PaintNinja
Copy link
Contributor

Fixed merge conflicts

@AlexModGuy AlexModGuy merged commit dd9c25f into AlexModGuy:1.16.3 Apr 29, 2022
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.

3 participants