config GUI for leaf particles

This commit is contained in:
octarine-noise
2014-08-15 20:22:52 +02:00
parent e88a1ba5ae
commit dcbb636902
4 changed files with 77 additions and 4 deletions

View File

@@ -0,0 +1,34 @@
package mods.betterfoliage.client.gui;
import mods.betterfoliage.BetterFoliage;
import mods.betterfoliage.client.gui.widget.OptionDoubleWidget;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.resources.I18n;
import cpw.mods.fml.client.FMLClientHandler;
public class ConfigGuiFallingLeaves extends ConfigGuiScreenBase {
public ConfigGuiFallingLeaves(GuiScreen parent) {
super(parent);
int id = 10;
widgets.add(new OptionDoubleWidget(BetterFoliage.config.fallingLeavesSize, -100, -100, 200, 50, id++, id++, "message.betterfoliage.size", "%.2f"));
widgets.add(new OptionDoubleWidget(BetterFoliage.config.fallingLeavesSpeed, -100, -70, 200, 50, id++, id++, "message.betterfoliage.speed", "%.2f"));
widgets.add(new OptionDoubleWidget(BetterFoliage.config.fallingLeavesWindStrength, -100, -40, 200, 50, id++, id++, "message.betterfoliage.windStrength", "%.1f"));
widgets.add(new OptionDoubleWidget(BetterFoliage.config.fallingLeavesStormStrength, -100, -10, 200, 50, id++, id++, "message.betterfoliage.stormStrength", "%.1f"));
widgets.add(new OptionDoubleWidget(BetterFoliage.config.fallingLeavesPerturb, -100, 20, 200, 50, id++, id++, "message.betterfoliage.fallingLeafPerturbation", "%.2f"));
widgets.add(new OptionDoubleWidget(BetterFoliage.config.fallingLeavesChance, -100, 50, 200, 50, id++, id++, "message.betterfoliage.fallingLeafChance", "%.3f"));
widgets.add(new OptionDoubleWidget(BetterFoliage.config.fallingLeavesLifetime, -100, 80, 200, 50, id++, id++, "message.betterfoliage.fallingLeafLifetime", "%.2f"));
}
@SuppressWarnings("unchecked")
@Override
public void addButtons(int x, int y) {
buttonList.add(new GuiButton(0, x - 50, y + 110, 100, 20, I18n.format("message.betterfoliage.back")));
}
@Override
protected void onButtonPress(int id) {
if (id == 0) FMLClientHandler.instance().showGuiScreen(parent);
}
}

View File

