Jump to content

[1.7.2] Setting Dimension Default Light Level


TLHPoE

Recommended Posts

Is there a way to edit the default light level of a dimension? Like making the sun slightly dimmer, in a way.

 

I found this method, but I'm not sure what to tweak.

 

@Override
protected void generateLightBrightnessTable() {
	float f = 0.1F;
	for(int i = 0; i <= 15; ++i) {
		float f1 = 1.0F - (float) i / 15.0F;
		this.lightBrightnessTable[i] = (1.0F - f1) / (f1 * 3.0F + 1.0F) * (1.0F - f) + f;
	}
}

Kain

Link to comment
Share on other sites

Hi

 

I don't think that will help you because the lightBrightnessTable is used to scale the brightness of both the sky light and the block light (from torches).  If you multiply the returned value by (say) 0.5, I think everything will get darker, not just the sky contribution.

(See EntityRenderer.updateLightMap)

 

FYI some background reading on lighting:

http://greyminecraftcoder.blogspot.com.au/2013/08/lighting.html

 

I think you would probably need to change World.getSunBrightness method - unfortunately I can't think of any easy way to do it except for ASM.  EntityRenderer.updateLightMap would also be a suitable place.  Another possibility might be to create a derived class of WorldClient, and override getSunBrightness with your own method which returns a lower brightness.  You would need to overwrite Minecraft.theWorld with your own derived class.  I have done something similar before but there's no guarantee it would work.  It gets difficult because you need to intercept the creation of WorldClient to create your derived class instead.  Can get very messy very quickly.

 

public class MyWorldClient extends WorldClient {
@Override
    public float getSunBrightness(float par1)
  {
    final float MAXIMUM_LIGHT_FACTOR = 0.5;
    return MAXIMUM_LIGHT_FACTOR  * super.getSunBrightness(par1);  
  }
}

 

-TGG

 

Link to comment
Share on other sites

Hi

 

I don't think that will help you because the lightBrightnessTable is used to scale the brightness of both the sky light and the block light (from torches).  If you multiply the returned value by (say) 0.5, I think everything will get darker, not just the sky contribution.

(See EntityRenderer.updateLightMap)

 

FYI some background reading on lighting:

http://greyminecraftcoder.blogspot.com.au/2013/08/lighting.html

 

I think you would probably need to change World.getSunBrightness method - unfortunately I can't think of any easy way to do it except for ASM.  EntityRenderer.updateLightMap would also be a suitable place.  Another possibility might be to create a derived class of WorldClient, and override getSunBrightness with your own method which returns a lower brightness.  You would need to overwrite Minecraft.theWorld with your own derived class.  I have done something similar before but there's no guarantee it would work.  It gets difficult because you need to intercept the creation of WorldClient to create your derived class instead.  Can get very messy very quickly.

 

public class MyWorldClient extends WorldClient {
@Override
    public float getSunBrightness(float par1)
  {
    final float MAXIMUM_LIGHT_FACTOR = 0.5;
    return MAXIMUM_LIGHT_FACTOR  * super.getSunBrightness(par1);  
  }
}

 

-TGG

 

Just an idea, but could we use "calculateCelestialAngle()" to keep the sun low?

I am just having the exact same problem...

Here could be your advertisement!

Link to comment
Share on other sites

Kind of a hacky solution, but you could make a custom air block or something of the sort generate at the max height of your dimension that is transparent but reduces the light level passing through it (I think there's an easy way to do this in the block, something along the lines of getTranslucency() that you can override)

Creator of Metroid Cubed! Power Suits, Beams, Hypermode and more!

width=174 height=100http://i.imgur.com/ghgWmA3.jpg[/img]

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.