make reeds, algae, coral biomes configurable
This commit is contained in:
@@ -9,6 +9,7 @@ import mods.betterfoliage.common.config.Config;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import cpw.mods.fml.common.Mod;
|
||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
import cpw.mods.fml.common.network.NetworkCheckHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
@@ -31,12 +32,17 @@ public class BetterFoliage {
|
||||
@Mod.EventHandler
|
||||
public void preInit(FMLPreInitializationEvent event) {
|
||||
log = event.getModLog();
|
||||
if (event.getSide() == Side.CLIENT) {
|
||||
configDir = new File(event.getModConfigurationDirectory(), MOD_ID);
|
||||
configDir.mkdir();
|
||||
Config.readConfig(new File(configDir, "betterfoliage.cfg"));
|
||||
BetterFoliageClient.preInit();
|
||||
}
|
||||
configDir = new File(event.getModConfigurationDirectory(), MOD_ID);
|
||||
configDir.mkdir();
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
public void posInit(FMLPostInitializationEvent event) {
|
||||
if (event.getSide() == Side.CLIENT) {
|
||||
Config.getDefaultBiomes();
|
||||
Config.readConfig(new File(configDir, "betterfoliage.cfg"));
|
||||
BetterFoliageClient.postInit();
|
||||
}
|
||||
}
|
||||
|
||||
@NetworkCheckHandler
|
||||
|
||||
@@ -42,7 +42,7 @@ public class BetterFoliageClient {
|
||||
public static LeafParticleTextures leafParticles = new LeafParticleTextures(0);
|
||||
public static WindTracker wind = new WindTracker();
|
||||
|
||||
public static void preInit() {
|
||||
public static void postInit() {
|
||||
FMLCommonHandler.instance().bus().register(new KeyHandler());
|
||||
FMLCommonHandler.instance().bus().register(new Config());
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package mods.betterfoliage.common.config;
|
||||
package mods.betterfoliage.client.gui;
|
||||
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import cpw.mods.fml.client.config.GuiConfig;
|
||||
@@ -24,7 +24,6 @@ public class AlternateTextBooleanEntry extends GuiConfigEntries.ButtonEntry {
|
||||
public void updateValueButtonText()
|
||||
{
|
||||
this.btnValue.displayString = I18n.format(configElement.getLanguageKey() + "." + String.valueOf(currentValue));
|
||||
// btnValue.packedFGColour = currentValue ? GuiUtils.getColorCode('2', true) : GuiUtils.getColorCode('4', true);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -0,0 +1,68 @@
|
||||
package mods.betterfoliage.client.gui;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
|
||||
import com.google.common.base.Predicates;
|
||||
import com.google.common.collect.Collections2;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import cpw.mods.fml.client.config.GuiConfig;
|
||||
import cpw.mods.fml.client.config.GuiConfigEntries;
|
||||
import cpw.mods.fml.client.config.IConfigElement;
|
||||
|
||||
|
||||
public class BiomeListConfigEntry extends SelectListConfigEntry<BiomeGenBase> {
|
||||
|
||||
public static List<BiomeGenBase> reedBiomeList = Lists.newArrayList();
|
||||
public static List<BiomeGenBase> algaeBiomeList = Lists.newArrayList();
|
||||
public static List<BiomeGenBase> coralBiomeList = Lists.newArrayList();
|
||||
|
||||
public BiomeListConfigEntry(GuiConfig owningScreen, GuiConfigEntries owningEntryList, IConfigElement<?> configElement) {
|
||||
super(owningScreen, owningEntryList, configElement);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<BiomeGenBase> getBaseSet(String qualifiedName) {
|
||||
List<BiomeGenBase> biomes = Lists.newArrayList(Collections2.filter(Arrays.asList(BiomeGenBase.getBiomeGenArray()), Predicates.notNull()));
|
||||
Collections.sort(biomes, new Comparator<BiomeGenBase>() {
|
||||
@Override
|
||||
public int compare(BiomeGenBase o1, BiomeGenBase o2) {
|
||||
return o1.biomeName.compareTo(o2.biomeName);
|
||||
}
|
||||
});
|
||||
return biomes;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<BiomeGenBase> getDefaultSelected(String name) {
|
||||
if (name.equals("reedBiomeList")) return reedBiomeList;
|
||||
if (name.equals("algaeBiomeList")) return algaeBiomeList;
|
||||
if (name.equals("coralBiomeList")) return coralBiomeList;
|
||||
return ImmutableList.<BiomeGenBase>of();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getItemId(BiomeGenBase item) {
|
||||
return item.biomeID;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getItemName(BiomeGenBase item) {
|
||||
return item.biomeName;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getTooltipLangKey(String name) {
|
||||
if (name.equals("reedBiomeList")) return "betterfoliage.reeds.biomeSelectTooltip";
|
||||
if (name.equals("algaeBiomeList")) return "betterfoliage.algae.biomeSelectTooltip";
|
||||
if (name.equals("coralBiomeList")) return "betterfoliage.coral.biomeSelectTooltip";
|
||||
return "";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
package mods.betterfoliage.common.config;
|
||||
|
||||
import java.util.Iterator;
|
||||
package mods.betterfoliage.client.gui;
|
||||
|
||||
import mods.betterfoliage.common.util.Utils;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import cpw.mods.fml.client.config.GuiConfig;
|
||||
@@ -15,14 +14,7 @@ public class NonVerboseArrayEntry extends GuiConfigEntries.ArrayEntry {
|
||||
public NonVerboseArrayEntry(GuiConfig owningScreen, GuiConfigEntries owningEntryList, IConfigElement<?> configElement) {
|
||||
super(owningScreen, owningEntryList, configElement);
|
||||
|
||||
// strip defaults from tooltip as they can get quite long
|
||||
boolean defaultRows = false;
|
||||
Iterator<String> iter = toolTip.iterator();
|
||||
while(iter.hasNext()) {
|
||||
if (iter.next().startsWith(EnumChatFormatting.AQUA.toString())) defaultRows = true;
|
||||
if (defaultRows) iter.remove();
|
||||
}
|
||||
|
||||
Utils.stripTooltipDefaultText(toolTip);
|
||||
String shortDefaults = I18n.format("betterfoliage.arrayEntryDisplay", configElement.getDefaults().length);
|
||||
toolTip.addAll(this.mc.fontRenderer.listFormattedStringToWidth(EnumChatFormatting.AQUA + I18n.format("fml.configgui.tooltip.default", shortDefaults),300));
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
package mods.betterfoliage.client.gui;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import mods.betterfoliage.common.util.Utils;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
import cpw.mods.fml.client.config.ConfigGuiType;
|
||||
import cpw.mods.fml.client.config.DummyConfigElement;
|
||||
import cpw.mods.fml.client.config.GuiConfig;
|
||||
import cpw.mods.fml.client.config.GuiConfigEntries;
|
||||
import cpw.mods.fml.client.config.GuiConfigEntries.CategoryEntry;
|
||||
import cpw.mods.fml.client.config.IConfigElement;
|
||||
|
||||
|
||||
public abstract class SelectListConfigEntry<T> extends CategoryEntry {
|
||||
|
||||
List<ItemWrapperElement> children;
|
||||
List<Integer> notFoundIdList;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public SelectListConfigEntry(GuiConfig owningScreen, GuiConfigEntries owningEntryList, IConfigElement<?> configElement) {
|
||||
super(owningScreen, owningEntryList, configElement);
|
||||
Utils.stripTooltipDefaultText(toolTip);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected GuiScreen buildChildScreen()
|
||||
{
|
||||
return new GuiConfig(this.owningScreen, createChildElements(), this.owningScreen.modID,
|
||||
owningScreen.allRequireWorldRestart || this.configElement.requiresWorldRestart(),
|
||||
owningScreen.allRequireMcRestart || this.configElement.requiresMcRestart(), this.owningScreen.title,
|
||||
((this.owningScreen.titleLine2 == null ? "" : this.owningScreen.titleLine2) + " > " + this.name));
|
||||
}
|
||||
|
||||
protected abstract List<T> getBaseSet(String qualifiedName);
|
||||
protected abstract List<T> getDefaultSelected(String qualifiedName);
|
||||
protected abstract int getItemId(T item);
|
||||
protected abstract String getItemName(T item);
|
||||
protected abstract String getTooltipLangKey(String qualifiedName);
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
protected List<IConfigElement> createChildElements() {
|
||||
children = Lists.newArrayList();
|
||||
|
||||
List<Integer> idList = Lists.newArrayList();
|
||||
for (Object id : configElement.getList()) idList.add((Integer) id);
|
||||
|
||||
List<T> defaults = getDefaultSelected(configElement.getName());
|
||||
for(T item : getBaseSet(configElement.getQualifiedName())) {
|
||||
children.add(new ItemWrapperElement(item, defaults.contains(item), idList.contains(getItemId(item))));
|
||||
idList.remove(new Integer(getItemId(item)));
|
||||
}
|
||||
|
||||
notFoundIdList = idList;
|
||||
List<IConfigElement> result = Lists.newArrayList();
|
||||
result.addAll(children);
|
||||
return result;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public boolean saveConfigElement() {
|
||||
boolean requiresRestart = ((GuiConfig) childScreen).entryList.saveConfigElements();
|
||||
|
||||
Set<Integer> idSet = Sets.newHashSet();
|
||||
for (ItemWrapperElement child : children)
|
||||
if (Boolean.TRUE.equals(child.getCurrentValue()))
|
||||
idSet.add(getItemId(child.item));
|
||||
|
||||
idSet.addAll(notFoundIdList);
|
||||
List<Integer> result = Lists.newArrayList(idSet);
|
||||
Collections.sort(result);
|
||||
configElement.set(result.toArray());
|
||||
|
||||
return requiresRestart;
|
||||
}
|
||||
|
||||
public class ItemWrapperElement extends DummyConfigElement<Boolean> implements IConfigElement<Boolean> {
|
||||
|
||||
public T item;
|
||||
|
||||
public ItemWrapperElement(T item, boolean defaultValue, boolean currentValue) {
|
||||
super(getItemName(item), defaultValue, ConfigGuiType.BOOLEAN, getItemName(item));
|
||||
set(currentValue);
|
||||
this.item = item;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getComment() {
|
||||
return I18n.format(getTooltipLangKey(configElement.getQualifiedName()), EnumChatFormatting.GOLD + getItemName(item) + EnumChatFormatting.YELLOW);
|
||||
}
|
||||
|
||||
public Boolean getCurrentValue() {
|
||||
return (Boolean) value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void set(Boolean value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public void setDefault(Boolean value) {
|
||||
this.defaultValue = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -31,7 +31,8 @@ public class RenderBlockBetterAlgae extends RenderBlockAOBase implements IRender
|
||||
|
||||
public boolean isBlockAccepted(IBlockAccess blockAccess, int x, int y, int z, Block block, int original) {
|
||||
if (!Config.algaeEnabled) return false;
|
||||
if (!(Config.dirt.matchesID(block))) return false;
|
||||
if (!Config.dirt.matchesID(block)) return false;
|
||||
if (!Config.algaeBiomeList.contains(blockAccess.getBiomeGenForCoords(x, z).biomeID)) return false;
|
||||
if (blockAccess.getBlock(x, y + 1, z).getMaterial() != Material.water) return false;
|
||||
if (blockAccess.getBlock(x, y + 2, z).getMaterial() != Material.water) return false;
|
||||
int terrainVariation = MathHelper.floor_double((noise.func_151605_a(x, z) + 1.0) * 32.0);
|
||||
|
||||
@@ -32,6 +32,7 @@ public class RenderBlockBetterCoral extends RenderBlockAOBase implements IRender
|
||||
public boolean isBlockAccepted(IBlockAccess blockAccess, int x, int y, int z, Block block, int original) {
|
||||
if (!Config.coralEnabled) return false;
|
||||
if (block != Blocks.sand) return false;
|
||||
if (!Config.coralBiomeList.contains(blockAccess.getBiomeGenForCoords(x, z).biomeID)) return false;
|
||||
int terrainVariation = MathHelper.floor_double((noise.func_151605_a(x * 0.1, z * 0.1) + 1.0) * 32.0);
|
||||
return terrainVariation < Config.coralPopulation;
|
||||
}
|
||||
|
||||
@@ -34,9 +34,9 @@ public class RenderBlockBetterReed extends RenderBlockAOBase implements IRenderB
|
||||
public boolean isBlockAccepted(IBlockAccess blockAccess, int x, int y, int z, Block block, int original) {
|
||||
if (!Config.reedEnabled) return false;
|
||||
if (!(Config.dirt.matchesID(block))) return false;
|
||||
if (!Config.reedBiomeList.contains(blockAccess.getBiomeGenForCoords(x, z).biomeID)) return false;
|
||||
if (blockAccess.getBlock(x, y + 1, z).getMaterial() != Material.water) return false;
|
||||
if (!blockAccess.isAirBlock(x, y + 2, z)) return false;
|
||||
if (blockAccess.getBiomeGenForCoords(x, z).temperature < 0.4f || blockAccess.getBiomeGenForCoords(x, z).rainfall < 0.4f) return false;
|
||||
int terrainVariation = MathHelper.floor_double((noise.func_151605_a(x, z) + 1.0) * 32.0);
|
||||
return terrainVariation < Config.reedPopulation;
|
||||
}
|
||||
|
||||
@@ -5,13 +5,21 @@ import java.util.List;
|
||||
|
||||
import mods.betterfoliage.BetterFoliage;
|
||||
import mods.betterfoliage.client.BlockMatcher;
|
||||
import mods.betterfoliage.client.gui.AlternateTextBooleanEntry;
|
||||
import mods.betterfoliage.client.gui.BiomeListConfigEntry;
|
||||
import mods.betterfoliage.client.gui.NonVerboseArrayEntry;
|
||||
import mods.betterfoliage.common.util.Utils;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
import net.minecraftforge.common.config.ConfigCategory;
|
||||
import net.minecraftforge.common.config.ConfigElement;
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
import net.minecraftforge.common.config.Property;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.collect.Collections2;
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import cpw.mods.fml.client.config.IConfigElement;
|
||||
@@ -86,6 +94,10 @@ public class Config {
|
||||
public static boolean ctxGrassClassicEnabled;
|
||||
public static boolean ctxGrassAggressiveEnabled;
|
||||
|
||||
public static List<Integer> reedBiomeList = Lists.newArrayList();
|
||||
public static List<Integer> algaeBiomeList = Lists.newArrayList();
|
||||
public static List<Integer> coralBiomeList = Lists.newArrayList();
|
||||
|
||||
/** Read the config file
|
||||
* @param configFile
|
||||
*/
|
||||
@@ -123,7 +135,8 @@ public class Config {
|
||||
reedHeightMax = getDouble(Category.reed, "heightMax", 2.5, 1.5, 3.5, "betterfoliage.maxHeight");
|
||||
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");
|
||||
|
||||
algaeEnabled = getBoolean(Category.algae, "enabled", true, "betterfoliage.enabled");
|
||||
algaeHOffset = getDouble(Category.algae, "hOffset", 0.1, 0.0, 0.25, "betterfoliage.hOffset");
|
||||
algaeSize = getDouble(Category.algae, "size", 1.0, 0.5, 1.5, "betterfoliage.size");
|
||||
@@ -131,6 +144,7 @@ public class Config {
|
||||
algaeHeightMax = getDouble(Category.algae, "heightMax", 1.0, 0.1, 1.5, "betterfoliage.maxHeight");
|
||||
algaePopulation = getInt(Category.algae, "population", 48, 0, 64, "betterfoliage.population");
|
||||
algaeHeightMin = clampDoubleToMax(Category.algae, "heightMin", "heightMax");
|
||||
algaeBiomeList = getIntList(Category.algae, "algaeBiomeList", algaeBiomeList, "betterfoliage.algae.biomeList");
|
||||
|
||||
coralEnabled = getBoolean(Category.coral, "enabled", true, "betterfoliage.enabled");
|
||||
coralHOffset = getDouble(Category.coral, "hOffset", 0.2, 0.0, 0.4, "betterfoliage.hOffset");
|
||||
@@ -139,7 +153,8 @@ public class Config {
|
||||
coralCrustSize = getDouble(Category.coral, "crustSize", 1.4, 0.5, 1.5, "betterfoliage.coral.crustSize");
|
||||
coralChance = getInt(Category.coral, "chance", 32, 0, 64, "betterfoliage.coral.chance");
|
||||
coralPopulation = getInt(Category.coral, "population", 48, 0, 64, "betterfoliage.population");
|
||||
|
||||
coralBiomeList = getIntList(Category.coral, "coralBiomeList", coralBiomeList, "betterfoliage.coral.biomeList");
|
||||
|
||||
leafFXEnabled = getBoolean(Category.fallingLeaves, "enabled", true, "betterfoliage.enabled");
|
||||
leafFXSpeed = getDouble(Category.fallingLeaves, "speed", 0.05, 0.01, 0.15, "betterfoliage.fallingLeaves.speed");
|
||||
leafFXWindStrength = getDouble(Category.fallingLeaves, "windStrength", 0.5, 0.1, 2.0, "betterfoliage.fallingLeaves.windStrength");
|
||||
@@ -158,18 +173,49 @@ public class Config {
|
||||
updateBlockMatcher(crops, Category.blockTypes, "cropWhitelist", "betterfoliage.blockTypes.cropWhitelist", "cropBlacklist", "betterfoliage.blockTypes.cropBlacklist", new ResourceLocation("betterfoliage:classesCropDefault.cfg"));
|
||||
|
||||
rawConfig.getCategory(Category.extraLeaves.toString()).get("skewMode").setConfigEntryClass(AlternateTextBooleanEntry.class);
|
||||
rawConfig.getCategory(Category.reed.toString()).get("reedBiomeList").setConfigEntryClass(BiomeListConfigEntry.class);
|
||||
rawConfig.getCategory(Category.algae.toString()).get("algaeBiomeList").setConfigEntryClass(BiomeListConfigEntry.class);
|
||||
rawConfig.getCategory(Category.coral.toString()).get("coralBiomeList").setConfigEntryClass(BiomeListConfigEntry.class);
|
||||
|
||||
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.lilypad, "enabled", "hOffset", "flowerChance");
|
||||
setOrder(Category.reed, "enabled", "hOffset", "heightMin", "heightMax", "population");
|
||||
setOrder(Category.reed, "enabled", "hOffset", "heightMin", "heightMax", "population", "biomeList");
|
||||
setOrder(Category.algae, "enabled", "hOffset", "heightMin", "heightMax", "population");
|
||||
setOrder(Category.coral, "enabled", "hOffset", "vOffset", "size", "crustSize", "population", "chance");
|
||||
setOrder(Category.fallingLeaves, "enabled", "size", "chance", "lifetime", "speed", "windStrength", "stormStrength", "perturb");
|
||||
setOrder(Category.connectedGrass, "classic", "aggressive");
|
||||
}
|
||||
|
||||
public static void getDefaultBiomes() {
|
||||
for (BiomeGenBase biome : BiomeGenBase.getBiomeGenArray()) {
|
||||
if (biome == null) continue;
|
||||
if (Utils.biomeTempRainFilter(0.4f, null, 0.4f, null).apply(biome)) {
|
||||
reedBiomeList.add(biome.biomeID);
|
||||
BiomeListConfigEntry.reedBiomeList.add(biome);
|
||||
}
|
||||
if (Utils.biomeClassNameFilter("river", "ocean").apply(biome)) {
|
||||
algaeBiomeList.add(biome.biomeID);
|
||||
coralBiomeList.add(biome.biomeID);
|
||||
BiomeListConfigEntry.algaeBiomeList.add(biome);
|
||||
BiomeListConfigEntry.coralBiomeList.add(biome);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected static List<Integer> getFilteredBiomeIds(List<BiomeGenBase> biomes, Predicate<BiomeGenBase> filter) {
|
||||
return Lists.newArrayList(Collections2.transform(
|
||||
Collections2.filter(biomes, filter),
|
||||
new Function<BiomeGenBase, Integer>() {
|
||||
public Integer apply(BiomeGenBase input) {
|
||||
return input.biomeID;
|
||||
}
|
||||
}
|
||||
));
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public static List<IConfigElement> getConfigRootElements() {
|
||||
List<IConfigElement> result = Lists.newLinkedList();
|
||||
@@ -204,6 +250,23 @@ public class Config {
|
||||
return prop.getInt();
|
||||
}
|
||||
|
||||
protected static List<Integer> getIntList(Category category, String key, List<Integer> defaultList, String langKey) {
|
||||
int[] defaults = new int[]{};
|
||||
if (defaultList != null) {
|
||||
defaults = new int[defaultList.size()];
|
||||
int idx = 0;
|
||||
for (Integer value : defaultList) defaults[idx++] = value;
|
||||
}
|
||||
|
||||
Property prop = rawConfig.get(category.toString(), key, defaults);
|
||||
prop.setLanguageKey(langKey);
|
||||
|
||||
int[] values = prop.getIntList();
|
||||
List<Integer> result = Lists.newArrayListWithCapacity(values.length);
|
||||
for (int value : values) result.add(value);
|
||||
return result;
|
||||
}
|
||||
|
||||
protected static boolean getBoolean(Category category, String key, boolean defaultValue, String langKey) {
|
||||
Property prop = rawConfig.get(category.toString(), key, defaultValue);
|
||||
prop.setLanguageKey(langKey);
|
||||
|
||||
@@ -6,6 +6,8 @@ import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import mods.betterfoliage.loader.DeobfHelper;
|
||||
@@ -13,9 +15,12 @@ import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.resources.IResource;
|
||||
import net.minecraft.client.resources.IResourceManager;
|
||||
import net.minecraft.client.resources.SimpleReloadableResourceManager;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
|
||||
import com.google.common.base.Charsets;
|
||||
import com.google.common.base.Predicate;
|
||||
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
@@ -108,4 +113,45 @@ public class Utils {
|
||||
reader.close();
|
||||
writer.close();
|
||||
}
|
||||
|
||||
public static void stripTooltipDefaultText(List<String> tooltip) {
|
||||
boolean defaultRows = false;
|
||||
Iterator<String> iter = tooltip.iterator();
|
||||
while(iter.hasNext()) {
|
||||
if (iter.next().startsWith(EnumChatFormatting.AQUA.toString())) defaultRows = true;
|
||||
if (defaultRows) iter.remove();
|
||||
}
|
||||
}
|
||||
|
||||
public static Predicate<BiomeGenBase> biomeTempRainFilter(final Float minTemp, final Float maxTemp, final Float minRain, final Float maxRain) {
|
||||
return new Predicate<BiomeGenBase>() {
|
||||
public boolean apply(BiomeGenBase biome) {
|
||||
if (minTemp != null && biome.temperature < minTemp) return false;
|
||||
if (maxTemp != null && biome.temperature > maxTemp) return false;
|
||||
if (minRain != null && biome.rainfall < minRain) return false;
|
||||
if (maxRain != null && biome.rainfall > maxRain) return false;
|
||||
return true;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public static Predicate<BiomeGenBase> biomeClassFilter(final Class<?>... classList) {
|
||||
return new Predicate<BiomeGenBase>() {
|
||||
public boolean apply(BiomeGenBase biome) {
|
||||
for (Class<?> clazz : classList)
|
||||
if (clazz.isAssignableFrom(biome.getClass()) || clazz.equals(biome.getClass()))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public static Predicate<BiomeGenBase> biomeClassNameFilter(final String... names) {
|
||||
return new Predicate<BiomeGenBase>() {
|
||||
public boolean apply(BiomeGenBase biome) {
|
||||
for (String name : names) if (biome.getClass().getName().toLowerCase().contains(name.toLowerCase())) return true;
|
||||
return false;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ betterfoliage.leavesMode.false=Translate
|
||||
betterfoliage.shortGrass=Short Grass
|
||||
betterfoliage.shortGrass.tooltip=Tufts of grass on top of grass blocks
|
||||
betterfoliage.shortGrass.useGenerated=Use generated texture
|
||||
betterfoliage.shortGrass.useGenerated.tooltip=Generated texture is made by slicing the tallgrass texture from the active resource pack set in half
|
||||
betterfoliage.shortGrass.useGenerated.tooltip=Generated texture is made by slicing the tallgrass texture from the active resource pack in half
|
||||
|
||||
betterfoliage.cactus=Better Cactus
|
||||
betterfoliage.cactus.tooltip=Enhance cactus with extra bits and smooth shading
|
||||
@@ -58,9 +58,15 @@ betterfoliage.lilypad.flowerChance.tooltip=Chance (N in 64) of a lilypad having
|
||||
|
||||
betterfoliage.reed=Reeds
|
||||
betterfoliage.reed.tooltip=Reeds on dirt blocks in shallow water
|
||||
betterfoliage.reed.biomeList=Biome List
|
||||
betterfoliage.reed.biomeList.tooltip=Configure which biomes reeds are allowed to appear in
|
||||
betterfoliage.reeds.biomeSelectTooltip=Should reeds appear in the %s biome?
|
||||
|
||||
betterfoliage.algae=Algae
|
||||
betterfoliage.algae.tooltip=Algae on dirt blocks in deep water
|
||||
betterfoliage.algae.biomeList=Biome List
|
||||
betterfoliage.algae.biomeList.tooltip=Configure which biomes algae is allowed to appear in
|
||||
betterfoliage.algae.biomeSelectTooltip=Should algae appear in the %s biome?
|
||||
|
||||
betterfoliage.coral=Coral
|
||||
betterfoliage.coral.tooltip=Coral on sand blocks in deep water
|
||||
@@ -70,6 +76,9 @@ betterfoliage.coral.crustSize=Crust size
|
||||
betterfoliage.coral.crustSize.tooltip=Size of the flat coral part
|
||||
betterfoliage.coral.chance=Coral chance
|
||||
betterfoliage.coral.chance.tooltip=Chance (N in 64) of a specific face of the block to show coral
|
||||
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.fallingLeaves=Falling leaves
|
||||
betterfoliage.fallingLeaves.tooltip=Falling leaf particle FX emitted from the bottom of leaf blocks
|
||||
@@ -88,7 +97,6 @@ betterfoliage.fallingLeaves.lifetime=Maximum lifetime
|
||||
betterfoliage.fallingLeaves.lifetime.tooltip=Maximum lifetime of particle in seconds. Minimum lifetime is 60%% of this value
|
||||
|
||||
betterfoliage.connectedGrass=Connected grass textures
|
||||
betterfoliage.connectedGrass.tooltip=Connected grass textures
|
||||
betterfoliage.connectedGrass.classic=Classic connected grass
|
||||
betterfoliage.connectedGrass.classic.tooltip=Draw grass top texture on grass block face if there is a grass block diagonally under it
|
||||
betterfoliage.connectedGrass.aggressive=Aggressive connected grass
|
||||
|
||||
@@ -4,5 +4,5 @@
|
||||
"version": "$version",
|
||||
"mcversion": "$mcversion",
|
||||
"description": "Leafier leaves and grassier grass",
|
||||
"authorList" : ["§6octarine-noise §7(code)", "§6Meringue §7(textures)"]
|
||||
"authorList" : ["§6octarine-noise §7(code)", "§6Meringue §7(textures)"]
|
||||
}]
|
||||
Reference in New Issue
Block a user