TODO: Add c.containsType(t) to handle wrapper conditions - #85
Open
soleilfenley wants to merge 1 commit into
Open
soleilfenley wants to merge 1 commit into
soleilfenley wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
While working on a possible 26.2 port, I passed by this TODO and thought it'd be an easy contribution~!
From what I understand:
Fish conditions can be nested — things like
notandeitherare "wrapper" conditions that hold other conditions inside them, rather than checking anything themselves. So a fish's whitelist condition might not always sit at the top level; it could be buried inside anotor aneither.There's a spot in
TideFishEntitythat peeks at a fish's conditions beforehand to decide if it's worth doing an expensive "find the nearest non-water biome" search, by checking if any condition is a biome whitelist. The problem was that check only ever looked at the top of each condition — it never looked insidenot/eitherto see what they were wrapping. So if a fish's whitelist happened to be nested inside one of those, the check would say "nope, no whitelist here" and skip the biome search, even though the fish's actual spawn logic absolutely does use that whitelist once it's evaluated for real.The fix just makes that check recursive — if it hits a
notoreither, it now looks inside them instead of giving up immediately.Not super well-versed in Java, so I hope my first pull request is good~!
Confirmed working on: