@@ -45,6 +45,7 @@ public int getSpeed() {
4545
4646 private IBakedModel bakedModelCached ;
4747 private final Color colorProjectionCube = new Color (255 , 106 , 0 , 100 );
48+ private final Color colorScanLine = new Color (255 , 106 , 0 , 200 );
4849
4950 public FieldProjectorRenderer (TileEntityRendererDispatcher rendererDispatcherIn ) {
5051 super (rendererDispatcherIn );
@@ -90,6 +91,20 @@ private void addColoredVertex(IVertexBuilder renderer, MatrixStack stack, Color
9091 .endVertex ();
9192 }
9293
94+ private void drawRing (IVertexBuilder builder , MatrixStack mx , AxisAlignedBB bounds , Color color ) {
95+ addColoredVertex (builder , mx , color , new Vector3f ((float ) bounds .minX , (float ) bounds .minY , (float ) bounds .minZ ));
96+ addColoredVertex (builder , mx , color , new Vector3f ((float ) bounds .maxX , (float ) bounds .minY , (float ) bounds .minZ ));
97+
98+ addColoredVertex (builder , mx , color , new Vector3f ((float ) bounds .minX , (float ) bounds .minY , (float ) bounds .minZ ));
99+ addColoredVertex (builder , mx , color , new Vector3f ((float ) bounds .minX , (float ) bounds .minY , (float ) bounds .maxZ ));
100+
101+ addColoredVertex (builder , mx , color , new Vector3f ((float ) bounds .maxX , (float ) bounds .minY , (float ) bounds .maxZ ));
102+ addColoredVertex (builder , mx , color , new Vector3f ((float ) bounds .maxX , (float ) bounds .minY , (float ) bounds .minZ ));
103+
104+ addColoredVertex (builder , mx , color , new Vector3f ((float ) bounds .minX , (float ) bounds .minY , (float ) bounds .maxZ ));
105+ addColoredVertex (builder , mx , color , new Vector3f ((float ) bounds .maxX , (float ) bounds .minY , (float ) bounds .maxZ ));
106+ }
107+
93108 /**
94109 * Draws a cube given a vertex builder, matrix, color, and cube bounds.
95110 *
@@ -294,30 +309,19 @@ private void drawProjectorArcs() {
294309 * where the projection arcs meet the main projection cube.
295310 */
296311 private void drawScanLines (FieldProjectorTile tile , MatrixStack mx , IRenderTypeBuffer buffers , AxisAlignedBB cube , int cubeSize ) {
312+ IVertexBuilder builder = buffers .getBuffer (RenderType .getLines ());
313+
297314 mx .push ();
298315
299316 translateRendererToCube (tile , mx , cube , cubeSize );
300317
301- IVertexBuilder builder = buffers .getBuffer (RenderType .getLines ());
302- Color fieldColor = new Color (255 , 106 , 0 , 200 );
303-
304- // Draw the up and down bouncing lines on the sides
318+ // Get the height of the scan line
305319 double zAngle = ((Math .sin (Math .toDegrees (RenderTickCounter .renderTicks ) / -5000 ) + 1.0d ) / 2 ) * (cube .getYSize ());
306- float scanHeight = (float ) (cube .minY + zAngle );
307-
308-
309- // Scan Lines
310- addColoredVertex (builder , mx , fieldColor , new Vector3f ((float ) cube .minX , scanHeight , (float ) cube .minZ ));
311- addColoredVertex (builder , mx , fieldColor , new Vector3f ((float ) cube .maxX , scanHeight , (float ) cube .minZ ));
312-
313- addColoredVertex (builder , mx , fieldColor , new Vector3f ((float ) cube .minX , scanHeight , (float ) cube .minZ ));
314- addColoredVertex (builder , mx , fieldColor , new Vector3f ((float ) cube .minX , scanHeight , (float ) cube .maxZ ));
320+ double scanHeight = (cube .minY + zAngle );
315321
316- addColoredVertex (builder , mx , fieldColor , new Vector3f ((float ) cube .maxX , scanHeight , (float ) cube .maxZ ));
317- addColoredVertex (builder , mx , fieldColor , new Vector3f ((float ) cube .maxX , scanHeight , (float ) cube .minZ ));
322+ AxisAlignedBB scanLineMain = new AxisAlignedBB (cube .minX , scanHeight , cube .minZ , cube .maxX , scanHeight , cube .maxZ );
318323
319- addColoredVertex (builder , mx , fieldColor , new Vector3f ((float ) cube .minX , scanHeight , (float ) cube .maxZ ));
320- addColoredVertex (builder , mx , fieldColor , new Vector3f ((float ) cube .maxX , scanHeight , (float ) cube .maxZ ));
324+ drawRing (builder , mx , scanLineMain , colorScanLine );
321325
322326 mx .pop ();
323327 }
0 commit comments