Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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

  • Author

Sorry, I need to reword the problem.

 

 

How do I reset the default sky light level? Like the sun's brightness.

 

Tweaking the float makes shadows darker and stuff.

Kain

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

 

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!

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]

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.