Skip to content

Commit

Permalink
extra config options: turn off shader wind for shortgrass and reeds, …
Browse files Browse the repository at this point in the history
…shallow water coral
  • Loading branch information
octarine-noise committed Nov 5, 2014
1 parent accf71f commit bc65729
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 7 deletions.
Expand Up @@ -49,7 +49,7 @@ public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block b
Tessellator.instance.setBrightness(getBrightness(block, x, y, z));
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
if (blockAccess.getBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ).getMaterial() != Material.water) continue;
if (blockAccess.isAirBlock(x + dir.offsetX, y + dir.offsetY + 1, z + dir.offsetZ)) continue;
if (!Config.coralShallowWater && blockAccess.isAirBlock(x + dir.offsetX, y + dir.offsetY + 1, z + dir.offsetZ)) continue;

int variation = getSemiRandomFromPos(x, y, z, dir.ordinal());
if (variation < Config.coralChance) {
Expand Down
Expand Up @@ -70,7 +70,7 @@ public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block b
}
if (shortGrassIcon == null) return true;

ShadersModIntegration.startGrassQuads();
if (Config.grassShaderWind) ShadersModIntegration.startGrassQuads();
Tessellator.instance.setBrightness(getBrightness(block, x, y + 1, z));
renderCrossedSideQuads(new Double3(x + 0.5, y + 1.0 + (isSnowTop ? 0.0625 : 0.0), z + 0.5), ForgeDirection.UP, scale, halfHeight, pRot[iconVariation], Config.grassHOffset, shortGrassIcon, 0, false);
}
Expand Down
Expand Up @@ -57,7 +57,7 @@ public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block b
Tessellator.instance.setColorOpaque(255, 255, 255);

// render reeds
ShadersModIntegration.startGrassQuads();
if (Config.reedShaderWind) ShadersModIntegration.startGrassQuads();
renderCrossedSideQuads(new Double3(x + 0.5, y + 1.0, z + 0.5), ForgeDirection.UP, 0.5, quarterHeight, pRot[iconVariation], Config.reedHOffset, bottomIcon, 0, true);
renderCrossedSideQuads(new Double3(x + 0.5, y + 1.0 + 2.0 * quarterHeight, z + 0.5), ForgeDirection.UP, 0.5, quarterHeight, pRot[iconVariation], Config.reedHOffset, topIcon, 0, true);

