More general config options

This commit is contained in:
Justin Aquadro committed 2014-09-09 00:31:12 -04:00
1 parent 999dd58ae5
commit 78f71cc79c
4 files changed
+20 -10

No files matched your search

@@ -69,6 +69,9 @@ storageDrawers.config.upgrades.level6Mult=Storage Multiplier (VI)
storageDrawers.config.prop.itemRenderType=Item Render Type
storageDrawers.config.prop.itemRenderType.tooltip=Render items in 3D or flat.
storageDrawers.config.prop.enableIndicatorUpgrades=Enable Indicator Upgrades
storageDrawers.config.prop.enableStorageUpgrades=Enable Storage Upgrades
storageDrawers.config.prop.renderStorageUpgrades=Render Storage Upgrades
storageDrawers.config.prop.enabled=Enabled
storageDrawers.config.prop.enabled.tooltip=Enable block in game.
storageDrawers.config.prop.baseStorage=Base Storage
@@ -76,7 +76,7 @@ public class DrawersRenderer implements ISimpleBlockRenderingHandler
renderExterior(block, x, y, z, side, renderer);
if (tile.getLevel() > 1) {
if (tile.getLevel() > 1 && StorageDrawers.config.cache.renderStorageUpgrades) {
for (int i = 0; i < 6; i++)
boxRenderer.setIcon(block.getOverlayIcon(world, x, y, z, i, tile.getLevel()), i);
@@ -50,7 +50,12 @@ public class ConfigManager
}
}
private class ConfigCache {
public class ConfigCache {
public boolean enableIndicatorUpgrades;
public boolean enableStorageUpgrades;
public boolean renderStorageUpgrades;
public String itemRenderType;
public int level2Mult;
public int level3Mult;
public int level4Mult;
@@ -61,7 +66,7 @@ public class ConfigManager
private static final String LANG_PREFIX = "storageDrawers.config.";
private final Configuration config;
private final ConfigCache cache;
public final ConfigCache cache;
public final List<ConfigSection> sections = new ArrayList<ConfigSection>();
public final ConfigSection sectionGeneral = new ConfigSection(sections, "general", "general");
@@ -76,7 +81,7 @@ public class ConfigManager
public Map<String, ConfigSection> blockSectionsMap = new HashMap<String, ConfigSection>();
private Property itemRenderType;
//private Property itemRenderType;
@@ -96,8 +101,10 @@ public class ConfigManager
}
public void syncConfig () {
itemRenderType = config.get(Configuration.CATEGORY_GENERAL, "itemRenderType", "fancy", null, new String[] { "fancy", "fast" });
itemRenderType.setLanguageKey(LANG_PREFIX + "prop.itemRenderType");
cache.enableIndicatorUpgrades = config.get(Configuration.CATEGORY_GENERAL, "enableIndicatorUpgrades", true).setLanguageKey(LANG_PREFIX + "prop.enableIndicatorUpgrades").setRequiresMcRestart(true).getBoolean();
cache.enableStorageUpgrades = config.get(Configuration.CATEGORY_GENERAL, "enableStorageUpgrades", true).setLanguageKey(LANG_PREFIX + "prop.enableStorageUpgrades").setRequiresMcRestart(true).getBoolean();
cache.itemRenderType = config.get(Configuration.CATEGORY_GENERAL, "itemRenderType", "fancy", null, new String[] { "fancy", "fast" }).setLanguageKey(LANG_PREFIX + "prop.itemRenderType").getString();
cache.renderStorageUpgrades = config.get(Configuration.CATEGORY_GENERAL, "renderStorageUpgrades", true).setLanguageKey(LANG_PREFIX + "prop.renderStorageUpgrades").getBoolean();
config.get(sectionBlocksFullDrawers1x2.getQualifiedName(), "enabled", true).setLanguageKey(LANG_PREFIX + "prop.enabled").setRequiresMcRestart(true);
config.get(sectionBlocksFullDrawers1x2.getQualifiedName(), "baseStorage", 8).setLanguageKey(LANG_PREFIX + "prop.baseStorage").setRequiresWorldRestart(true);
@@ -122,9 +129,7 @@ public class ConfigManager
}
public boolean isFancyItemRenderEnabled () {
if (itemRenderType.getString().equals("fancy"))
return true;
return false;
return cache.itemRenderType.equals("fancy");
}
public String getPath () {
@@ -1,5 +1,6 @@
package com.jaquadro.minecraft.storagedrawers.core;
import com.jaquadro.minecraft.storagedrawers.StorageDrawers;
import com.jaquadro.minecraft.storagedrawers.item.ItemUpgrade;
import cpw.mods.fml.common.registry.GameRegistry;
@@ -10,6 +11,7 @@ public class ModItems
public void init () {
upgrade = new ItemUpgrade("upgrade");
GameRegistry.registerItem(upgrade, "upgrade");
if (StorageDrawers.config.cache.enableStorageUpgrades)
GameRegistry.registerItem(upgrade, "upgrade");
}
}