Guaranteed Execution Order for Render Living Modification #9684
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Supersedes #9672, addresses #9118
This PR does a few things:
There has been API drift in the underlying Minecraft classes, the render function has a yaw argument being passed into it that we are not preserving at the time "p_115309_" has now been added to the new event as the yaw parameter
Guarantees that the order that post handlers are called is the exact reverse of the order the pre handlers are called. For certain types of render modification this needs to be true. Things like state modification of pose stack need this to guarantee their callers are not operating on another modders state, right now it is possible that Mod A and B could be popping each others pushes instead of unwinding the stack appropriately.
Reduces the number of events dispatched per entity rendering. My previous attempt at solving RenderLivingEvent Posestacks #9118 introduced a third event, increasing overhead. This solution actually reduces the overhead from 2 events to 1 while increasing the guarantees around rendering.
Introduces some examples that confirm that the 2 major problems are fixed, to see how the problems manifest in the current state of forge take a look at rendering examples to demonstrate current issues with pre/post events #9674