CustomSky, ClearWater, & BetterGrass

This commit is contained in:
PeytonPlayz595 2023-09-02 21:52:15 +00:00
parent f4d14f0b2b
commit 4f7f57212d
25 changed files with 113791 additions and 36448 deletions

0
CompileEPK.bat Normal file → Executable file
View File

0
LICENSE Normal file → Executable file
View File

0
MakeOfflineDownload.bat Normal file → Executable file
View File

0
MakeOfflineDownload.sh Normal file → Executable file
View File

0
README.md Normal file → Executable file
View File

0
build.gradle Normal file → Executable file
View File

0
gradlew.bat vendored Normal file → Executable file
View File

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

0
settings.gradle Normal file → Executable file
View File

View File

@ -0,0 +1,67 @@
package net.PeytonPlayz585.shadow;
import java.util.ArrayList;
import java.util.List;
import net.lax1dude.eaglercraft.v1_8.minecraft.EaglerTextureAtlasSprite;
import net.minecraft.block.Block;
import net.minecraft.block.BlockGrass;
import net.minecraft.block.BlockMycelium;
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
import net.minecraft.client.resources.model.IBakedModel;
import net.minecraft.client.resources.model.SimpleBakedModel;
import net.minecraft.init.Blocks;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.IBlockAccess;
public class BetterGrass {
private static IBakedModel modelEmpty = new SimpleBakedModel(new ArrayList(), new ArrayList(), false, false, (EaglerTextureAtlasSprite)null, (ItemCameraTransforms)null);
private static IBakedModel modelCubeMycelium = null;
private static IBakedModel modelCubeGrassSnowy = null;
private static IBakedModel modelCubeGrass = null;
public static void update() {
modelCubeGrass = BlockModelUtils.makeModelCube((String)"minecraft:blocks/grass_top", 0);
modelCubeGrassSnowy = BlockModelUtils.makeModelCube((String)"minecraft:blocks/snow", -1);
modelCubeMycelium = BlockModelUtils.makeModelCube((String)"minecraft:blocks/mycelium_top", -1);
}
public static List getFaceQuads(IBlockAccess p_getFaceQuads_0_, Block p_getFaceQuads_1_, BlockPos p_getFaceQuads_2_, EnumFacing p_getFaceQuads_3_, List p_getFaceQuads_4_) {
if (p_getFaceQuads_3_ != EnumFacing.UP && p_getFaceQuads_3_ != EnumFacing.DOWN) {
if (p_getFaceQuads_1_ instanceof BlockMycelium) {
return Config.isBetterGrassFancy() ? (getBlockAt(p_getFaceQuads_2_.down(), p_getFaceQuads_3_, p_getFaceQuads_0_) == Blocks.mycelium ? modelCubeMycelium.getFaceQuads(p_getFaceQuads_3_) : p_getFaceQuads_4_) : modelCubeMycelium.getFaceQuads(p_getFaceQuads_3_);
} else {
if (p_getFaceQuads_1_ instanceof BlockGrass) {
Block block = p_getFaceQuads_0_.getBlockState(p_getFaceQuads_2_.up()).getBlock();
boolean flag = block == Blocks.snow || block == Blocks.snow_layer;
if (!Config.isBetterGrassFancy()) {
if (flag) {
return modelCubeGrassSnowy.getFaceQuads(p_getFaceQuads_3_);
}
return modelCubeGrass.getFaceQuads(p_getFaceQuads_3_);
}
if (flag) {
if (getBlockAt(p_getFaceQuads_2_, p_getFaceQuads_3_, p_getFaceQuads_0_) == Blocks.snow_layer) {
return modelCubeGrassSnowy.getFaceQuads(p_getFaceQuads_3_);
}
} else if (getBlockAt(p_getFaceQuads_2_.down(), p_getFaceQuads_3_, p_getFaceQuads_0_) == Blocks.grass) {
return modelCubeGrass.getFaceQuads(p_getFaceQuads_3_);
}
}
return p_getFaceQuads_4_;
}
} else {
return p_getFaceQuads_4_;
}
}
private static Block getBlockAt(BlockPos p_getBlockAt_0_, EnumFacing p_getBlockAt_1_, IBlockAccess p_getBlockAt_2_) {
BlockPos blockpos = p_getBlockAt_0_.offset(p_getBlockAt_1_);
Block block = p_getBlockAt_2_.getBlockState(blockpos).getBlock();
return block;
}
}

View File

