Sky, stars, sun & moon

This commit is contained in:
PeytonPlayz595 2023-10-16 16:10:13 -04:00
parent ae4a52946d
commit b52a05db8c
9 changed files with 102144 additions and 102032 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -171,6 +171,18 @@ public class Config {
return Minecraft.getMinecraft().gameSettings.ofTrees == 0 ? !Minecraft.getMinecraft().gameSettings.fancyGraphics : Minecraft.getMinecraft().gameSettings.ofTrees == 4;
}
public static boolean isSkyEnabled() {
return Minecraft.getMinecraft().gameSettings.ofSky;
}
public static boolean isSunMoonEnabled() {
return Minecraft.getMinecraft().gameSettings.ofSunMoon;
}
public static boolean isStarsEnabled() {
return Minecraft.getMinecraft().gameSettings.ofStars;
}
public static int limit(int p_limit_0_, int p_limit_1_, int p_limit_2_) {
return p_limit_0_ < p_limit_1_ ? p_limit_1_ : (p_limit_0_ > p_limit_2_ ? p_limit_2_ : p_limit_0_);
}

View File

@ -13,7 +13,7 @@ public class GuiDetails extends GuiScreen {
protected String title;
private GameSettings settings;
//private static GameSettings.Options[] enumOptions = new GameSettings.Options[] {GameSettings.Options.CLOUDS, GameSettings.Options.CLOUD_HEIGHT, GameSettings.Options.TREES, GameSettings.Options.RAIN, GameSettings.Options.SKY, GameSettings.Options.STARS, GameSettings.Options.SUN_MOON, GameSettings.Options.SHOW_CAPES, GameSettings.Options.TRANSLUCENT_BLOCKS, GameSettings.Options.HELD_ITEM_TOOLTIPS, GameSettings.Options.DROPPED_ITEMS, GameSettings.Options.ENTITY_SHADOWS, GameSettings.Options.VIGNETTE, GameSettings.Options.DYNAMIC_FOV};
private static GameSettings.Options[] enumOptions = new GameSettings.Options[] { GameSettings.Options.CLOUDS, GameSettings.Options.CLOUD_HEIGHT, GameSettings.Options.TREES, GameSettings.Options.RAIN};
private static GameSettings.Options[] enumOptions = new GameSettings.Options[] { GameSettings.Options.CLOUDS, GameSettings.Options.CLOUD_HEIGHT, GameSettings.Options.TREES, GameSettings.Options.RAIN, GameSettings.Options.SKY, GameSettings.Options.STARS, GameSettings.Options.SUN_MOON};
public GuiDetails(GuiScreen p_i47_1_) {
this.prevScreen = p_i47_1_;

View File

@ -1163,7 +1163,7 @@ public class EntityRenderer implements IResourceManagerReloadListener {
double d1 = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * (double) partialTicks;
double d2 = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * (double) partialTicks;
frustum.setPosition(d0, d1, d2);
if (this.mc.gameSettings.renderDistanceChunks >= 4) {
if ((Config.isSkyEnabled() || Config.isSunMoonEnabled() || Config.isStarsEnabled())) {
this.setupFog(-1, partialTicks);
this.mc.mcProfiler.endStartSection("sky");
GlStateManager.matrixMode(GL_PROJECTION);
@ -1175,6 +1175,8 @@ public class EntityRenderer implements IResourceManagerReloadListener {
GlStateManager.loadIdentity();
GlStateManager.gluPerspective(this.getFOVModifier(partialTicks, true), (float)this.mc.displayWidth / (float)this.mc.displayHeight, 0.05F, this.clipDistance);
GlStateManager.matrixMode(GL_MODELVIEW);
} else {
GlStateManager.disableBlend();
}
this.setupFog(0, partialTicks);

View File

@ -1293,6 +1293,7 @@ public class RenderGlobal implements IWorldAccess, IResourceManagerReloadListene
}
private void renderSkyEnd() {
if(Config.isSkyEnabled()) {
GlStateManager.disableFog();
GlStateManager.disableAlpha();
GlStateManager.enableBlend();
@ -1338,6 +1339,7 @@ public class RenderGlobal implements IWorldAccess, IResourceManagerReloadListene
GlStateManager.enableTexture2D();
GlStateManager.enableAlpha();
}
}
public void renderSky(float partialTicks, int pass) {
if (this.mc.theWorld.provider.getDimensionId() == 1) {
@ -1363,7 +1365,10 @@ public class RenderGlobal implements IWorldAccess, IResourceManagerReloadListene
GlStateManager.depthMask(false);
GlStateManager.enableFog();
GlStateManager.color(f, f1, f2);
if(Config.isSkyEnabled()) {
GlStateManager.callList(this.glSkyList);
}
GlStateManager.disableFog();
GlStateManager.disableAlpha();
@ -1372,7 +1377,7 @@ public class RenderGlobal implements IWorldAccess, IResourceManagerReloadListene
RenderHelper.disableStandardItemLighting();
float[] afloat = this.theWorld.provider
.calcSunriseSunsetColors(this.theWorld.getCelestialAngle(partialTicks), partialTicks);
if (afloat != null) {
if (afloat != null && Config.isSunMoonEnabled()) {
GlStateManager.disableTexture2D();
GlStateManager.shadeModel(GL_SMOOTH);
GlStateManager.pushMatrix();
@ -1444,7 +1449,7 @@ public class RenderGlobal implements IWorldAccess, IResourceManagerReloadListene
tessellator.draw();
GlStateManager.disableTexture2D();
float f15 = this.theWorld.getStarBrightness(partialTicks) * f16;
if (f15 > 0.0F) {
if (f15 > 0.0F && Config.isStarsEnabled() && !CustomSky.hasSkyLayers(this.theWorld)) {
GlStateManager.color(f15, f15, f15, f15);
GlStateManager.callList(this.starGLCallList);
}
@ -1498,7 +1503,12 @@ public class RenderGlobal implements IWorldAccess, IResourceManagerReloadListene
GlStateManager.pushMatrix();
GlStateManager.translate(0.0F, -((float) (d0 - 16.0D)), 0.0F);
if(Config.isSkyEnabled()) {
GlStateManager.callList(this.glSkyList2);
}
GlStateManager.popMatrix();
GlStateManager.enableTexture2D();
GlStateManager.depthMask(true);

View File

@ -204,6 +204,9 @@ public class GameSettings {
public float ofCloudsHeight = 0.0F;
public int ofTrees = 0;
public int ofRain = 0;
public boolean ofSky = true;
public boolean ofStars = true;
public boolean ofSunMoon = true;
//Optifine Animations
public int ofAnimatedWater = 0;
@ -684,6 +687,18 @@ public class GameSettings {
this.mc.renderGlobal.loadRenderers();
}
if (parOptions == GameSettings.Options.SKY) {
this.ofSky = !this.ofSky;
}
if (parOptions == GameSettings.Options.STARS) {
this.ofStars = !this.ofStars;
}
if (parOptions == GameSettings.Options.SUN_MOON) {
this.ofSunMoon = !this.ofSunMoon;
}
this.saveOptions();
}
@ -759,6 +774,12 @@ public class GameSettings {
return this.ofSmoothFps;
case FAST_MATH:
return ofFastMath;
case SKY:
return this.ofSky;
case STARS:
return this.ofStars;
case SUN_MOON:
return this.ofSunMoon;
default:
return false;
}
@ -980,6 +1001,12 @@ public class GameSettings {
case 4:
return s + "Smart";
}
} else if (parOptions == GameSettings.Options.SKY) {
return this.ofSky ? s + "ON" : s + "OFF";
} else if (parOptions == GameSettings.Options.STARS) {
return this.ofStars ? s + "ON" : s + "OFF";
} else if (parOptions == GameSettings.Options.SUN_MOON) {
return this.ofSunMoon ? s + "ON" : s + "OFF";
} else {
return s;
}
@ -1413,6 +1440,18 @@ public class GameSettings {
this.ofTrees = limit(this.ofTrees, OF_TREES_VALUES);
}
if (astring[0].equals("ofSky") && astring.length >= 2) {
this.ofSky = Boolean.valueOf(astring[1]).booleanValue();
}
if (astring[0].equals("ofStars") && astring.length >= 2) {
this.ofStars = Boolean.valueOf(astring[1]).booleanValue();
}
if (astring[0].equals("ofSunMoon") && astring.length >= 2) {
this.ofSunMoon = Boolean.valueOf(astring[1]).booleanValue();
}
Keyboard.setFunctionKeyModifier(keyBindFunction.getKeyCode());
for (SoundCategory soundcategory : SoundCategory.values()) {
@ -1553,6 +1592,9 @@ public class GameSettings {
printwriter.println("ofRain:" + this.ofRain);
printwriter.println("ofRainSplash:" + this.ofRainSplash);
printwriter.println("ofTrees:" + this.ofTrees);
printwriter.println("ofSky:" + this.ofSky);
printwriter.println("ofStars:" + this.ofStars);
printwriter.println("ofSunMoon:" + this.ofSunMoon);
for (KeyBinding keybinding : this.keyBindings) {
printwriter.println("key_" + keybinding.getKeyDescription() + ":" + keybinding.getKeyCode());
@ -1729,7 +1771,10 @@ public class GameSettings {
CLOUD_HEIGHT("Cloud Height", true, false),
DYNAMIC_LIGHTS("Dynamic Lights", false, false),
RAIN("Rain & Snow", false, false),
TREES("Trees", false, false);
TREES("Trees", false, false),
SKY("Sky", false, false),
STARS("Stars", false, false),
SUN_MOON("Sun & Moon", false, false);
private final boolean enumFloat;
private final boolean enumBoolean;