Skip to content

TODO: Add c.containsType(t) to handle wrapper conditions - #85

Open
soleilfenley wants to merge 1 commit into
Lightning-64:mainfrom
soleilfenley:main
Open

soleilfenley wants to merge 1 commit into
Lightning-64:mainfrom
soleilfenley:main

Conversation

@soleilfenley

Copy link
Copy Markdown

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 not and either are "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 a not or an either.

There's a spot in TideFishEntity that 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 inside not/either to 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 not or either, 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:

  • 1.21.1 Fabric (dev client)
  • 1.20.1 Fabric (dev client)
  • 1.21.1 Neoforge (dev client)
  • 1.20.1 Forge (dev client)

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.

1 participant