@ -0,0 +1,54 @@
package net.PeytonPlayz585.shadow;
import java.util.ArrayList;
import java.util.List;
import net.lax1dude.eaglercraft.v1_8.minecraft.EaglerTextureAtlasSprite;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.client.renderer.block.model.BlockFaceUV;
import net.minecraft.client.renderer.block.model.BlockPartFace;
import net.minecraft.client.renderer.block.model.BlockPartRotation;
import net.minecraft.client.renderer.block.model.FaceBakery;
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
import net.minecraft.client.resources.model.IBakedModel;
import net.minecraft.client.resources.model.ModelRotation;
import net.minecraft.client.resources.model.SimpleBakedModel;
import net.minecraft.util.EnumFacing;
import net.lax1dude.eaglercraft.v1_8.vector.Vector3f;
public class BlockModelUtils {
public static IBakedModel makeModelCube(String p_makeModelCube_0_, int p_makeModelCube_1_) {
EaglerTextureAtlasSprite textureatlassprite = Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(p_makeModelCube_0_);
return makeModelCube(textureatlassprite, p_makeModelCube_1_);
}
public static IBakedModel makeModelCube(EaglerTextureAtlasSprite p_makeModelCube_0_, int p_makeModelCube_1_) {
List list = new ArrayList();
EnumFacing[] aenumfacing = EnumFacing.VALUES;
List list1 = new ArrayList(aenumfacing.length);
for (int i = 0; i < aenumfacing.length; ++i) {
EnumFacing enumfacing = aenumfacing[i];
List list2 = new ArrayList();
list2.add(makeBakedQuad(enumfacing, p_makeModelCube_0_, p_makeModelCube_1_));
list1.add(list2);
}
IBakedModel ibakedmodel = new SimpleBakedModel(list, list1, true, true, p_makeModelCube_0_, ItemCameraTransforms.DEFAULT);
return ibakedmodel;
}
private static BakedQuad makeBakedQuad(EnumFacing p_makeBakedQuad_0_, EaglerTextureAtlasSprite p_makeBakedQuad_1_, int p_makeBakedQuad_2_) {
Vector3f vector3f = new Vector3f(0.0F, 0.0F, 0.0F);
Vector3f vector3f1 = new Vector3f(16.0F, 16.0F, 16.0F);
BlockFaceUV blockfaceuv = new BlockFaceUV(new float[] {0.0F, 0.0F, 16.0F, 16.0F}, 0);
BlockPartFace blockpartface = new BlockPartFace(p_makeBakedQuad_0_, p_makeBakedQuad_2_, "#" + p_makeBakedQuad_0_.getName(), blockfaceuv);
ModelRotation modelrotation = ModelRotation.X0_Y0;
BlockPartRotation blockpartrotation = null;
boolean flag = false;
boolean flag1 = true;
FaceBakery facebakery = new FaceBakery();
BakedQuad bakedquad = facebakery.makeBakedQuad(vector3f, vector3f1, blockpartface, p_makeBakedQuad_1_, p_makeBakedQuad_0_, modelrotation, blockpartrotation, flag, flag1);
return bakedquad;
}
}

View File

