From caf6de67927d98ed9e13710503f37f59a9017e8b Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Wed, 22 Nov 2017 22:24:27 +1100 Subject: [PATCH] Fix block break animation only beginning to play after switching back to first person camera, if block was broken with third person camera. (Thanks Cybertoon) --- ClassicalSharp/Rendering/HeldBlockRenderer.cs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/ClassicalSharp/Rendering/HeldBlockRenderer.cs b/ClassicalSharp/Rendering/HeldBlockRenderer.cs index c3a91c5c0..9476335ca 100644 --- a/ClassicalSharp/Rendering/HeldBlockRenderer.cs +++ b/ClassicalSharp/Rendering/HeldBlockRenderer.cs @@ -43,7 +43,7 @@ namespace ClassicalSharp.Renderers { } public void Render(double delta) { - if (game.Camera.IsThirdPerson || !game.ShowBlockInHand) return; + if (!game.ShowBlockInHand) return; float lastSwingY = swingY; swingY = 0; block = game.Inventory.Selected; @@ -55,8 +55,16 @@ namespace ClassicalSharp.Renderers { ResetHeldState(); DoAnimation(delta, lastSwingY); - SetBaseOffset(); + SetBaseOffset(); + if (!game.Camera.IsThirdPerson) RenderModel(); + game.Graphics.LoadMatrix(ref game.View); + game.Graphics.SetMatrixMode(MatrixType.Projection); + game.Graphics.LoadMatrix(ref game.Projection); + game.Graphics.SetMatrixMode(MatrixType.Modelview); + } + + void RenderModel() { game.Graphics.FaceCulling = true; game.Graphics.Texturing = true; game.Graphics.SetupAlphaState(BlockInfo.Draw[block]); @@ -76,11 +84,6 @@ namespace ClassicalSharp.Renderers { game.Graphics.RestoreAlphaState(BlockInfo.Draw[block]); game.Graphics.DepthTest = true; game.Graphics.FaceCulling = false; - - game.Graphics.LoadMatrix(ref game.View); - game.Graphics.SetMatrixMode(MatrixType.Projection); - game.Graphics.LoadMatrix(ref game.Projection); - game.Graphics.SetMatrixMode(MatrixType.Modelview); } static Vector3 nOffset = new Vector3(0.56f, -0.72f, -0.72f);