@@ -14,6 +14,7 @@ public class ConfigGuiMain extends ConfigGuiScreenBase {
public enum Button {CLOSE,
TOGGLE_LEAVES, CONFIG_LEAVES,
TOGGLE_FALLING_LEAVES, CONFIG_FALLING_LEAVES,
TOGGLE_GRASS, CONFIG_GRASS,
TOGGLE_CACTUS, CONFIG_CACTUS,
TOGGLE_LILYPAD, CONFIG_LILYPAD,
@@ -31,8 +32,11 @@ public class ConfigGuiMain extends ConfigGuiScreenBase {
protected void addButtons(int x, int y) {
buttonList.add(new GuiButton(Button.CLOSE.ordinal(), x - 50, y + 110, 100, 20, I18n.format("message.betterfoliage.close")));
buttonList.add(new GuiButton(Button.TOGGLE_LEAVES.ordinal(), x - 100, y - 100, 150, 20, ""));
buttonList.add(new GuiButton(Button.CONFIG_LEAVES.ordinal(), x + 60, y - 100, 40, 20, I18n.format("message.betterfoliage.config")));
buttonList.add(new GuiButton(Button.TOGGLE_LEAVES.ordinal(), x - 100, y - 130, 150, 20, ""));
buttonList.add(new GuiButton(Button.CONFIG_LEAVES.ordinal(), x + 60, y - 130, 40, 20, I18n.format("message.betterfoliage.config")));
buttonList.add(new GuiButton(Button.TOGGLE_FALLING_LEAVES.ordinal(), x - 100, y - 100, 150, 20, ""));
buttonList.add(new GuiButton(Button.CONFIG_FALLING_LEAVES.ordinal(), x + 60, y - 100, 40, 20, I18n.format("message.betterfoliage.config")));
buttonList.add(new GuiButton(Button.TOGGLE_GRASS.ordinal(), x - 100, y - 70, 150, 20, ""));
buttonList.add(new GuiButton(Button.CONFIG_GRASS.ordinal(), x + 60, y - 70, 40, 20, I18n.format("message.betterfoliage.config")));
@@ -55,6 +59,7 @@ public class ConfigGuiMain extends ConfigGuiScreenBase {
protected void updateButtons() {
setButtonOptionBoolean(Button.TOGGLE_LEAVES.ordinal(), "message.betterfoliage.betterLeaves", BetterFoliage.config.leavesEnabled);
setButtonOptionBoolean(Button.TOGGLE_FALLING_LEAVES.ordinal(), "message.betterfoliage.fallingLeaves", BetterFoliage.config.fallingLeavesEnabled);
setButtonOptionBoolean(Button.TOGGLE_GRASS.ordinal(), "message.betterfoliage.betterGrass", BetterFoliage.config.grassEnabled);
setButtonOptionBoolean(Button.TOGGLE_CACTUS.ordinal(), "message.betterfoliage.betterCactus", BetterFoliage.config.cactusEnabled);
setButtonOptionBoolean(Button.TOGGLE_LILYPAD.ordinal(), "message.betterfoliage.betterLilypad", BetterFoliage.config.lilypadEnabled);
@@ -72,6 +77,7 @@ public class ConfigGuiMain extends ConfigGuiScreenBase {
FMLClientHandler.instance().showGuiScreen(parent);
}
if (id == Button.TOGGLE_LEAVES.ordinal()) BetterFoliage.config.leavesEnabled = !BetterFoliage.config.leavesEnabled;
if (id == Button.TOGGLE_FALLING_LEAVES.ordinal()) BetterFoliage.config.fallingLeavesEnabled = !BetterFoliage.config.fallingLeavesEnabled;
if (id == Button.TOGGLE_GRASS.ordinal()) BetterFoliage.config.grassEnabled = !BetterFoliage.config.grassEnabled;
if (id == Button.TOGGLE_CACTUS.ordinal()) BetterFoliage.config.cactusEnabled = !BetterFoliage.config.cactusEnabled;
if (id == Button.TOGGLE_LILYPAD.ordinal()) BetterFoliage.config.lilypadEnabled = !BetterFoliage.config.lilypadEnabled;
@@ -80,6 +86,7 @@ public class ConfigGuiMain extends ConfigGuiScreenBase {
if (id == Button.TOGGLE_CORAL.ordinal()) BetterFoliage.config.coralEnabled = !BetterFoliage.config.coralEnabled;
if (id== Button.CONFIG_LEAVES.ordinal()) FMLClientHandler.instance().showGuiScreen(new ConfigGuiLeaves(this));
if (id== Button.CONFIG_FALLING_LEAVES.ordinal()) FMLClientHandler.instance().showGuiScreen(new ConfigGuiFallingLeaves(this));
if (id== Button.CONFIG_GRASS.ordinal()) FMLClientHandler.instance().showGuiScreen(new ConfigGuiGrass(this));
if (id== Button.CONFIG_LILYPAD.ordinal()) FMLClientHandler.instance().showGuiScreen(new ConfigGuiLilypad(this));
if (id== Button.CONFIG_REED.ordinal()) FMLClientHandler.instance().showGuiScreen(new ConfigGuiReed(this));

View File

@@ -29,6 +29,9 @@ public class BetterFoliageConfig extends ConfigBase {
@CfgElement(category="coral", key="enabled")
public boolean coralEnabled = true;
@CfgElement(category="fallingLeaves", key="enabled")
public boolean fallingLeavesEnabled = true;
@CfgElement(category="leaves", key="horizontalOffset")
public OptionDouble leavesHOffset = new OptionDouble(0.0, 0.4, 0.025, 0.2);
@@ -43,7 +46,7 @@ public class BetterFoliageConfig extends ConfigBase {
@CfgElement(category="grass", key="heightMin")
@Limit(max="grassHeightMax")
public OptionDouble grassHeightMin = new OptionDouble(0.1, 1.5, 0.05, 0.5);
public OptionDouble grassHeightMin = new OptionDouble(0.1, 1.5, 0.05, 0.8);
@CfgElement(category="grass", key="heightMax")
public OptionDouble grassHeightMax = new OptionDouble(0.1, 1.5, 0.05, 1.0);
@@ -103,4 +106,25 @@ public class BetterFoliageConfig extends ConfigBase {
@CfgElement(category="coral", key="size")
public OptionDouble coralSize = new OptionDouble(0.25, 1.0, 0.05, 0.7);
@CfgElement(category="fallingLeaves", key="speed")
public OptionDouble fallingLeavesSpeed = new OptionDouble(0.01, 0.15, 0.01, 0.05);
@CfgElement(category="fallingLeaves", key="windStrength")
public OptionDouble fallingLeavesWindStrength = new OptionDouble(0.1, 2.0, 0.1, 0.5);
@CfgElement(category="fallingLeaves", key="stormStrength")
public OptionDouble fallingLeavesStormStrength = new OptionDouble(0.1, 2.0, 0.1, 0.8);
@CfgElement(category="fallingLeaves", key="size")
public OptionDouble fallingLeavesSize = new OptionDouble(0.25, 1.5, 0.05, 0.75);
@CfgElement(category="fallingLeaves", key="chance")
public OptionDouble fallingLeavesChance = new OptionDouble(0.005, 1.0, 0.005, 0.05);
@CfgElement(category="fallingLeaves", key="perturbation")
public OptionDouble fallingLeavesPerturb = new OptionDouble(0.05, 1.0, 0.05, 0.25);
@CfgElement(category="fallingLeaves", key="lifetime")
public OptionDouble fallingLeavesLifetime = new OptionDouble(1.0, 10.0, 0.1, 5.0);
}

View File

@@ -13,6 +13,7 @@ message.betterfoliage.betterLilypad=Better Lilypad: %s
message.betterfoliage.betterReed=Reeds: %s
message.betterfoliage.betterAlgae=Algae: %s
message.betterfoliage.betterCoral=Coral: %s
message.betterfoliage.fallingLeaves=Falling Leaves: %s
message.betterfoliage.size=Size
message.betterfoliage.hOffset=H.Offset
@@ -28,4 +29,11 @@ message.betterfoliage.leavesTranslate=Translate
message.betterfoliage.algaeChance=Algae Population
message.betterfoliage.crustSize=Crust Size
message.betterfoliage.coralChance=Coral Chance
message.betterfoliage.coralPopulation=Coral Population
message.betterfoliage.coralPopulation=Coral Population
message.betterfoliage.speed=Speed
message.betterfoliage.windStrength=Wind Strength
message.betterfoliage.stormStrength=Storm Strength
message.betterfoliage.fallingLeafChance=Particle Chance
message.betterfoliage.fallingLeafPerturbation=Perturbation
message.betterfoliage.fallingLeafLifetime=Max. lifetime