@ -0,0 +1,162 @@
package net.PeytonPlayz585.shadow;
import com.google.common.collect.AbstractIterator;
import java.util.Iterator;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.MathHelper;
public class BlockPosM extends BlockPos {
private int mx;
private int my;
private int mz;
private int level;
private BlockPosM[] facings;
private boolean needsUpdate;
public BlockPosM(int p_i22_1_, int p_i22_2_, int p_i22_3_) {
this(p_i22_1_, p_i22_2_, p_i22_3_, 0);
}
public BlockPosM(double p_i23_1_, double p_i23_3_, double p_i23_5_) {
this(MathHelper.floor_double(p_i23_1_), MathHelper.floor_double(p_i23_3_), MathHelper.floor_double(p_i23_5_));
}
public BlockPosM(int p_i24_1_, int p_i24_2_, int p_i24_3_, int p_i24_4_) {
super(0, 0, 0);
this.mx = p_i24_1_;
this.my = p_i24_2_;
this.mz = p_i24_3_;
this.level = p_i24_4_;
}
/**
* Get the X coordinate
*/
public int getX() {
return this.mx;
}
/**
* Get the Y coordinate
*/
public int getY() {
return this.my;
}
/**
* Get the Z coordinate
*/
public int getZ() {
return this.mz;
}
public void setXyz(int p_setXyz_1_, int p_setXyz_2_, int p_setXyz_3_) {
this.mx = p_setXyz_1_;
this.my = p_setXyz_2_;
this.mz = p_setXyz_3_;
this.needsUpdate = true;
}
public void setXyz(double p_setXyz_1_, double p_setXyz_3_, double p_setXyz_5_) {
this.setXyz(MathHelper.floor_double(p_setXyz_1_), MathHelper.floor_double(p_setXyz_3_), MathHelper.floor_double(p_setXyz_5_));
}
/**
* Offset this BlockPos 1 block in the given direction
*/
public BlockPos offset(EnumFacing facing) {
if (this.level <= 0) {
return super.offset(facing, 1);
} else {
if (this.facings == null) {
this.facings = new BlockPosM[EnumFacing.VALUES.length];
}
if (this.needsUpdate) {
this.update();
}
int i = facing.getIndex();
BlockPosM blockposm = this.facings[i];
if (blockposm == null) {
int j = this.mx + facing.getFrontOffsetX();
int k = this.my + facing.getFrontOffsetY();
int l = this.mz + facing.getFrontOffsetZ();
blockposm = new BlockPosM(j, k, l, this.level - 1);
this.facings[i] = blockposm;
}
return blockposm;
}
}
/**
* Offsets this BlockPos n blocks in the given direction
*/
public BlockPos offset(EnumFacing facing, int n) {
return n == 1 ? this.offset(facing) : super.offset(facing, n);
}
private void update() {
for (int i = 0; i < 6; ++i) {
BlockPosM blockposm = this.facings[i];
if (blockposm != null) {
EnumFacing enumfacing = EnumFacing.VALUES[i];
int j = this.mx + enumfacing.getFrontOffsetX();
int k = this.my + enumfacing.getFrontOffsetY();
int l = this.mz + enumfacing.getFrontOffsetZ();
blockposm.setXyz(j, k, l);
}
}
this.needsUpdate = false;
}
public static Iterable getAllInBoxMutable(BlockPos p_getAllInBoxMutable_0_, BlockPos p_getAllInBoxMutable_1_) {
final BlockPos blockpos = new BlockPos(Math.min(p_getAllInBoxMutable_0_.getX(), p_getAllInBoxMutable_1_.getX()), Math.min(p_getAllInBoxMutable_0_.getY(), p_getAllInBoxMutable_1_.getY()), Math.min(p_getAllInBoxMutable_0_.getZ(), p_getAllInBoxMutable_1_.getZ()));
final BlockPos blockpos1 = new BlockPos(Math.max(p_getAllInBoxMutable_0_.getX(), p_getAllInBoxMutable_1_.getX()), Math.max(p_getAllInBoxMutable_0_.getY(), p_getAllInBoxMutable_1_.getY()), Math.max(p_getAllInBoxMutable_0_.getZ(), p_getAllInBoxMutable_1_.getZ()));
return new Iterable() {
public Iterator iterator() {
return new AbstractIterator() {
private BlockPosM theBlockPosM = null;
protected BlockPosM computeNext0() {
if (this.theBlockPosM == null) {
this.theBlockPosM = new BlockPosM(blockpos.getX(), blockpos.getY(), blockpos.getZ(), 3);
return this.theBlockPosM;
} else if (this.theBlockPosM.equals(blockpos1)) {
return (BlockPosM)this.endOfData();
} else {
int i = this.theBlockPosM.getX();
int j = this.theBlockPosM.getY();
int k = this.theBlockPosM.getZ();
if (i < blockpos1.getX()) {
++i;
} else if (j < blockpos1.getY()) {
i = blockpos.getX();
++j;
} else if (k < blockpos1.getZ()) {
i = blockpos.getX();
j = blockpos.getY();
++k;
}
this.theBlockPosM.setXyz(i, j, k);
return this.theBlockPosM;
}
}
protected Object computeNext() {
return this.computeNext0();
}
};
}
};
}
public BlockPos getImmutable() {
return new BlockPos(this.getX(), this.getY(), this.getZ());
}
}

View File

@ -0,0 +1,86 @@
package net.PeytonPlayz585.shadow;
import net.minecraft.block.BlockLeavesBase;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.settings.GameSettings;
import net.minecraft.entity.Entity;
import net.minecraft.init.Blocks;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.chunk.EmptyChunk;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.client.Minecraft;
public class ClearWater {
public static void updateWaterOpacity(GameSettings p_updateWaterOpacity_0_, World p_updateWaterOpacity_1_) {
if (p_updateWaterOpacity_0_ != null) {
int i = 3;
if (p_updateWaterOpacity_0_.ofClearWater) {
i = 1;
}
BlockLeavesBase.setLightOpacity(Blocks.water, i);
BlockLeavesBase.setLightOpacity(Blocks.flowing_water, i);
}
if (p_updateWaterOpacity_1_ != null) {
IChunkProvider ichunkprovider = p_updateWaterOpacity_1_.getChunkProvider();
if (ichunkprovider != null) {
Entity entity = Minecraft.getMinecraft().getRenderViewEntity();
if (entity != null) {
int j = (int) entity.posX / 16;
int k = (int) entity.posZ / 16;
int l = j - 512;
int i1 = j + 512;
int j1 = k - 512;
int k1 = k + 512;
int l1 = 0;
for (int i2 = l; i2 < i1; ++i2) {
for (int j2 = j1; j2 < k1; ++j2) {
if (ichunkprovider.chunkExists(i2, j2)) {
Chunk chunk = ichunkprovider.provideChunk(i2, j2);
if (chunk != null && !(chunk instanceof EmptyChunk)) {
int k2 = i2 << 4;
int l2 = j2 << 4;
int i3 = k2 + 16;
int j3 = l2 + 16;
BlockPosM blockposm = new BlockPosM(0, 0, 0);
BlockPosM blockposm1 = new BlockPosM(0, 0, 0);
for (int k3 = k2; k3 < i3; ++k3) {
for (int l3 = l2; l3 < j3; ++l3) {
blockposm.setXyz(k3, 0, l3);
BlockPos blockpos = p_updateWaterOpacity_1_.getPrecipitationHeight(blockposm);
for (int i4 = 0; i4 < blockpos.getY(); ++i4) {
blockposm1.setXyz(k3, i4, l3);
IBlockState iblockstate = p_updateWaterOpacity_1_.getBlockState(blockposm1);
if (iblockstate.getBlock().getMaterial() == Material.water) {
p_updateWaterOpacity_1_.markBlocksDirtyVertical(k3, l3, blockposm1.getY(), blockpos.getY());
++l1;
break;
}
}
}
}
}
}
}
}
if (l1 > 0) {
Config.dbg("ClearWater (Server) relighted " + l1 + " chunks");
}
}
}
}
}
}