Expand Down
14 changes: 10 additions & 4 deletions src/main/java/mods/betterfoliage/common/config/Config.java
Expand Up @@ -51,6 +51,7 @@ public enum Category {
public static double grassHeightMin;
public static double grassHeightMax;
public static double grassSize;
public static boolean grassShaderWind;

public static boolean cactusEnabled;

Expand All @@ -63,6 +64,7 @@ public enum Category {
public static double reedHeightMin;
public static double reedHeightMax;
public static int reedPopulation;
public static boolean reedShaderWind;

public static boolean algaeEnabled;
public static double algaeHOffset;
Expand All @@ -72,6 +74,7 @@ public enum Category {
public static int algaePopulation;

public static boolean coralEnabled;
public static boolean coralShallowWater;
public static int coralPopulation;
public static int coralChance;
public static double coralVOffset;
Expand Down Expand Up @@ -138,7 +141,8 @@ public static void updateValues() {
grassSize = getDouble(Category.shortGrass, "size", 1.0, 0.5, 1.5, "betterfoliage.size");
grassUseGenerated = getBoolean(Category.shortGrass, "useGenerated", false, "betterfoliage.shortGrass.useGenerated");
grassHeightMin = clampDoubleToMax(Category.shortGrass, "heightMin", "heightMax");

grassShaderWind = getBoolean(Category.shortGrass, "shaderWind", true, "betterfoliage.shaderWind");

cactusEnabled = getBoolean(Category.cactus, "enabled", true, "betterfoliage.enabled");

lilypadEnabled = getBoolean(Category.lilypad, "enabled", true, "betterfoliage.enabled");
Expand All @@ -152,6 +156,7 @@ public static void updateValues() {
reedPopulation = getInt(Category.reed, "population", 32, 0, 64, "betterfoliage.population");
reedHeightMin = clampDoubleToMax(Category.reed, "heightMin", "heightMax");
reedBiomeList = getIntList(Category.reed, "reedBiomeList", reedBiomeList, "betterfoliage.reed.biomeList");
reedShaderWind = getBoolean(Category.reed, "shaderWind", true, "betterfoliage.shaderWind");

algaeEnabled = getBoolean(Category.algae, "enabled", true, "betterfoliage.enabled");
algaeHOffset = getDouble(Category.algae, "hOffset", 0.1, 0.0, 0.25, "betterfoliage.hOffset");
Expand All @@ -163,6 +168,7 @@ public static void updateValues() {
algaeBiomeList = getIntList(Category.algae, "algaeBiomeList", algaeBiomeList, "betterfoliage.algae.biomeList");

coralEnabled = getBoolean(Category.coral, "enabled", true, "betterfoliage.enabled");
coralShallowWater = getBoolean(Category.coral, "shallowWater", false, "betterfoliage.coral.shallowWater");
coralHOffset = getDouble(Category.coral, "hOffset", 0.2, 0.0, 0.4, "betterfoliage.hOffset");
coralVOffset = getDouble(Category.coral, "vOffset", 0.1, 0.0, 0.4, "betterfoliage.vOffset");
coralSize = getDouble(Category.coral, "size", 0.7, 0.5, 1.5, "betterfoliage.coral.size");
Expand Down Expand Up @@ -216,11 +222,11 @@ public static void updateValues() {
for (Category category : Category.values()) rawConfig.setCategoryLanguageKey(category.toString(), String.format("betterfoliage.%s", category.toString()));

setOrder(Category.extraLeaves, "enabled", "skewMode", "hOffset", "vOffset", "size");
setOrder(Category.shortGrass, "enabled", "useGenerated", "hOffset", "heightMin", "heightMax", "size");
setOrder(Category.shortGrass, "enabled", "useGenerated", "hOffset", "heightMin", "heightMax", "size", "shaderWind");
setOrder(Category.lilypad, "enabled", "hOffset", "flowerChance");
setOrder(Category.reed, "enabled", "hOffset", "heightMin", "heightMax", "population", "biomeList");
setOrder(Category.reed, "enabled", "hOffset", "heightMin", "heightMax", "population", "biomeList", "shaderWind");
setOrder(Category.algae, "enabled", "hOffset", "heightMin", "heightMax", "size", "population", "biomeList");
setOrder(Category.coral, "enabled", "hOffset", "vOffset", "size", "crustSize", "population", "chance", "biomeList");
setOrder(Category.coral, "enabled", "shallowWater", "hOffset", "vOffset", "size", "crustSize", "population", "chance", "biomeList");
setOrder(Category.netherrack, "enabled", "hOffset", "heightMin", "heightMax", "size");
setOrder(Category.fallingLeaves, "enabled", "chance", "size", "lifetime", "speed", "windStrength", "stormStrength", "perturb");
setOrder(Category.risingSoul, "enabled", "chance", "speed", "perturb", "headSize", "trailSize", "sizeDecay", "opacity", "opacityDecay", "lifetime", "trailLength", "trailDensity");
Expand Down
4 changes: 4 additions & 0 deletions src/main/resources/assets/betterfoliage/lang/en_US.lang
Expand Up @@ -15,6 +15,8 @@ betterfoliage.maxHeight=Maximum height
betterfoliage.maxHeight.tooltip=Maximum height of element
betterfoliage.population=Population
betterfoliage.population.tooltip=Chance (N in 64) that an eligible block will have this feature
betterfoliage.shaderWind=Shader wind effects
betterfoliage.shaderWind.tooltip=Apply wind effects from ShaderMod shaders to this element?

betterfoliage.blockTypes=Block Types
betterfoliage.blockTypes.tooltip=Configure lists of block classes that will have specific features applied to them
Expand Down Expand Up @@ -79,6 +81,8 @@ betterfoliage.coral.chance.tooltip=Chance (N in 64) of a specific face of the bl
betterfoliage.coral.biomeList=Biome List
betterfoliage.coral.biomeList.tooltip=Configure which biomes coral is allowed to appear in
betterfoliage.coral.biomeSelectTooltip=Should coral appear in the %s biome?
betterfoliage.coral.shallowWater=Shallow water coral
betterfoliage.coral.shallowWater.tooltip=Should coral appear in 1 block deep water?

betterfoliage.netherrack=Netherrack Vines
betterfoliage.netherrack.tooltip=Hanging Vines under netherrack
Expand Down

0 comments on commit bc65729

Please sign in to comment.