ldtteam / minecolonies

Minecolonies minecraft mod
http://minecolonies.com/
GNU General Public License v3.0
657 stars 336 forks source link

Avoid nearby colony lookup on each frame #9972

Closed someaddons closed 3 months ago

someaddons commented 4 months ago

Closes # Closes # Closes #

Changes proposed in this pull request:

[x ] Yes I tested this before submitting it. [ ] I also did a multiplayer test.

Review please

uecasm commented 4 months ago

Wouldn't it make more sense to cache this based on the player crossing chunk boundaries? There's already some other stuff in here that does that, and the nearby colony is unlikely to change without the player moving around.

someaddons commented 4 months ago

The other stuff you're thinking on is serverside, clientside just has one player and data is more volatile due to sync timing. So performance wise there is little benefit to more caching and it'd have a higher risk of problems

Nightenom commented 4 months ago

Just wonderin, can't we do once per second vs random out of 20?

uecasm commented 4 months ago

No, it's client-side too. Look inside the ColonyBorderRenderer and the ColonyBlueprintRenderer for example.