View File

@ -98,6 +98,18 @@ public class Config {
return Minecraft.getMinecraft().gameSettings.ofCustomSky; return Minecraft.getMinecraft().gameSettings.ofCustomSky;
} }
public static boolean isClearWater() {
return Minecraft.getMinecraft().gameSettings.ofClearWater;
}
public static boolean isBetterGrass() {
return Minecraft.getMinecraft().gameSettings.ofBetterGrass != 3;
}
public static boolean isBetterGrassFancy() {
return Minecraft.getMinecraft().gameSettings.ofBetterGrass == 2;
}
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

@ -0,0 +1,73 @@
package net.PeytonPlayz585.shadow;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.*;
import net.minecraft.client.resources.I18n;
import net.minecraft.client.settings.GameSettings;
public class GuiQuality extends GuiScreen {
private GuiScreen prevScreen;
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.CLEAR_WATER, GameSettings.Options.BETTER_GRASS, GameSettings.Options.CUSTOM_SKY};
public GuiQuality(GuiScreen p_i53_1_) {
this.prevScreen = p_i53_1_;
this.settings = Minecraft.getMinecraft().gameSettings;
}
/**
* Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the
* window resizes, the buttonList is cleared beforehand.
*/
public void initGui() {
this.title = I18n.format("Quality Settings", new Object[0]);
this.buttonList.clear();
for (int i = 0; i < enumOptions.length; ++i) {
GameSettings.Options gamesettings$options = enumOptions[i];
int j = this.width / 2 - 155 + i % 2 * 160;
int k = this.height / 6 + 21 * (i / 2) - 12;
if (!gamesettings$options.getEnumFloat()) {
this.buttonList.add(new GuiOptionButton(gamesettings$options.returnEnumOrdinal(), j, k, gamesettings$options, this.settings.getKeyBinding(gamesettings$options)));
} else {
this.buttonList.add(new GuiOptionSlider(gamesettings$options.returnEnumOrdinal(), j, k, gamesettings$options));
}
}
this.buttonList.add(new GuiButton(200, this.width / 2 - 100, this.height / 6 + 168 + 11, I18n.format("gui.done", new Object[0])));
}
/**
* Called by the controls from the buttonList when activated. (Mouse pressed for buttons)
*/
protected void actionPerformed(GuiButton button) {
if (button.enabled) {
if (button.id < 200 && button instanceof GuiOptionButton) {
this.settings.setOptionValue(((GuiOptionButton)button).returnEnumOptions(), 1);
button.displayString = this.settings.getKeyBinding(GameSettings.Options.getEnumOptions(button.id));
}
if (button.id == 200) {
this.mc.gameSettings.saveOptions();
this.mc.displayGuiScreen(this.prevScreen);
}
// if (button.id != GameSettings.Options.AA_LEVEL.ordinal()) {
// ScaledResolution scaledresolution = new ScaledResolution(this.mc);
// this.setWorldAndResolution(this.mc, scaledresolution.getScaledWidth(), scaledresolution.getScaledHeight());
// }
}
}
/**
* Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks
*/
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
this.drawDefaultBackground();
this.drawCenteredString(this.fontRendererObj, this.title, this.width / 2, 15, 16777215);
super.drawScreen(mouseX, mouseY, partialTicks);
}
}

View File

