@@ -97,22 +97,19 @@ public RenderPlanetarySky() {
9797
9898	Minecraft  mc  = Minecraft .getMinecraft ();
9999
100- 	private  void  renderStars ()
101- 	{
100+ 	private  void  renderStars () {
102101		Random  random  = new  Random (10842L );
103102		BufferBuilder  buffer  = Tessellator .getInstance ().getBuffer ();
104103		buffer .begin (GL11 .GL_QUADS , DefaultVertexFormats .POSITION );
105104
106- 		for  (int  i  = 0 ; i  < 2000 ; ++i )
107- 		{
105+ 		for  (int  i  = 0 ; i  < 2000 ; ++i ) {
108106			double  d0  = random .nextFloat () * 2.0F  - 1.0F ;
109107			double  d1  = random .nextFloat () * 2.0F  - 1.0F ;
110108			double  d2  = random .nextFloat () * 2.0F  - 1.0F ;
111109			double  d3  = 0.15F  + random .nextFloat () * 0.1F ;
112110			double  d4  = d0  * d0  + d1  * d1  + d2  * d2 ;
113111
114- 			if  (d4  < 1.0D  && d4  > 0.01D )
115- 			{
112+ 			if  (d4  < 1.0D  && d4  > 0.01D ) {
116113				d4  = 1.0D  / Math .sqrt (d4 );
117114				d0  *= d4 ;
118115				d1  *= d4 ;
@@ -130,8 +127,7 @@ private void renderStars()
130127				double  d15  = Math .sin (d14 );
131128				double  d16  = Math .cos (d14 );
132129
133- 				for  (int  j  = 0 ; j  < 4 ; ++j )
134- 				{
130+ 				for  (int  j  = 0 ; j  < 4 ; ++j ) {
135131					double  d17  = 0.0D ;
136132					double  d18  = (double )((j  & 2 ) - 1 ) * d3 ;
137133					double  d19  = (double )((j  + 1  & 2 ) - 1 ) * d3 ;
@@ -217,8 +213,7 @@ public void render(float partialTicks, WorldClient world, Minecraft mc) {
217213			primaryStar  = properties .getStar ();
218214			if  (primaryStar  != null ) {
219215				sunSize  = properties .getStar ().getSize ();
220- 			}
221- 			else 
216+ 			} else 
222217				primaryStar  = DimensionManager .getInstance ().getStar (0 );
223218			if (world .provider .getDimension () == ARConfiguration .getCurrentConfig ().spaceDimId ) {
224219				isWarp  = properties .getParentPlanet () == SpaceObjectManager .WARPDIMID ;
@@ -227,8 +222,7 @@ public void render(float partialTicks, WorldClient world, Minecraft mc) {
227222					travelDirection  = station .getForwardDirection ();
228223				}
229224			}
230- 		}
231- 		else  if (DimensionManager .getInstance ().isDimensionCreated (mc .world .provider .getDimension ())) {
225+ 		} else  if (DimensionManager .getInstance ().isDimensionCreated (mc .world .provider .getDimension ())) {
232226
233227			properties  = DimensionManager .getInstance ().getDimensionProperties (mc .world .provider .getDimension ());
234228
@@ -265,8 +259,7 @@ else if(DimensionManager.getInstance().isDimensionCreated(mc.world.provider.getD
265259			primaryStar  = properties .getStar ();
266260			if  (primaryStar  != null ) {
267261				sunSize  = properties .getStar ().getSize ();
268- 			}
269- 			else 
262+ 			} else 
270263				primaryStar  = DimensionManager .getInstance ().getStar (0 );
271264			if (world .provider .getDimension () == ARConfiguration .getCurrentConfig ().spaceDimId ) {
272265				isWarp  = properties .getParentPlanet () == SpaceObjectManager .WARPDIMID ;
@@ -275,8 +268,7 @@ else if(DimensionManager.getInstance().isDimensionCreated(mc.world.provider.getD
275268					travelDirection  = station .getForwardDirection ();
276269				}
277270			}
278- 		}
279- 		else  {
271+ 		} else  {
280272			children  = new  LinkedList <>();
281273			isMoon  = false ;
282274			atmosphere  = DimensionManager .overworldProperties .getAtmosphereDensityAtHeight (mc .getRenderViewEntity ().posY );
@@ -293,8 +285,7 @@ else if(DimensionManager.getInstance().isDimensionCreated(mc.world.provider.getD
293285		float  f3  = (float )vec3 .z ;
294286		float  f6 ;
295287
296- 		if  (this .mc .gameSettings .anaglyph )
297- 		{
288+ 		if  (this .mc .gameSettings .anaglyph ) {
298289			float  f4  = (f1  * 30.0F  + f2  * 59.0F  + f3  * 11.0F ) / 100.0F ;
299290			float  f5  = (f1  * 30.0F  + f2  * 70.0F ) / 100.0F ;
300291			f6  = (f1  * 30.0F  + f3  * 70.0F ) / 100.0F ;
@@ -303,10 +294,12 @@ else if(DimensionManager.getInstance().isDimensionCreated(mc.world.provider.getD
303294			f3  = f6 ;
304295		}
305296
306- 		//Simulate atmospheric thickness 
307- 		f1  = (float )Math .pow (f1 , Math .sqrt (atmosphere ));
308- 		f2  = (float )Math .pow (f2 , Math .sqrt (atmosphere ));
309- 		f3  = (float )Math .pow (f3 , Math .sqrt (atmosphere ));
297+ 		//Simulate atmospheric thickness, vaugely 
298+ 		//This is done like this to prevent problems with superbright atmospheres on low-atmosphere planets 
299+ 		//Plus you couldn't see stars during the day anyway 
300+ 		f1  = properties .getAtmosphereDensity () < 1  ? 0  : (float ) Math .pow (f1 , Math .sqrt (Math .max (atmosphere , 0.81 )));
301+ 		f2  = properties .getAtmosphereDensity () < 1  ? 0  : (float ) Math .pow (f2 , Math .sqrt (Math .max (atmosphere , 0.81 )));
302+ 		f3  = properties .getAtmosphereDensity () < 1  ? 0  : (float ) Math .pow (f3 , Math .sqrt (Math .max (atmosphere , 0.81 )));
310303
311304
312305		GlStateManager .color (f1 , f2 , f3 );
@@ -440,13 +433,12 @@ else if(DimensionManager.getInstance().isDimensionCreated(mc.world.provider.getD
440433
441434
442435		GlStateManager .disableTexture2D ();
443- 		float  f18  = mc .world .getStarBrightness (partialTicks ) * f6  * ( atmosphere ) + ( 1 - atmosphere );
436+ 		float  f18  = mc .world .getStarBrightness (partialTicks ) * f6  + (( atmosphere  ==  0  || ( f1  <  0.09  &&  f2  <  0.09  &&  f3  <  0.09 )) ?  1  :  0 ) - ( atmosphere  >  1  ?  atmosphere  -  1  :  0 );
444437
445438		if (mc .world .isRainingAt (mc .player .getPosition ().add (0 , 199 , 0 )))
446439			f18  *= 1 -mc .world .getRainStrength (partialTicks );
447440
448- 		if  (f18  > 0.0F )
449- 		{
441+ 		if  (f18  > 0.0F ) {
450442			GlStateManager .color (f18 , f18 , f18 , f18 );
451443			GL11 .glPushMatrix ();
452444			if (isWarp ) {
@@ -629,8 +621,7 @@ else if (afloat != null && (planetPositionTheta < 105 || planetPositionTheta > 2
629621
630622		double  d0  = this .mc .player .getPositionEyes (partialTicks ).y  - mc .world .getHorizon ();
631623
632- 		if  (d0  < 0.0D )
633- 		{
624+ 		if  (d0  < 0.0D ) {
634625			GL11 .glPushMatrix ();
635626			GL11 .glTranslatef (0.0F , 12.0F , 0.0F );
636627			GL11 .glCallList (this .glSkyList2 );
0 commit comments