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

View File

@ -1293,50 +1293,52 @@ public class RenderGlobal implements IWorldAccess, IResourceManagerReloadListene
} }
private void renderSkyEnd() { private void renderSkyEnd() {
GlStateManager.disableFog(); if(Config.isSkyEnabled()) {
GlStateManager.disableAlpha(); GlStateManager.disableFog();
GlStateManager.enableBlend(); GlStateManager.disableAlpha();
GlStateManager.tryBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, 1, 0); GlStateManager.enableBlend();
RenderHelper.disableStandardItemLighting(); GlStateManager.tryBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, 1, 0);
GlStateManager.depthMask(false); RenderHelper.disableStandardItemLighting();
this.renderEngine.bindTexture(locationEndSkyPng); GlStateManager.depthMask(false);
Tessellator tessellator = Tessellator.getInstance(); this.renderEngine.bindTexture(locationEndSkyPng);
WorldRenderer worldrenderer = tessellator.getWorldRenderer(); Tessellator tessellator = Tessellator.getInstance();
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
for (int i = 0; i < 6; ++i) { for (int i = 0; i < 6; ++i) {
GlStateManager.pushMatrix(); GlStateManager.pushMatrix();
if (i == 1) { if (i == 1) {
GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F); GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F);
}
if (i == 2) {
GlStateManager.rotate(-90.0F, 1.0F, 0.0F, 0.0F);
}
if (i == 3) {
GlStateManager.rotate(180.0F, 1.0F, 0.0F, 0.0F);
}
if (i == 4) {
GlStateManager.rotate(90.0F, 0.0F, 0.0F, 1.0F);
}
if (i == 5) {
GlStateManager.rotate(-90.0F, 0.0F, 0.0F, 1.0F);
}
worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
worldrenderer.pos(-100.0D, -100.0D, -100.0D).tex(0.0D, 0.0D).color(40, 40, 40, 255).endVertex();
worldrenderer.pos(-100.0D, -100.0D, 100.0D).tex(0.0D, 16.0D).color(40, 40, 40, 255).endVertex();
worldrenderer.pos(100.0D, -100.0D, 100.0D).tex(16.0D, 16.0D).color(40, 40, 40, 255).endVertex();
worldrenderer.pos(100.0D, -100.0D, -100.0D).tex(16.0D, 0.0D).color(40, 40, 40, 255).endVertex();
tessellator.draw();
GlStateManager.popMatrix();
} }
if (i == 2) { GlStateManager.depthMask(true);
GlStateManager.rotate(-90.0F, 1.0F, 0.0F, 0.0F); GlStateManager.enableTexture2D();
} GlStateManager.enableAlpha();
if (i == 3) {
GlStateManager.rotate(180.0F, 1.0F, 0.0F, 0.0F);
}
if (i == 4) {
GlStateManager.rotate(90.0F, 0.0F, 0.0F, 1.0F);
}
if (i == 5) {
GlStateManager.rotate(-90.0F, 0.0F, 0.0F, 1.0F);
}
worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
worldrenderer.pos(-100.0D, -100.0D, -100.0D).tex(0.0D, 0.0D).color(40, 40, 40, 255).endVertex();
worldrenderer.pos(-100.0D, -100.0D, 100.0D).tex(0.0D, 16.0D).color(40, 40, 40, 255).endVertex();
worldrenderer.pos(100.0D, -100.0D, 100.0D).tex(16.0D, 16.0D).color(40, 40, 40, 255).endVertex();
worldrenderer.pos(100.0D, -100.0D, -100.0D).tex(16.0D, 0.0D).color(40, 40, 40, 255).endVertex();
tessellator.draw();
GlStateManager.popMatrix();
} }
GlStateManager.depthMask(true);
GlStateManager.enableTexture2D();
GlStateManager.enableAlpha();
} }
public void renderSky(float partialTicks, int pass) { public void renderSky(float partialTicks, int pass) {
@ -1363,7 +1365,10 @@ public class RenderGlobal implements IWorldAccess, IResourceManagerReloadListene
GlStateManager.depthMask(false); GlStateManager.depthMask(false);
GlStateManager.enableFog(); GlStateManager.enableFog();
GlStateManager.color(f, f1, f2); GlStateManager.color(f, f1, f2);
GlStateManager.callList(this.glSkyList);
if(Config.isSkyEnabled()) {
GlStateManager.callList(this.glSkyList);
}
GlStateManager.disableFog(); GlStateManager.disableFog();
GlStateManager.disableAlpha(); GlStateManager.disableAlpha();
@ -1372,7 +1377,7 @@ public class RenderGlobal implements IWorldAccess, IResourceManagerReloadListene
RenderHelper.disableStandardItemLighting(); RenderHelper.disableStandardItemLighting();
float[] afloat = this.theWorld.provider float[] afloat = this.theWorld.provider
.calcSunriseSunsetColors(this.theWorld.getCelestialAngle(partialTicks), partialTicks); .calcSunriseSunsetColors(this.theWorld.getCelestialAngle(partialTicks), partialTicks);
if (afloat != null) { if (afloat != null && Config.isSunMoonEnabled()) {
GlStateManager.disableTexture2D(); GlStateManager.disableTexture2D();
GlStateManager.shadeModel(GL_SMOOTH); GlStateManager.shadeModel(GL_SMOOTH);
GlStateManager.pushMatrix(); GlStateManager.pushMatrix();
@ -1444,7 +1449,7 @@ public class RenderGlobal implements IWorldAccess, IResourceManagerReloadListene
tessellator.draw(); tessellator.draw();
GlStateManager.disableTexture2D(); GlStateManager.disableTexture2D();
float f15 = this.theWorld.getStarBrightness(partialTicks) * f16; 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.color(f15, f15, f15, f15);
GlStateManager.callList(this.starGLCallList); GlStateManager.callList(this.starGLCallList);
} }
@ -1498,7 +1503,12 @@ public class RenderGlobal implements IWorldAccess, IResourceManagerReloadListene
GlStateManager.pushMatrix(); GlStateManager.pushMatrix();
GlStateManager.translate(0.0F, -((float) (d0 - 16.0D)), 0.0F); GlStateManager.translate(0.0F, -((float) (d0 - 16.0D)), 0.0F);
GlStateManager.callList(this.glSkyList2);
if(Config.isSkyEnabled()) {
GlStateManager.callList(this.glSkyList2);
}
GlStateManager.popMatrix(); GlStateManager.popMatrix();
GlStateManager.enableTexture2D(); GlStateManager.enableTexture2D();
GlStateManager.depthMask(true); GlStateManager.depthMask(true);

View File

@ -204,6 +204,9 @@ public class GameSettings {
public float ofCloudsHeight = 0.0F; public float ofCloudsHeight = 0.0F;
public int ofTrees = 0; public int ofTrees = 0;
public int ofRain = 0; public int ofRain = 0;
public boolean ofSky = true;
public boolean ofStars = true;
public boolean ofSunMoon = true;
//Optifine Animations //Optifine Animations
public int ofAnimatedWater = 0; public int ofAnimatedWater = 0;
@ -684,6 +687,18 @@ public class GameSettings {
this.mc.renderGlobal.loadRenderers(); 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(); this.saveOptions();
} }
@ -759,6 +774,12 @@ public class GameSettings {
return this.ofSmoothFps; return this.ofSmoothFps;
case FAST_MATH: case FAST_MATH:
return ofFastMath; return ofFastMath;
case SKY:
return this.ofSky;
case STARS:
return this.ofStars;
case SUN_MOON:
return this.ofSunMoon;
default: default:
return false; return false;
} }
@ -980,6 +1001,12 @@ public class GameSettings {
case 4: case 4:
return s + "Smart"; 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 { } else {
return s; return s;
} }
@ -1413,6 +1440,18 @@ public class GameSettings {
this.ofTrees = limit(this.ofTrees, OF_TREES_VALUES); 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()); Keyboard.setFunctionKeyModifier(keyBindFunction.getKeyCode());
for (SoundCategory soundcategory : SoundCategory.values()) { for (SoundCategory soundcategory : SoundCategory.values()) {
@ -1553,6 +1592,9 @@ public class GameSettings {
printwriter.println("ofRain:" + this.ofRain); printwriter.println("ofRain:" + this.ofRain);
printwriter.println("ofRainSplash:" + this.ofRainSplash); printwriter.println("ofRainSplash:" + this.ofRainSplash);
printwriter.println("ofTrees:" + this.ofTrees); 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) { for (KeyBinding keybinding : this.keyBindings) {
printwriter.println("key_" + keybinding.getKeyDescription() + ":" + keybinding.getKeyCode()); printwriter.println("key_" + keybinding.getKeyDescription() + ":" + keybinding.getKeyCode());
@ -1729,7 +1771,10 @@ public class GameSettings {
CLOUD_HEIGHT("Cloud Height", true, false), CLOUD_HEIGHT("Cloud Height", true, false),
DYNAMIC_LIGHTS("Dynamic Lights", false, false), DYNAMIC_LIGHTS("Dynamic Lights", false, false),
RAIN("Rain & Snow", 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 enumFloat;
private final boolean enumBoolean; private final boolean enumBoolean;