@ -0,0 +1,146 @@
package net.PeytonPlayz585.shadow;
import java.util.BitSet;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.state.BlockStateBase;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.BlockModelRenderer;
import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.client.renderer.block.model.BreakingFour;
import net.minecraft.client.settings.GameSettings;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.IBlockAccess;
public class RenderEnv {
private IBlockAccess blockAccess;
private IBlockState blockState;
private BlockPos blockPos;
private GameSettings gameSettings;
private int blockId = -1;
private int metadata = -1;
private int breakingAnimation = -1;
private float[] quadBounds = new float[EnumFacing.VALUES.length * 2];
private BitSet boundsFlags = new BitSet(3);
private BlockModelRenderer.AmbientOcclusionFace aoFace = new BlockModelRenderer.AmbientOcclusionFace();
private BlockPosM colorizerBlockPosM = null;
private boolean[] borderFlags = null;
private static ThreadLocal threadLocalInstance = new ThreadLocal();
private RenderEnv(IBlockAccess p_i94_1_, IBlockState p_i94_2_, BlockPos p_i94_3_) {
this.blockAccess = p_i94_1_;
this.blockState = p_i94_2_;
this.blockPos = p_i94_3_;
this.gameSettings = Config.getGameSettings();
}
public static RenderEnv getInstance(IBlockAccess p_getInstance_0_, IBlockState p_getInstance_1_, BlockPos p_getInstance_2_) {
RenderEnv renderenv = (RenderEnv)threadLocalInstance.get();
if (renderenv == null) {
renderenv = new RenderEnv(p_getInstance_0_, p_getInstance_1_, p_getInstance_2_);
threadLocalInstance.set(renderenv);
return renderenv;
} else {
renderenv.reset(p_getInstance_0_, p_getInstance_1_, p_getInstance_2_);
return renderenv;
}
}
private void reset(IBlockAccess p_reset_1_, IBlockState p_reset_2_, BlockPos p_reset_3_) {
this.blockAccess = p_reset_1_;
this.blockState = p_reset_2_;
this.blockPos = p_reset_3_;
this.blockId = -1;
this.metadata = -1;
this.breakingAnimation = -1;
this.boundsFlags.clear();
}
public int getBlockId() {
if (this.blockId < 0) {
if (this.blockState instanceof BlockStateBase) {
BlockStateBase blockstatebase = (BlockStateBase)this.blockState;
this.blockId = blockstatebase.getBlockId();
} else {
this.blockId = Block.getIdFromBlock(this.blockState.getBlock());
}
}
return this.blockId;
}
public int getMetadata() {
if (this.metadata < 0) {
if (this.blockState instanceof BlockStateBase) {
BlockStateBase blockstatebase = (BlockStateBase)this.blockState;
this.metadata = blockstatebase.getMetadata();
} else {
this.metadata = this.blockState.getBlock().getMetaFromState(this.blockState);
}
}
return this.metadata;
}
public float[] getQuadBounds() {
return this.quadBounds;
}
public BitSet getBoundsFlags() {
return this.boundsFlags;
}
public BlockModelRenderer.AmbientOcclusionFace getAoFace() {
return this.aoFace;
}
public boolean isBreakingAnimation(List p_isBreakingAnimation_1_) {
if (this.breakingAnimation < 0 && p_isBreakingAnimation_1_.size() > 0) {
if (p_isBreakingAnimation_1_.get(0) instanceof BreakingFour) {
this.breakingAnimation = 1;
} else {
this.breakingAnimation = 0;
}
}
return this.breakingAnimation == 1;
}
public boolean isBreakingAnimation(BakedQuad p_isBreakingAnimation_1_) {
if (this.breakingAnimation < 0) {
if (p_isBreakingAnimation_1_ instanceof BreakingFour) {
this.breakingAnimation = 1;
} else {
this.breakingAnimation = 0;
}
}
return this.breakingAnimation == 1;
}
public boolean isBreakingAnimation() {
return this.breakingAnimation == 1;
}
public IBlockState getBlockState() {
return this.blockState;
}
public BlockPosM getColorizerBlockPosM() {
if (this.colorizerBlockPosM == null) {
this.colorizerBlockPosM = new BlockPosM(0, 0, 0);
}
return this.colorizerBlockPosM;
}
public boolean[] getBorderFlags() {
if (this.borderFlags == null) {
this.borderFlags = new boolean[4];
}
return this.borderFlags;
}
}

View File

