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

fix: adjust linked filter to be left-right and do not link to new forked instances #2913

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

dordsor21
Copy link
Member

@dordsor21 dordsor21 requested a review from a team as a code owner September 15, 2024 14:17
Copy link

Please take a moment and address the merge conflicts of your pull request. Thanks!

…ked instances

 - Assume that child filters know about their own forks
 - fixes #1874
return this.child;
@Override
public boolean appliesLayer(IChunk chunk, int layer) {
return getLeft().appliesLayer(chunk, layer) && getRight().appliesLayer(chunk, layer);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be ||, shouldn't it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't really sure what was best. Do we want to still filter in one if the other doesn't want to? That implies that edit shouldn't be happening in the layer

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My understanding was that the methods basically mean return whether a filter may do something with the chunk/layer. Now if we say "right only needs to do something if left did something", then AND should be fine, but otherwise not. There's also a theoretical scenario where right can only decide whether it needs to do something after left already did its work. We currently don't have any custom implementations for those methods (the default returns true, other impls just delegate), so maybe it would make sense to just remove them? And if we ever think that something like that might be useful, we can reintroduce it and think about it again, having an actual example at hand.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mm that might be the best solution for now, setting the return for applyChunk to nonnull I suppose

this.child = child;
@Override
public <T extends IChunk> T applyChunk(T chunk, @Nullable Region region) {
chunk = getLeft().applyChunk(chunk, region);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

chunk could be null after the call according to the docs, would it make sense to pass the original value to the right in that case?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose this is similar to above, if it's an OR then we use original of null. If the above is AND then we should probably just return null

}

@Override
public boolean appliesChunk(int chunkX, int chunkZ) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as for appliesLayer

@dordsor21 dordsor21 requested review from SirYwell and a team September 17, 2024 15:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bugfix This PR fixes a bug
2 participants