@@ -723,14 +723,20 @@ public void onRender(PoseStack matrixStack, float partialTicks)
723723 {
724724 if (tracedItems .isEmpty ())
725725 return ;
726- // Avoid duplicate rendering if ItemESP is enabled
726+
727727 net .wurstclient .hacks .ItemEspHack esp =
728728 net .wurstclient .WurstClient .INSTANCE .getHax ().itemEspHack ;
729- if (esp != null && esp .isEnabled ())
729+ boolean espEnabled = esp != null && esp .isEnabled ();
730+ boolean espHasTracerLines = espEnabled && esp .rendersTracerLines ();
731+ boolean shouldDrawBoxes = !espEnabled ;
732+ boolean shouldDrawTracers = !espHasTracerLines ;
733+ if (!shouldDrawBoxes && !shouldDrawTracers )
730734 return ;
731735
732- java .util .ArrayList <AABB > boxes = new java .util .ArrayList <>();
733- java .util .ArrayList <Vec3 > ends = new java .util .ArrayList <>();
736+ java .util .ArrayList <AABB > boxes =
737+ shouldDrawBoxes ? new java .util .ArrayList <>() : null ;
738+ java .util .ArrayList <Vec3 > ends =
739+ shouldDrawTracers ? new java .util .ArrayList <>() : null ;
734740 for (GroundItem gi : trackedItems )
735741 {
736742 String baseId =
@@ -748,22 +754,27 @@ public void onRender(PoseStack matrixStack, float partialTicks)
748754 if (!traced )
749755 continue ;
750756 Vec3 p = gi .position ();
751- boxes .add (new AABB (p .x - 0.18 , p .y - 0.18 , p .z - 0.18 , p .x + 0.18 ,
752- p .y + 0.18 , p .z + 0.18 ));
753- ends .add (p );
757+ if (shouldDrawBoxes )
758+ boxes .add (new AABB (p .x - 0.18 , p .y - 0.18 , p .z - 0.18 ,
759+ p .x + 0.18 , p .y + 0.18 , p .z + 0.18 ));
760+ if (shouldDrawTracers )
761+ ends .add (p );
754762 }
755- if (boxes .isEmpty () && ends .isEmpty ())
763+ boolean hasBoxes = shouldDrawBoxes && boxes != null && !boxes .isEmpty ();
764+ boolean hasTracers =
765+ shouldDrawTracers && ends != null && !ends .isEmpty ();
766+ if (!hasBoxes && !hasTracers )
756767 return ;
757768 float [] rf = RenderUtils .getRainbowColor ();
758769 int traceLines = RenderUtils .toIntColor (rf , 0.5f );
759770 int traceQuads = RenderUtils .toIntColor (rf , 0.35f );
760- if (! boxes . isEmpty () )
771+ if (hasBoxes )
761772 {
762773 RenderUtils .drawSolidBoxes (matrixStack , boxes , traceQuads , false );
763774 RenderUtils .drawOutlinedBoxes (matrixStack , boxes , traceLines ,
764775 false );
765776 }
766- if (! ends . isEmpty () )
777+ if (hasTracers )
767778 RenderUtils .drawTracers (matrixStack , partialTicks , ends , traceLines ,
768779 false );
769780 }
0 commit comments