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

Add RayTraceConfigurationBuilder #11907

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

Conversation

notTamion
Copy link
Contributor

@notTamion notTamion commented Jan 4, 2025

closes #9942
pre hardfork #10237

Make sure to look at my last comment on the old pre hardfork PR (i still think this is the case)

@notTamion notTamion requested a review from a team as a code owner January 4, 2025 13:44
@notTamion notTamion force-pushed the add-raytracebuilder-hf branch from 309847e to 48c4d68 Compare January 4, 2025 13:47
@lynxplay
Copy link
Contributor

lynxplay commented Jan 4, 2025

Just to make sure I recall the previous design correctly, the idea was that the builder itself contained executing methods and allowed configuration of starting position and direction vector right?

I still do not believe it is a good design choice to have execution methods on the builder/executor type itself, specifically when it itself just calls back to the world. We could however move starting position and direction vector onto the builder too (e.g. in the factory method) and then also expose a wither method on the configuration itself so people can easily update it?

E.g.

final var config = RayTraceConfiguration.builder()
  .direction(dir).origin(pos)
  .target(BLOCKS);
world.rayTrace(config);
world.rayTrace(config.relocate(pos, dir));

Just an idea tho, would love your input on that.

@notTamion
Copy link
Contributor Author

We could however move starting position and direction vector onto the builder too (e.g. in the factory method) and then also expose a wither method on the configuration itself so people can easily update it?

Doesn't that just defeat the purpose of having an immutable configuration?

Unrelated I just think that having a configuration for this just doesn't really work out. The adventure JoinConfiguration (which was used as an example in previous discussions) only defines a format. though here we would basically be defining the values in the configuration. (can't really find a better analogy)

Might be worth having some more people in the community give feedback on what they prefer as i am sure that personal preference is playing a big part here.

@lynxplay
Copy link
Contributor

lynxplay commented Jan 4, 2025

Well that was your issue in the last comment on the pre-hardfork PR tho right?
The fact that consumers need to pass location and direction on each invocation.

The configuration would still be immutable, consumers that ray trace the exact same configuration would be fine and consumers that ray trace the exact "configuration" but from a different location/direction would only have the performance downsides of a single record copy.

This problem however isn't even solved with the previous approach discussed.
The only difference being that the previous approach was completely mutable and took over the responsibility of casting a ray. But yea I agree, more input is definitely needed.

@lynxplay lynxplay added type: feature Request for a new Feature. status: input wanted Looking for community feedback on this issue. labels Jan 4, 2025
@notTamion notTamion changed the title Add RayTraceConfiguration Add RayTraceConfigurationBuilder Jan 4, 2025
@notTamion notTamion force-pushed the add-raytracebuilder-hf branch 2 times, most recently from 576ae99 to 4213483 Compare January 4, 2025 21:57
@notTamion notTamion force-pushed the add-raytracebuilder-hf branch from 4213483 to 0050b10 Compare January 5, 2025 20:06
@notTamion notTamion force-pushed the add-raytracebuilder-hf branch from 0050b10 to 7fc168e Compare January 7, 2025 18:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: input wanted Looking for community feedback on this issue. type: feature Request for a new Feature.
Projects
Status: Changes required
Development

Successfully merging this pull request may close these issues.

Allow changing the raySize of LivingEntity#rayTraceEntities
3 participants