@ -1,5 +1,7 @@
package net.minecraft.block; package net.minecraft.block;
import java.util.IdentityHashMap;
import java.util.Map;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.util.BlockPos; import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
@ -25,6 +27,7 @@ import net.minecraft.world.IBlockAccess;
*/ */
public class BlockLeavesBase extends Block { public class BlockLeavesBase extends Block {
protected boolean fancyGraphics; protected boolean fancyGraphics;
private static Map mapOriginalOpacity = new IdentityHashMap();
protected BlockLeavesBase(Material materialIn, boolean fancyGraphics) { protected BlockLeavesBase(Material materialIn, boolean fancyGraphics) {
super(materialIn); super(materialIn);
@ -43,4 +46,12 @@ public class BlockLeavesBase extends Block {
return !this.fancyGraphics && iblockaccess.getBlockState(blockpos).getBlock() == this ? false return !this.fancyGraphics && iblockaccess.getBlockState(blockpos).getBlock() == this ? false
: super.shouldSideBeRendered(iblockaccess, blockpos, enumfacing); : super.shouldSideBeRendered(iblockaccess, blockpos, enumfacing);
} }
public static void setLightOpacity(Block p_setLightOpacity_0_, int p_setLightOpacity_1_) {
if (!mapOriginalOpacity.containsKey(p_setLightOpacity_0_)) {
mapOriginalOpacity.put(p_setLightOpacity_0_, Integer.valueOf(p_setLightOpacity_0_.getLightOpacity()));
}
p_setLightOpacity_0_.setLightOpacity(p_setLightOpacity_1_);
}
} }

View File

@ -2,8 +2,7 @@ package net.minecraft.client.gui;
import java.io.IOException; import java.io.IOException;
import net.PeytonPlayz585.shadow.GuiAnimations; import net.PeytonPlayz585.shadow.*;
import net.PeytonPlayz585.shadow.GuiShaders;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.I18n; import net.minecraft.client.resources.I18n;
import net.minecraft.client.settings.GameSettings; import net.minecraft.client.settings.GameSettings;
@ -133,6 +132,10 @@ public class GuiVideoSettings extends GuiScreen {
this.mc.displayGuiScreen(new GuiShaders(this)); this.mc.displayGuiScreen(new GuiShaders(this));
} }
if(parGuiButton.id == 202) {
this.mc.displayGuiScreen(new GuiQuality(this));
}
if (this.guiGameSettings.guiScale != i) { if (this.guiGameSettings.guiScale != i) {
ScaledResolution scaledresolution = new ScaledResolution(this.mc); ScaledResolution scaledresolution = new ScaledResolution(this.mc);
int j = scaledresolution.getScaledWidth(); int j = scaledresolution.getScaledWidth();

View File

@ -3,7 +3,7 @@ package net.minecraft.client.renderer;
import java.util.BitSet; import java.util.BitSet;
import java.util.List; import java.util.List;
import net.PeytonPlayz585.shadow.Config; import net.PeytonPlayz585.shadow.*;
import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager; import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
import net.lax1dude.eaglercraft.v1_8.opengl.WorldRenderer; import net.lax1dude.eaglercraft.v1_8.opengl.WorldRenderer;
import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.DeferredStateManager; import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.DeferredStateManager;
@ -77,9 +77,9 @@ public class BlockModelRenderer {
} }
} }
public boolean renderModelAmbientOcclusion(IBlockAccess blockAccessIn, IBakedModel modelIn, Block blockIn, public boolean renderModelAmbientOcclusion(IBlockAccess blockAccessIn, IBakedModel modelIn, Block blockIn, BlockPos blockPosIn, WorldRenderer worldRendererIn, boolean checkSides) {
BlockPos blockPosIn, WorldRenderer worldRendererIn, boolean checkSides) {
boolean flag = false; boolean flag = false;
RenderEnv renderenv = null;
float[] afloat = new float[EnumFacing.values().length * 2]; float[] afloat = new float[EnumFacing.values().length * 2];
BitSet bitset = new BitSet(3); BitSet bitset = new BitSet(3);
BlockModelRenderer.AmbientOcclusionFace blockmodelrenderer$ambientocclusionface = new BlockModelRenderer.AmbientOcclusionFace(); BlockModelRenderer.AmbientOcclusionFace blockmodelrenderer$ambientocclusionface = new BlockModelRenderer.AmbientOcclusionFace();
@ -89,8 +89,16 @@ public class BlockModelRenderer {
if (!list.isEmpty()) { if (!list.isEmpty()) {
BlockPos blockpos = blockPosIn.offset(enumfacing); BlockPos blockpos = blockPosIn.offset(enumfacing);
if (!checkSides || blockIn.shouldSideBeRendered(blockAccessIn, blockpos, enumfacing)) { if (!checkSides || blockIn.shouldSideBeRendered(blockAccessIn, blockpos, enumfacing)) {
this.renderModelAmbientOcclusionQuads(blockAccessIn, blockIn, blockPosIn, worldRendererIn, list,
afloat, bitset, blockmodelrenderer$ambientocclusionface); if (renderenv == null) {
renderenv = RenderEnv.getInstance(blockAccessIn, blockAccessIn.getBlockState(blockPosIn), blockPosIn);
}
if (!renderenv.isBreakingAnimation(list) && Config.isBetterGrass()) {
list = BetterGrass.getFaceQuads(blockAccessIn, blockIn, blockPosIn, enumfacing, list);
}
this.renderModelAmbientOcclusionQuads(blockAccessIn, blockIn, blockPosIn, worldRendererIn, list, afloat, bitset, blockmodelrenderer$ambientocclusionface);
flag = true; flag = true;
} }
} }
@ -110,6 +118,7 @@ public class BlockModelRenderer {
BlockPos blockPosIn, WorldRenderer worldRendererIn, boolean checkSides) { BlockPos blockPosIn, WorldRenderer worldRendererIn, boolean checkSides) {
boolean isDeferred = DeferredStateManager.isDeferredRenderer(); boolean isDeferred = DeferredStateManager.isDeferredRenderer();
boolean flag = false; boolean flag = false;
RenderEnv renderenv = null;
float[] afloat = isDeferred ? new float[EnumFacing.values().length * 2] : null; float[] afloat = isDeferred ? new float[EnumFacing.values().length * 2] : null;
BitSet bitset = new BitSet(3); BitSet bitset = new BitSet(3);
@ -119,9 +128,17 @@ public class BlockModelRenderer {
if (!list.isEmpty()) { if (!list.isEmpty()) {
BlockPos blockpos = blockPosIn.offsetEvenFaster(enumfacing, pointer); BlockPos blockpos = blockPosIn.offsetEvenFaster(enumfacing, pointer);
if (!checkSides || blockIn.shouldSideBeRendered(blockAccessIn, blockpos, enumfacing)) { if (!checkSides || blockIn.shouldSideBeRendered(blockAccessIn, blockpos, enumfacing)) {
if (renderenv == null) {
renderenv = RenderEnv.getInstance(blockAccessIn, blockAccessIn.getBlockState(blockPosIn), blockPosIn);
}
if (!renderenv.isBreakingAnimation(list) && Config.isBetterGrass()) {
list = BetterGrass.getFaceQuads(blockAccessIn, blockIn, blockPosIn, enumfacing, list);
}
int i = blockIn.getMixedBrightnessForBlock(blockAccessIn, blockpos); int i = blockIn.getMixedBrightnessForBlock(blockAccessIn, blockpos);
this.renderModelStandardQuads(blockAccessIn, blockIn, blockPosIn, enumfacing, i, false, this.renderModelStandardQuads(blockAccessIn, blockIn, blockPosIn, enumfacing, i, false, worldRendererIn, list, bitset, afloat);
worldRendererIn, list, bitset, afloat);
flag = true; flag = true;
} }
} }
@ -489,7 +506,7 @@ public class BlockModelRenderer {
return parFloat1 == 0.2F ? aoLightValueOpaque : parFloat1; return parFloat1 == 0.2F ? aoLightValueOpaque : parFloat1;
} }
class AmbientOcclusionFace { public static class AmbientOcclusionFace {
private final float[] vertexColorMultiplier = new float[4]; private final float[] vertexColorMultiplier = new float[4];
private final int[] vertexBrightness = new int[4]; private final int[] vertexBrightness = new int[4];

View File

@ -87,6 +87,8 @@ import net.minecraft.util.Vec3i;
import net.minecraft.world.WorldSettings; import net.minecraft.world.WorldSettings;
import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.biome.BiomeGenBase;
import net.PeytonPlayz585.shadow.Config;
/**+ /**+
* This portion of EaglercraftX contains deobfuscated Minecraft 1.8 source code. * This portion of EaglercraftX contains deobfuscated Minecraft 1.8 source code.
* *
@ -1759,6 +1761,10 @@ public class EntityRenderer implements IResourceManagerReloadListener {
} else { } else {
GlStateManager.setFogDensity(0.1F - (float) EnchantmentHelper.getRespiration(entity) * 0.03F); GlStateManager.setFogDensity(0.1F - (float) EnchantmentHelper.getRespiration(entity) * 0.03F);
} }
if (Config.isClearWater()) {
GlStateManager.setFogDensity(0.02F);
}
} else if (block.getMaterial() == Material.lava) { } else if (block.getMaterial() == Material.lava) {
GlStateManager.setFog(GL_EXP); GlStateManager.setFog(GL_EXP);
GlStateManager.setFogDensity(2.0F); GlStateManager.setFogDensity(2.0F);

View File

@ -40,6 +40,8 @@ import net.minecraft.network.play.client.C15PacketClientSettings;
import net.minecraft.util.MathHelper; import net.minecraft.util.MathHelper;
import net.minecraft.world.EnumDifficulty; import net.minecraft.world.EnumDifficulty;
import net.PeytonPlayz585.shadow.ClearWater;
/**+ /**+
* This portion of EaglercraftX contains deobfuscated Minecraft 1.8 source code. * This portion of EaglercraftX contains deobfuscated Minecraft 1.8 source code.
* *
@ -201,6 +203,8 @@ public class GameSettings {
//Quality Settings //Quality Settings
public boolean ofCustomSky = true; public boolean ofCustomSky = true;
public boolean ofClearWater = false;
public int ofBetterGrass = 3;
//Optifine Animations //Optifine Animations
public int ofAnimatedWater = 0; public int ofAnimatedWater = 0;
@ -565,6 +569,21 @@ public class GameSettings {
CustomSky.update(); CustomSky.update();
} }
if (parOptions == GameSettings.Options.CLEAR_WATER) {
this.ofClearWater = !this.ofClearWater;
this.updateWaterOpacity();
}
if (parOptions == GameSettings.Options.BETTER_GRASS) {
++this.ofBetterGrass;
if (this.ofBetterGrass > 3) {
this.ofBetterGrass = 1;
}
this.mc.renderGlobal.loadRenderers();
}
this.saveOptions(); this.saveOptions();
} }
@ -635,6 +654,8 @@ public class GameSettings {
return this.useVbo; return this.useVbo;
case CUSTOM_SKY: case CUSTOM_SKY:
return this.ofCustomSky; return this.ofCustomSky;
case CLEAR_WATER:
return this.ofClearWater;
default: default:
return false; return false;
} }
@ -761,7 +782,20 @@ public class GameSettings {
return this.useVbo ? s + "ON" : s + "OFF"; return this.useVbo ? s + "ON" : s + "OFF";
} else if (parOptions == GameSettings.Options.CUSTOM_SKY) { } else if (parOptions == GameSettings.Options.CUSTOM_SKY) {
return this.ofCustomSky ? s + "ON" : s + "OFF"; return this.ofCustomSky ? s + "ON" : s + "OFF";
} else { } else if (parOptions == GameSettings.Options.CLEAR_WATER) {
return this.ofClearWater ? s + "ON" : s + "OFF";
} else if (parOptions == GameSettings.Options.BETTER_GRASS) {
switch (this.ofBetterGrass) {
case 1:
return s + "Fast";
case 2:
return s + "Fancy";
default:
return s + "OFF";
}
} else {
return s; return s;
} }
} }
@ -1124,6 +1158,16 @@ public class GameSettings {
this.ofCustomSky = Boolean.valueOf(astring[1]).booleanValue(); this.ofCustomSky = Boolean.valueOf(astring[1]).booleanValue();
} }
if (astring[0].equals("ofClearWater") && astring.length >= 2) {
this.ofClearWater = Boolean.valueOf(astring[1]).booleanValue();
this.updateWaterOpacity();
}
if (astring[0].equals("ofBetterGrass") && astring.length >= 2) {
this.ofBetterGrass = Integer.valueOf(astring[1]).intValue();
this.ofBetterGrass = Config.limit(this.ofBetterGrass, 1, 3);
}
Keyboard.setFunctionKeyModifier(keyBindFunction.getKeyCode()); Keyboard.setFunctionKeyModifier(keyBindFunction.getKeyCode());
for (SoundCategory soundcategory : SoundCategory.values()) { for (SoundCategory soundcategory : SoundCategory.values()) {
@ -1250,6 +1294,8 @@ public class GameSettings {
printwriter.println("ofAoLevel:" + this.ofAoLevel); printwriter.println("ofAoLevel:" + this.ofAoLevel);
printwriter.println("useVbo:" + this.useVbo); printwriter.println("useVbo:" + this.useVbo);
printwriter.println("ofCustomSky:" + this.ofCustomSky); printwriter.println("ofCustomSky:" + this.ofCustomSky);
printwriter.println("ofClearWater:" + this.ofClearWater);
printwriter.println("ofBetterGrass:" + this.ofBetterGrass);
for (KeyBinding keybinding : this.keyBindings) { for (KeyBinding keybinding : this.keyBindings) {
printwriter.println("key_" + keybinding.getKeyDescription() + ":" + keybinding.getKeyCode()); printwriter.println("key_" + keybinding.getKeyDescription() + ":" + keybinding.getKeyCode());
@ -1412,7 +1458,9 @@ public class GameSettings {
ANIMATED_TEXTURES("Textures Animated", false, false), ANIMATED_TEXTURES("Textures Animated", false, false),
AO_LEVEL("Smooth Lighting Level", true, false), AO_LEVEL("Smooth Lighting Level", true, false),
USE_VBO("Use VBOs", false, false), USE_VBO("Use VBOs", false, false),
CUSTOM_SKY("Custom Sky", false, false); CUSTOM_SKY("Custom Sky", false, false),
CLEAR_WATER("Clear Water", false, false),
BETTER_GRASS("Better Grass", false, false);
private final boolean enumFloat; private final boolean enumFloat;
private final boolean enumBoolean; private final boolean enumBoolean;
@ -1513,4 +1561,8 @@ public class GameSettings {
this.ofAnimatedTerrain = p_setAllAnimations_1_; this.ofAnimatedTerrain = p_setAllAnimations_1_;
this.ofAnimatedTextures = p_setAllAnimations_1_; this.ofAnimatedTextures = p_setAllAnimations_1_;
} }
private void updateWaterOpacity() {
ClearWater.updateWaterOpacity(this, this.mc.theWorld);
}
} }