Better Snow

This commit is contained in:
PeytonPlayz595 2023-10-29 14:42:07 +00:00
parent 33485ed22a
commit 1135b321b0
7 changed files with 35637 additions and 35506 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

@ -0,0 +1,81 @@
package net.PeytonPlayz585.shadow;
import net.minecraft.client.Minecraft;
import net.minecraft.block.Block;
import net.minecraft.block.BlockBush;
import net.minecraft.block.BlockDoublePlant;
import net.minecraft.block.BlockFence;
import net.minecraft.block.BlockFenceGate;
import net.minecraft.block.BlockFlower;
import net.minecraft.block.BlockFlowerPot;
import net.minecraft.block.BlockLever;
import net.minecraft.block.BlockMushroom;
import net.minecraft.block.BlockPane;
import net.minecraft.block.BlockRedstoneTorch;
import net.minecraft.block.BlockReed;
import net.minecraft.block.BlockSapling;
import net.minecraft.block.BlockSnow;
import net.minecraft.block.BlockTallGrass;
import net.minecraft.block.BlockTorch;
import net.minecraft.block.BlockWall;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.resources.model.IBakedModel;
import net.minecraft.init.Blocks;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.IBlockAccess;
public class BetterSnow {
private static IBakedModel modelSnowLayer = null;
public static void update() {
modelSnowLayer = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getModelForState(Blocks.snow_layer.getDefaultState());
}
public static IBakedModel getModelSnowLayer() {
return modelSnowLayer;
}
public static IBlockState getStateSnowLayer() {
return Blocks.snow_layer.getDefaultState();
}
public static boolean shouldRender(IBlockAccess p_shouldRender_0_, Block p_shouldRender_1_, IBlockState p_shouldRender_2_, BlockPos p_shouldRender_3_) {
return !checkBlock(p_shouldRender_1_, p_shouldRender_2_) ? false : hasSnowNeighbours(p_shouldRender_0_, p_shouldRender_3_);
}
private static boolean hasSnowNeighbours(IBlockAccess p_hasSnowNeighbours_0_, BlockPos p_hasSnowNeighbours_1_) {
Block block = Blocks.snow_layer;
return p_hasSnowNeighbours_0_.getBlockState(p_hasSnowNeighbours_1_.north()).getBlock() != block && p_hasSnowNeighbours_0_.getBlockState(p_hasSnowNeighbours_1_.south()).getBlock() != block && p_hasSnowNeighbours_0_.getBlockState(p_hasSnowNeighbours_1_.west()).getBlock() != block && p_hasSnowNeighbours_0_.getBlockState(p_hasSnowNeighbours_1_.east()).getBlock() != block ? false : p_hasSnowNeighbours_0_.getBlockState(p_hasSnowNeighbours_1_.down()).getBlock().isOpaqueCube();
}
private static boolean checkBlock(Block p_checkBlock_0_, IBlockState p_checkBlock_1_) {
if (p_checkBlock_0_.isFullCube()) {
return false;
} else if (p_checkBlock_0_.isOpaqueCube()) {
return false;
} else if (p_checkBlock_0_ instanceof BlockSnow) {
return false;
} else if (!(p_checkBlock_0_ instanceof BlockBush) || !(p_checkBlock_0_ instanceof BlockDoublePlant) && !(p_checkBlock_0_ instanceof BlockFlower) && !(p_checkBlock_0_ instanceof BlockMushroom) && !(p_checkBlock_0_ instanceof BlockSapling) && !(p_checkBlock_0_ instanceof BlockTallGrass)) {
if (!(p_checkBlock_0_ instanceof BlockFence) && !(p_checkBlock_0_ instanceof BlockFenceGate) && !(p_checkBlock_0_ instanceof BlockFlowerPot) && !(p_checkBlock_0_ instanceof BlockPane) && !(p_checkBlock_0_ instanceof BlockReed) && !(p_checkBlock_0_ instanceof BlockWall)) {
if (p_checkBlock_0_ instanceof BlockRedstoneTorch && p_checkBlock_1_.getValue(BlockTorch.FACING) == EnumFacing.UP) {
return true;
} else {
if (p_checkBlock_0_ instanceof BlockLever) {
Object object = p_checkBlock_1_.getValue(BlockLever.FACING);
if (object == BlockLever.EnumOrientation.UP_X || object == BlockLever.EnumOrientation.UP_Z) {
return true;
}
}
return false;
}
} else {
return true;
}
} else {
return true;
}
}
}

View File

@ -119,6 +119,10 @@ public class Config {
return Minecraft.getMinecraft().gameSettings.ofBetterGrass == 2;
}
public static boolean isBetterSnow() {
return Minecraft.getMinecraft().gameSettings.ofBetterSnow;
}
public static boolean isFogFancy() {
return Minecraft.getMinecraft().gameSettings.ofFogType == 2;
}

View File

