mirror of
https://github.com/FabricMC/fabric.git
synced 2024-12-02 12:28:13 -05:00
Fix screen api passing wrong MatrixStack to render events (#3061)
This commit is contained in:
parent
a37e8e70b7
commit
3bd4ab0f82
1 changed files with 4 additions and 4 deletions
|
@ -42,17 +42,17 @@ abstract class GameRendererMixin {
|
|||
private Screen renderingScreen;
|
||||
|
||||
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/Screen;renderWithTooltip(Lnet/minecraft/client/util/math/MatrixStack;IIF)V"), locals = LocalCapture.CAPTURE_FAILEXCEPTION)
|
||||
private void onBeforeRenderScreen(float tickDelta, long startTime, boolean tick, CallbackInfo ci, int mouseX, int mouseY, MatrixStack matrices) {
|
||||
private void onBeforeRenderScreen(float tickDelta, long startTime, boolean tick, CallbackInfo ci, int mouseX, int mouseY, MatrixStack worldStack, MatrixStack screenStack) {
|
||||
// Store the screen in a variable in case someone tries to change the screen during this before render event.
|
||||
// If someone changes the screen, the after render event will likely have class cast exceptions or an NPE.
|
||||
this.renderingScreen = this.client.currentScreen;
|
||||
ScreenEvents.beforeRender(this.renderingScreen).invoker().beforeRender(this.renderingScreen, matrices, mouseX, mouseY, tickDelta);
|
||||
ScreenEvents.beforeRender(this.renderingScreen).invoker().beforeRender(this.renderingScreen, screenStack, mouseX, mouseY, tickDelta);
|
||||
}
|
||||
|
||||
// This injection should end up in the try block so exceptions are caught
|
||||
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/Screen;renderWithTooltip(Lnet/minecraft/client/util/math/MatrixStack;IIF)V", shift = At.Shift.AFTER), locals = LocalCapture.CAPTURE_FAILEXCEPTION)
|
||||
private void onAfterRenderScreen(float tickDelta, long startTime, boolean tick, CallbackInfo ci, int mouseX, int mouseY, MatrixStack matrices) {
|
||||
ScreenEvents.afterRender(this.renderingScreen).invoker().afterRender(this.renderingScreen, matrices, mouseX, mouseY, tickDelta);
|
||||
private void onAfterRenderScreen(float tickDelta, long startTime, boolean tick, CallbackInfo ci, int mouseX, int mouseY, MatrixStack worldStack, MatrixStack screenStack) {
|
||||
ScreenEvents.afterRender(this.renderingScreen).invoker().afterRender(this.renderingScreen, screenStack, mouseX, mouseY, tickDelta);
|
||||
// Finally set the currently rendering screen to null
|
||||
this.renderingScreen = null;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue