66import net .minecraft .core .BlockPos ;
77import net .minecraft .world .level .block .entity .BlockEntity ;
88import net .minecraft .world .phys .Vec3 ;
9+ import net .neoforged .api .distmarker .Dist ;
10+ import net .neoforged .api .distmarker .OnlyIn ;
911import net .nullved .pmweatherapi .PMWeatherAPI ;
1012import net .nullved .pmweatherapi .client .render .IRadarOverlay ;
1113import net .nullved .pmweatherapi .client .render .RenderData ;
1416import org .joml .Vector3f ;
1517
1618/**
17- * This is an example overlay that draws a dot at every nearby radar's position
19+ * This is an example overlay that draws a dot at every lightning strike and fades out
20+ * @see IRadarOverlay
1821 */
22+ @ OnlyIn (Dist .CLIENT )
1923public class ExampleOverlay implements IRadarOverlay {
2024 public static final ExampleOverlay INSTANCE = new ExampleOverlay ();
2125
2226 @ Override
23- public void render (RenderData renderData , BufferBuilder bufferBuilder ) {
27+ public void render (boolean canRender , RenderData renderData , BufferBuilder bufferBuilder ) {
28+ if (!canRender ) return ;
2429 BlockEntity blockEntity = renderData .blockEntity ();
2530 BlockPos pos = blockEntity .getBlockPos ();
2631 RadarBlock .Mode mode = blockEntity .getBlockState ().getValue (RadarBlock .RADAR_MODE );
@@ -45,7 +50,7 @@ private static void renderMarker(BufferBuilder bufferBuilder, Vec3 relative) {
4550 Vector3f bottomLeft = (new Vector3f (-1.0F , 0.0F , 1.0F )).mul (0.015F ).add (radarPos .x , 0.005F , radarPos .z );
4651 Vector3f bottomRight = (new Vector3f (1.0F , 0.0F , 1.0F )).mul (0.015F ).add (radarPos .x , 0.005F , radarPos .z );
4752 Vector3f topRight = (new Vector3f (1.0F , 0.0F , -1.0F )).mul (0.015F ).add (radarPos .x , 0.005F , radarPos .z );
48- int color = 0xFF777777 ;
53+ int color = 0xFFAAAAAA ;
4954 bufferBuilder .addVertex (topLeft ).setColor (color ).addVertex (bottomLeft ).setColor (color ).addVertex (bottomRight ).setColor (color ).addVertex (topRight ).setColor (color );
5055 }
5156}
0 commit comments