Rain & Snow toggle

This commit is contained in:
PeytonPlayz595 2023-10-16 00:29:13 -04:00
parent 9c87f8de6c
commit 4d6c64ade6
9 changed files with 33566 additions and 33494 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -145,6 +145,18 @@ public class Config {
public static boolean isCloudsOff() {
return Minecraft.getMinecraft().gameSettings.ofClouds != 0 ? Minecraft.getMinecraft().gameSettings.ofClouds == 3 : false;
}
public static boolean isRainFancy() {
return Minecraft.getMinecraft().gameSettings.ofRain == 0 ? Minecraft.getMinecraft().gameSettings.fancyGraphics : Minecraft.getMinecraft().gameSettings.ofRain == 2;
}
public static boolean isRainOff() {
return Minecraft.getMinecraft().gameSettings.ofRain == 3;
}
public static boolean isRainSplash() {
return Minecraft.getMinecraft().gameSettings.ofRainSplash;
}
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

@ -24,7 +24,7 @@ public class GuiAnimations extends GuiScreen {
GameSettings.Options.ANIMATED_SMOKE,
GameSettings.Options.VOID_PARTICLES,
GameSettings.Options.WATER_PARTICLES,
//GameSettings.Options.RAIN_SPLASH,
GameSettings.Options.RAIN_SPLASH,
GameSettings.Options.PORTAL_PARTICLES,
GameSettings.Options.POTION_PARTICLES,
GameSettings.Options.DRIPPING_WATER_LAVA,

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};
private static GameSettings.Options[] enumOptions = new GameSettings.Options[] { GameSettings.Options.CLOUDS, GameSettings.Options.CLOUD_HEIGHT, GameSettings.Options.RAIN};
public GuiDetails(GuiScreen p_i47_1_) {
this.prevScreen = p_i47_1_;

View File

@ -11,12 +11,6 @@ import net.lax1dude.eaglercraft.v1_8.opengl.VertexFormat;
import net.lax1dude.eaglercraft.v1_8.opengl.WorldRenderer;
public class VertexBuffer {
//private IBufferGL vbo = null;
public void bindBuffer(IBufferGL vbo) {
OpenGLManager.glBindBuffer(RealOpenGLEnums.GL_ARRAY_BUFFER, vbo);
}
public void func_181722_a(WorldRenderer p_181722_1_, int parInt1) {
if(p_181722_1_.getVertexCount() > 0) {
EaglercraftGPU.glNewList(parInt1, GL_COMPILE);
@ -26,8 +20,4 @@ public class VertexBuffer {
EaglercraftGPU.glEndList();
}
}
public void unbindBuffer(IBufferGL vbo) {
OpenGLManager.glBindBuffer(RealOpenGLEnums.GL_ARRAY_BUFFER, vbo);
}
}

View File

@ -386,7 +386,7 @@ public class EaglercraftGPU {
FixedFunctionPipeline.optimize();
}
private static FixedFunctionPipeline lastRender = null;
public static FixedFunctionPipeline lastRender = null;
private static int lastMode = 0;
private static int lastCount = 0;

View File

@ -1321,74 +1321,72 @@ public class EntityRenderer implements IResourceManagerReloadListener {
}
private void addRainParticles() {
if (DeferredStateManager.isDeferredRenderer())
if (DeferredStateManager.isDeferredRenderer()) {
return;
float f = this.mc.theWorld.getRainStrength(1.0F);
if (!this.mc.gameSettings.fancyGraphics) {
f /= 2.0F;
}
float f = this.mc.theWorld.getRainStrength(1.0F);
if (f != 0.0F) {
this.random.setSeed((long) this.rendererUpdateCount * 312987231L);
Entity entity = this.mc.getRenderViewEntity();
WorldClient worldclient = this.mc.theWorld;
BlockPos blockpos = new BlockPos(entity);
byte b0 = 10;
double d0 = 0.0D;
double d1 = 0.0D;
double d2 = 0.0D;
int i = 0;
int j = (int) (100.0F * f * f);
if (this.mc.gameSettings.particleSetting == 1) {
j >>= 1;
} else if (this.mc.gameSettings.particleSetting == 2) {
j = 0;
}
if (!Config.isRainFancy()) {
f /= 2.0F;
}
for (int k = 0; k < j; ++k) {
BlockPos blockpos1 = worldclient
.getPrecipitationHeight(blockpos.add(this.random.nextInt(b0) - this.random.nextInt(b0), 0,
this.random.nextInt(b0) - this.random.nextInt(b0)));
BiomeGenBase biomegenbase = worldclient.getBiomeGenForCoords(blockpos1);
BlockPos blockpos2 = blockpos1.down();
Block block = worldclient.getBlockState(blockpos2).getBlock();
if (blockpos1.getY() <= blockpos.getY() + b0 && blockpos1.getY() >= blockpos.getY() - b0
&& biomegenbase.canSpawnLightningBolt()
&& biomegenbase.getFloatTemperature(blockpos1) >= 0.15F) {
double d3 = this.random.nextDouble();
double d4 = this.random.nextDouble();
if (block.getMaterial() == Material.lava) {
this.mc.theWorld.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, (double) blockpos1.getX() + d3,
(double) ((float) blockpos1.getY() + 0.1F) - block.getBlockBoundsMinY(),
(double) blockpos1.getZ() + d4, 0.0D, 0.0D, 0.0D, new int[0]);
} else if (block.getMaterial() != Material.air) {
block.setBlockBoundsBasedOnState(worldclient, blockpos2);
++i;
if (this.random.nextInt(i) == 0) {
d0 = (double) blockpos2.getX() + d3;
d1 = (double) ((float) blockpos2.getY() + 0.1F) + block.getBlockBoundsMaxY() - 1.0D;
d2 = (double) blockpos2.getZ() + d4;
}
if (f != 0.0F && Config.isRainSplash()) {
this.random.setSeed((long)this.rendererUpdateCount * 312987231L);
Entity entity = this.mc.getRenderViewEntity();
WorldClient worldclient = this.mc.theWorld;
BlockPos blockpos = new BlockPos(entity);
byte b0 = 10;
double d0 = 0.0D;
double d1 = 0.0D;
double d2 = 0.0D;
int i = 0;
int j = (int)(100.0F * f * f);
this.mc.theWorld.spawnParticle(EnumParticleTypes.WATER_DROP, (double) blockpos2.getX() + d3,
(double) ((float) blockpos2.getY() + 0.1F) + block.getBlockBoundsMaxY(),
(double) blockpos2.getZ() + d4, 0.0D, 0.0D, 0.0D, new int[0]);
}
}
}
if (this.mc.gameSettings.particleSetting == 1) {
j >>= 1;
} else if (this.mc.gameSettings.particleSetting == 2) {
j = 0;
}
if (i > 0 && this.random.nextInt(3) < this.rainSoundCounter++) {
this.rainSoundCounter = 0;
if (d1 > (double) (blockpos.getY() + 1) && worldclient.getPrecipitationHeight(blockpos)
.getY() > MathHelper.floor_float((float) blockpos.getY())) {
this.mc.theWorld.playSound(d0, d1, d2, "ambient.weather.rain", 0.1F, 0.5F, false);
} else {
this.mc.theWorld.playSound(d0, d1, d2, "ambient.weather.rain", 0.2F, 1.0F, false);
}
}
for (int k = 0; k < j; ++k) {
BlockPos blockpos1 = worldclient.getPrecipitationHeight(blockpos.add(this.random.nextInt(b0) - this.random.nextInt(b0), 0, this.random.nextInt(b0) - this.random.nextInt(b0)));
BiomeGenBase biomegenbase = worldclient.getBiomeGenForCoords(blockpos1);
BlockPos blockpos2 = blockpos1.down();
Block block = worldclient.getBlockState(blockpos2).getBlock();
}
}
if (blockpos1.getY() <= blockpos.getY() + b0 && blockpos1.getY() >= blockpos.getY() - b0 && biomegenbase.canSpawnLightningBolt() && biomegenbase.getFloatTemperature(blockpos1) >= 0.15F) {
double d3 = this.random.nextDouble();
double d4 = this.random.nextDouble();
if (block.getMaterial() == Material.lava) {
this.mc.theWorld.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, (double)blockpos1.getX() + d3, (double)((float)blockpos1.getY() + 0.1F) - block.getBlockBoundsMinY(), (double)blockpos1.getZ() + d4, 0.0D, 0.0D, 0.0D, new int[0]);
} else if (block.getMaterial() != Material.air) {
block.setBlockBoundsBasedOnState(worldclient, blockpos2);
++i;
if (this.random.nextInt(i) == 0) {
d0 = (double)blockpos2.getX() + d3;
d1 = (double)((float)blockpos2.getY() + 0.1F) + block.getBlockBoundsMaxY() - 1.0D;
d2 = (double)blockpos2.getZ() + d4;
}
this.mc.theWorld.spawnParticle(EnumParticleTypes.WATER_DROP, (double)blockpos2.getX() + d3, (double)((float)blockpos2.getY() + 0.1F) + block.getBlockBoundsMaxY(), (double)blockpos2.getZ() + d4, 0.0D, 0.0D, 0.0D, new int[0]);
}
}
}
if (i > 0 && this.random.nextInt(3) < this.rainSoundCounter++) {
this.rainSoundCounter = 0;
if (d1 > (double)(blockpos.getY() + 1) && worldclient.getPrecipitationHeight(blockpos).getY() > MathHelper.floor_float((float)blockpos.getY())) {
this.mc.theWorld.playSound(d0, d1, d2, "ambient.weather.rain", 0.1F, 0.5F, false);
} else {
this.mc.theWorld.playSound(d0, d1, d2, "ambient.weather.rain", 0.2F, 1.0F, false);
}
}
}
}
/**+
* Render rain and snow
@ -1396,6 +1394,10 @@ public class EntityRenderer implements IResourceManagerReloadListener {
protected void renderRainSnow(float partialTicks) {
float f = this.mc.theWorld.getRainStrength(partialTicks);
if (f > 0.0F) {
if (Config.isRainOff()){
return;
}
boolean df = DeferredStateManager.isInDeferredPass();
this.enableLightmap();
Entity entity = this.mc.getRenderViewEntity();
@ -1426,15 +1428,23 @@ public class EntityRenderer implements IResourceManagerReloadListener {
double d2 = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * (double) partialTicks;
int l = MathHelper.floor_double(d1);
byte b0 = 5;
if (df) {
b0 = 8;
} else if (this.mc.gameSettings.fancyGraphics) {
b0 = 10;
}
} else if (Config.isRainFancy()) {
b0 = 10;
}
byte b1 = -1;
float f1 = (float) this.rendererUpdateCount + partialTicks;
worldrenderer.setTranslation(-d0, -d1, -d2);
if (df) {
b0 = 8;
} else if (Config.isRainFancy()) {
b0 = 10;
}
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();

View File

@ -202,6 +202,7 @@ public class GameSettings {
public int clouds = 2;
public int ofClouds = 0;
public float ofCloudsHeight = 0.0F;
public int ofRain = 0;
//Optifine Animations
public int ofAnimatedWater = 0;
@ -220,6 +221,7 @@ public class GameSettings {
public boolean ofDrippingWaterLava = true;
public boolean ofAnimatedTerrain = true;
public boolean ofAnimatedTextures = true;
public boolean ofRainSplash = true;
//Performance Settings
public boolean ofSmoothFps = false;
@ -662,6 +664,18 @@ public class GameSettings {
ofFastMath = !ofFastMath;
MathHelper.fastMath = ofFastMath;
}
if (parOptions == GameSettings.Options.RAIN) {
++this.ofRain;
if (this.ofRain > 3) {
this.ofRain = 0;
}
}
if (parOptions == GameSettings.Options.RAIN_SPLASH) {
this.ofRainSplash = !this.ofRainSplash;
}
this.saveOptions();
}
@ -928,6 +942,22 @@ public class GameSettings {
return s + getTranslation(KEYS_DYNAMIC_LIGHTS, k);
} else if (parOptions == GameSettings.Options.FAST_MATH) {
return ofFastMath ? s + "ON" : s + "OFF";
} else if (parOptions == GameSettings.Options.RAIN) {
switch (this.ofRain) {
case 1:
return s + "Fast";
case 2:
return s + "Fancy";
case 3:
return s + "OFF";
default:
return s + "Default";
}
} else if (parOptions == GameSettings.Options.RAIN_SPLASH) {
return this.ofRainSplash ? s + "ON" : s + "OFF";
} else {
return s;
}
@ -1346,6 +1376,15 @@ public class GameSettings {
ofFastMath = Boolean.valueOf(astring[1]).booleanValue();
MathHelper.fastMath = ofFastMath;
}
if (astring[0].equals("ofRain") && astring.length >= 2) {
this.ofRain = Integer.valueOf(astring[1]).intValue();
this.ofRain = Config.limit(this.ofRain, 0, 3);
}
if (astring[0].equals("ofRainSplash") && astring.length >= 2) {
this.ofRainSplash = Boolean.valueOf(astring[1]).booleanValue();
}
Keyboard.setFunctionKeyModifier(keyBindFunction.getKeyCode());
@ -1484,6 +1523,8 @@ public class GameSettings {
printwriter.println("ofCloudsHeight:" + this.ofCloudsHeight);
printwriter.println("ofDynamicLights:" + this.ofDynamicLights);
printwriter.println("ofFastMath:" + ofFastMath);
printwriter.println("ofRain:" + this.ofRain);
printwriter.println("ofRainSplash:" + this.ofRainSplash);
for (KeyBinding keybinding : this.keyBindings) {
printwriter.println("key_" + keybinding.getKeyDescription() + ":" + keybinding.getKeyCode());
@ -1645,6 +1686,7 @@ public class GameSettings {
DRIPPING_WATER_LAVA("Dripping Water/Lava", false, false),
ANIMATED_TERRAIN("Terrain Animated", false, false),
ANIMATED_TEXTURES("Textures Animated", false, false),
RAIN_SPLASH("Rain Splash", false, false),
AO_LEVEL("Smooth Lighting Level", true, false),
USE_VBO("Use VBOs", false, false),
CUSTOM_SKY("Custom Sky", false, false),
@ -1657,7 +1699,8 @@ public class GameSettings {
CHUNK_UPDATES("Chunk Updates", false, false),
CLOUDS("Clouds", false, false),
CLOUD_HEIGHT("Cloud Height", true, false),
DYNAMIC_LIGHTS("Dynamic Lights", false, false);
DYNAMIC_LIGHTS("Dynamic Lights", false, false),
RAIN("Rain & Snow", false, false);
private final boolean enumFloat;
private final boolean enumBoolean;
@ -1788,6 +1831,7 @@ public class GameSettings {
this.ofDrippingWaterLava = p_setAllAnimations_1_;
this.ofAnimatedTerrain = p_setAllAnimations_1_;
this.ofAnimatedTextures = p_setAllAnimations_1_;
this.ofRainSplash = p_setAllAnimations_1_;
}
private void updateWaterOpacity() {