-
-
Notifications
You must be signed in to change notification settings - Fork 531
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
Blasting Highlight Event Visual Bug? #8240
Blasting Highlight Event Visual Bug? #8240
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, and I am sorry for taking a while to get to reviewing this. Only a minor cleanup related comment.
@@ -385,7 +385,9 @@ public void onBlockHover(RenderHighlightEvent.Block event) { | |||
Lazy<VertexConsumer> lineConsumer = Lazy.of(() -> renderer.getBuffer(RenderType.lines())); | |||
for (Entry<BlockPos, BlockState> block : blocks.entrySet()) { | |||
BlockPos blastingTarget = block.getKey(); | |||
if (!pos.equals(blastingTarget) && !ClientHooks.onDrawHighlight(levelRenderer, info, rayTraceResult, event.getDeltaTracker(), matrix, renderer)) { | |||
// simulate ray tracing results for all block positions | |||
BlockHitResult currResult = new BlockHitResult(rayTraceResult.getLocation(), rayTraceResult.getDirection(), blastingTarget, rayTraceResult.isInside()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this can be rayTraceResult.withPosition(blastingTarget)
. We can also jjust inline it in the call to ClientHooks#onDrawHighlight
so that we don't have to construct the new object for if the position is already the blasting target.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how did you know that helper exists 😮
This is my first time trying to contribute something to someone else's repo, please be kind.
Problem
I was looking at the
RenderHighlightEvent
code for the AoE blasting, and I noticed that you are calling recursiveRenderHighlightEvent
s for each block affected, so that they may have a chance to cancel themselves.However, when creating those recursive events, you pass the original
rayTraceResult
as parameter. I believe this means that instead of simulating one event for each block in the AoE, you actually simulate the origin-block's event many times over.Changes proposed in this pull request:
Create a seperate
BlockHitResult
for eachblastingTarget
blockPos. For its parameters, I essentially cloned the originalBlockHitResult
, changing only the blockPos. So for example if the original block was 'hit' at the top left, every AoE block is going to simulate a top left hit aswell.