TLHPoE Posted May 3, 2014 Posted May 3, 2014 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; } } Quote Kain
coolboy4531 Posted May 4, 2014 Posted May 4, 2014 This is what I use to tweak light levels in dimensions. You tweak the float (f). Quote
TLHPoE Posted May 4, 2014 Author Posted May 4, 2014 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. Quote Kain
coolboy4531 Posted May 4, 2014 Posted May 4, 2014 Not sure. You could tweak with things like temperature, etc. Quote
TheGreyGhost Posted May 4, 2014 Posted May 4, 2014 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 Quote
Jacky2611 Posted May 4, 2014 Posted May 4, 2014 On 5/4/2014 at 10:39 AM, TheGreyGhost said: 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... Quote Here could be your advertisement!
chimera27 Posted May 4, 2014 Posted May 4, 2014 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) Quote Creator of Metroid Cubed! Power Suits, Beams, Hypermode and more! http://i.imgur.com/ghgWmA3.jpg[/img]
Recommended Posts
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.