@@ -89,7 +89,7 @@ public SpatialRenderer(int x, int y, int width, int height) throws IOException {
8989 }
9090
9191 public void dispose () {
92- if (isDisposed ) return ;
92+ if (isDisposed ) return ;
9393 this .isDisposed = true ;
9494 renderTarget .destroyBuffers ();
9595 renderTypeStore .dispose ();
@@ -132,8 +132,7 @@ public void renderWidget(GuiGraphics graphics, int mouseX, int mouseY, float par
132132
133133 var width = Minecraft .getInstance ().getWindow ().getWidth ();
134134 var height = Minecraft .getInstance ().getWindow ().getHeight ();
135- if (width != renderTarget .width || height != renderTarget .height )
136- {
135+ if (width != renderTarget .width || height != renderTarget .height ) {
137136 renderTarget .resize (width , height , true );
138137 translucencyChain .resize (renderTarget .width , renderTarget .height );
139138 recalculateTranslucency ();
@@ -143,45 +142,48 @@ public void renderWidget(GuiGraphics graphics, int mouseX, int mouseY, float par
143142 var originalSorting = RenderSystem .getVertexSorting ();
144143
145144 var projectionMatrix = new Matrix4f ().setPerspective (
146- (float )Math .PI / 2f ,
147- (float )renderTarget .width / (float )renderTarget .height ,
145+ (float ) Math .PI / 2f ,
146+ (float ) renderTarget .width / (float ) renderTarget .height ,
148147 0.05f ,
149148 10000000 );
150149
151150 final var blockEntities = blockEntityPositions
152151 .stream ()
153152 .map (blockAndTints ::getBlockEntity )
154153 .filter (Objects ::nonNull );
155- // PoseStack poseStack = graphics.pose();
156- // poseStack.pushPose();
154+
155+ PoseStack poseStack = graphics .pose ();
156+ poseStack .pushPose ();
157157 {
158158 var poseStack2 = RenderSystem .getModelViewStack ();
159- // poseStack2.pushPose();
160- // poseStack2.setIdentity();
161- // RenderSystem.applyModelViewMatrix();
159+ poseStack2 .pushPose ();
160+ {
161+ poseStack2 .setIdentity ();
162+ RenderSystem .applyModelViewMatrix ();
162163
163- // poseStack.setIdentity();
164- // poseStack.mulPose(camera.rotation());
164+ poseStack .setIdentity ();
165+ poseStack .mulPose (camera .rotation ());
165166
166167// translucencyChain.clear();
167168// translucencyChain.prepareBackgroundColor(Minecraft.getInstance().getMainRenderTarget());
168169// renderTarget.bindWrite(true);
169170
170- // RenderSystem.setProjectionMatrix(projectionMatrix, VertexSorting.byDistance(camera.getLookFrom()));
171- renderScene (blockEntities , buffer , partialTicks , graphics .pose ());
171+ RenderSystem .setProjectionMatrix (projectionMatrix , VertexSorting .byDistance (camera .getLookFrom ()));
172+ renderScene (blockEntities , buffer , partialTicks , graphics .pose ());
172173
173- final var mainTarget = Minecraft .getInstance ().getMainRenderTarget ();
174+ final var mainTarget = Minecraft .getInstance ().getMainRenderTarget ();
174175
175176// mainTarget.bindWrite(true);
176177// UGH(renderTarget);
177178
178- // RenderSystem.setProjectionMatrix(projectionMatrix, VertexSorting.byDistance(camera.getLookFrom()));
179- //renderCompass(graphics, partialTicks, poseStack);
179+ RenderSystem .setProjectionMatrix (projectionMatrix , VertexSorting .byDistance (camera .getLookFrom ()));
180+ renderCompass (graphics , partialTicks , poseStack );
181+ }
180182
181- // poseStack2.popPose();
182- // RenderSystem.applyModelViewMatrix();
183+ poseStack2 .popPose ();
184+ RenderSystem .applyModelViewMatrix ();
183185 }
184- // poseStack.popPose();
186+ poseStack .popPose ();
185187
186188// RenderSystem.setProjectionMatrix(originalMatrix, originalSorting);
187189
@@ -192,8 +194,7 @@ public void renderWidget(GuiGraphics graphics, int mouseX, int mouseY, float par
192194// ScreenEntityRenderer.renderEntities(entityGetter, poseStack, buffer, camera, partialTicks);
193195 }
194196
195- private void UGH (RenderTarget renderTarget )
196- {
197+ private void UGH (RenderTarget renderTarget ) {
197198 // RenderTarget.blit disables alpha... :unamused:
198199 RenderSystem .assertOnRenderThread ();
199200 GlStateManager ._disableDepthTest ();
@@ -203,7 +204,7 @@ private void UGH(RenderTarget renderTarget)
203204 Minecraft minecraft = Minecraft .getInstance ();
204205 ShaderInstance shaderinstance = minecraft .gameRenderer .blitShader ;
205206 shaderinstance .setSampler ("DiffuseSampler" , renderTarget .getColorTextureId ());
206- Matrix4f matrix4f = new Matrix4f ().setOrtho (0.0F , (float )width , (float )height , 0.0F , 1000.0F , 3000.0F );
207+ Matrix4f matrix4f = new Matrix4f ().setOrtho (0.0F , (float ) width , (float ) height , 0.0F , 1000.0F , 3000.0F );
207208 RenderSystem .setProjectionMatrix (matrix4f , VertexSorting .ORTHOGRAPHIC_Z );
208209 if (shaderinstance .MODEL_VIEW_MATRIX != null ) {
209210 shaderinstance .MODEL_VIEW_MATRIX .set (new Matrix4f ().translation (0.0F , 0.0F , -2000.0F ));
@@ -214,10 +215,10 @@ private void UGH(RenderTarget renderTarget)
214215 }
215216
216217 shaderinstance .apply ();
217- float f = (float )width ;
218- float f1 = (float )height ;
219- float f2 = (float )renderTarget .viewWidth / (float )renderTarget .width ;
220- float f3 = (float )renderTarget .viewHeight / (float )renderTarget .height ;
218+ float f = (float ) width ;
219+ float f1 = (float ) height ;
220+ float f2 = (float ) renderTarget .viewWidth / (float ) renderTarget .width ;
221+ float f3 = (float ) renderTarget .viewHeight / (float ) renderTarget .height ;
221222 Tesselator tesselator = RenderSystem .renderThreadTesselator ();
222223 BufferBuilder bufferbuilder = tesselator .getBuilder ();
223224 bufferbuilder .begin (VertexFormat .Mode .QUADS , DefaultVertexFormat .POSITION_TEX_COLOR );
@@ -285,7 +286,7 @@ private void renderCompass(GuiGraphics graphics, float partialTicks, PoseStack p
285286 var position = camera .getLookFrom ();
286287 poseStack .translate (-position .x , -position .y , -position .z );
287288 poseStack .last ().pose ().negateY ();
288- poseStack .scale (1 / 16f , 1 / 16f , 1 / 16f );
289+ poseStack .scale (1 / 16f , 1 / 16f , 1 / 16f );
289290
290291 compassOverlay .render (graphics , partialTicks );
291292 }
@@ -297,7 +298,7 @@ protected void updateWidgetNarration(NarrationElementOutput narrator) {
297298 }
298299
299300 public void zoom (double factor ) {
300- camera .zoom ((float )factor );
301+ camera .zoom ((float ) factor );
301302 }
302303
303304 @ Override
0 commit comments