@ -10,7 +10,7 @@ public class GuiQuality extends GuiScreen {
protected String title;
private GameSettings settings;
//private static GameSettings.Options[] enumOptions = new GameSettings.Options[] {GameSettings.Options.MIPMAP_LEVELS, GameSettings.Options.MIPMAP_TYPE, GameSettings.Options.AF_LEVEL, GameSettings.Options.AA_LEVEL, GameSettings.Options.CLEAR_WATER, GameSettings.Options.RANDOM_MOBS, GameSettings.Options.BETTER_GRASS, GameSettings.Options.BETTER_SNOW, GameSettings.Options.CUSTOM_FONTS, GameSettings.Options.CUSTOM_COLORS, GameSettings.Options.SWAMP_COLORS, GameSettings.Options.SMOOTH_BIOMES, GameSettings.Options.CONNECTED_TEXTURES, GameSettings.Options.NATURAL_TEXTURES, GameSettings.Options.CUSTOM_SKY, GameSettings.Options.CUSTOM_ITEMS, GameSettings.Options.DYNAMIC_LIGHTS};
private static GameSettings.Options[] enumOptions = new GameSettings.Options[] {GameSettings.Options.MIPMAP_LEVELS, GameSettings.Options.MIPMAP_TYPE, GameSettings.Options.CLEAR_WATER, GameSettings.Options.BETTER_GRASS, GameSettings.Options.CUSTOM_SKY, GameSettings.Options.DYNAMIC_LIGHTS};
private static GameSettings.Options[] enumOptions = new GameSettings.Options[] {GameSettings.Options.MIPMAP_LEVELS, GameSettings.Options.MIPMAP_TYPE, GameSettings.Options.CLEAR_WATER, GameSettings.Options.BETTER_GRASS, GameSettings.Options.BETTER_SNOW, GameSettings.Options.CUSTOM_SKY, GameSettings.Options.DYNAMIC_LIGHTS};
public GuiQuality(GuiScreen p_i53_1_) {
this.prevScreen = p_i53_1_;

View File

@ -114,6 +114,12 @@ public class BlockModelRenderer {
flag = true;
}
if (renderenv != null && Config.isBetterSnow() && !renderenv.isBreakingAnimation() && BetterSnow.shouldRender(blockAccessIn, blockIn, blockAccessIn.getBlockState(blockPosIn), blockPosIn)) {
IBakedModel ibakedmodel = BetterSnow.getModelSnowLayer();
IBlockState iblockstate = BetterSnow.getStateSnowLayer();
this.renderModelAmbientOcclusion(blockAccessIn, modelIn, blockAccessIn.getBlockState(blockPosIn).getBlock(), blockPosIn, worldRendererIn, true);
}
return flag;
}
@ -154,6 +160,12 @@ public class BlockModelRenderer {
flag = true;
}
if (renderenv != null && Config.isBetterSnow() && !renderenv.isBreakingAnimation() && BetterSnow.shouldRender(blockAccessIn, blockIn, blockAccessIn.getBlockState(blockPosIn), blockPosIn) && BetterSnow.shouldRender(blockAccessIn, blockIn, blockAccessIn.getBlockState(blockPosIn), blockPosIn)) {
IBakedModel ibakedmodel = BetterSnow.getModelSnowLayer();
IBlockState iblockstate = BetterSnow.getStateSnowLayer();
this.renderModelStandard(blockAccessIn, ibakedmodel, iblockstate.getBlock(), blockPosIn, worldRendererIn, true);
}
return flag;
}

View File

@ -194,6 +194,7 @@ public class GameSettings {
public int ofMipmapType = 0;
public boolean ofCustomSky = true;
public boolean ofClearWater = false;
public boolean ofBetterSnow = false;
public int ofBetterGrass = 3;
public int ofDynamicLights = 3;
@ -753,6 +754,11 @@ public class GameSettings {
this.ofDynamicFov = !this.ofDynamicFov;
}
if (parOptions == GameSettings.Options.BETTER_SNOW) {
this.ofBetterSnow = !this.ofBetterSnow;
this.mc.renderGlobal.loadRenderers();
}
this.saveOptions();
}
@ -1097,6 +1103,8 @@ public class GameSettings {
}
} else if (parOptions == GameSettings.Options.DYNAMIC_FOV) {
return this.ofDynamicFov ? s + "ON" : s + "OFF";
} else if (parOptions == GameSettings.Options.BETTER_SNOW) {
return this.ofBetterSnow ? s + "ON" : s + "OFF";
} else {
return s;
}
@ -1570,6 +1578,10 @@ public class GameSettings {
this.ofMipmapType = Config.limit(this.ofMipmapType, 0, 3);
}
if (astring[0].equals("ofBetterSnow") && astring.length >= 2) {
this.ofBetterSnow = Boolean.valueOf(astring[1]).booleanValue();
}
Keyboard.setFunctionKeyModifier(keyBindFunction.getKeyCode());
for (SoundCategory soundcategory : SoundCategory.values()) {
@ -1719,6 +1731,7 @@ public class GameSettings {
printwriter.println("ofVignette:" + this.ofVignette);
printwriter.println("ofDynamicFov:" + this.ofDynamicFov);
printwriter.println("ofMipmapType:" + this.ofMipmapType);
printwriter.println("ofBetterSnow:" + this.ofBetterSnow);
for (KeyBinding keybinding : this.keyBindings) {
printwriter.println("key_" + keybinding.getKeyDescription() + ":" + keybinding.getKeyCode());
@ -1905,7 +1918,8 @@ public class GameSettings {
DROPPED_ITEMS("Dropped Items", false, false),
VIGNETTE("Vignette", false, false),
DYNAMIC_FOV("Dynamic FOV", false, false),
MIPMAP_TYPE("Mipmap Type", true, false, 0.0F, 3.0F, 1.0F);
MIPMAP_TYPE("Mipmap Type", true, false, 0.0F, 3.0F, 1.0F),
BETTER_SNOW("Better Snow", false, false);
private final boolean enumFloat;
private final boolean enumBoolean;