mirror of
https://github.com/GTNewHorizons/StorageDrawers.git
synced 2026-11-17 19:15:11 +00:00
Config respects storage upgrade multipliers
This commit is contained in:
1 parent
11e22a4853
commit
999dd58ae5
3 files changed
+39
-1
No files matched your search
@@ -61,6 +61,12 @@ storageDrawers.config.blocks.halfDrawers4=Compact Drawers 2x2
|
||||
storageDrawers.config.upgrades=Upgrade Settings
|
||||
storageDrawers.config.upgrades.tooltip=Configure individual storage upgrades.
|
||||
|
||||
storageDrawers.config.upgrades.level2Mult=Storage Multiplier (II)
|
||||
storageDrawers.config.upgrades.level3Mult=Storage Multiplier (III)
|
||||
storageDrawers.config.upgrades.level4Mult=Storage Multiplier (IV)
|
||||
storageDrawers.config.upgrades.level5Mult=Storage Multiplier (V)
|
||||
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.enabled=Enabled
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.jaquadro.minecraft.storagedrawers.block.tile;
|
||||
|
||||
import com.jaquadro.minecraft.storagedrawers.StorageDrawers;
|
||||
import com.jaquadro.minecraft.storagedrawers.config.ConfigManager;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.Item;
|
||||
@@ -95,7 +97,8 @@ public class TileEntityDrawers extends TileEntity implements ISidedInventory
|
||||
}
|
||||
|
||||
public int stackCapacity () {
|
||||
return level * drawerCapacity;
|
||||
ConfigManager config = StorageDrawers.config;
|
||||
return config.getStorageUpgradeMultiplier(level) * drawerCapacity;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -50,9 +50,18 @@ public class ConfigManager
|
||||
}
|
||||
}
|
||||
|
||||
private class ConfigCache {
|
||||
public int level2Mult;
|
||||
public int level3Mult;
|
||||
public int level4Mult;
|
||||
public int level5Mult;
|
||||
public int level6Mult;
|
||||
}
|
||||
|
||||
private static final String LANG_PREFIX = "storageDrawers.config.";
|
||||
|
||||
private final Configuration config;
|
||||
private final ConfigCache cache;
|
||||
|
||||
public final List<ConfigSection> sections = new ArrayList<ConfigSection>();
|
||||
public final ConfigSection sectionGeneral = new ConfigSection(sections, "general", "general");
|
||||
@@ -69,8 +78,11 @@ public class ConfigManager
|
||||
|
||||
private Property itemRenderType;
|
||||
|
||||
|
||||
|
||||
public ConfigManager (File file) {
|
||||
config = new Configuration(file);
|
||||
cache = new ConfigCache();
|
||||
|
||||
for (ConfigSection section : sections)
|
||||
section.getCategory();
|
||||
@@ -99,6 +111,12 @@ public class ConfigManager
|
||||
config.get(sectionBlocksHalfDrawers2x2.getQualifiedName(), "enabled", true).setLanguageKey(LANG_PREFIX + "prop.enabled").setRequiresMcRestart(true);
|
||||
config.get(sectionBlocksHalfDrawers2x2.getQualifiedName(), "baseStorage", 2).setLanguageKey(LANG_PREFIX + "prop.baseStorage").setRequiresWorldRestart(true);
|
||||
|
||||
cache.level2Mult = config.get(sectionUpgrades.getQualifiedName(), "level2Mult", 2).setLanguageKey(LANG_PREFIX + "upgrades.level2Mult").setRequiresWorldRestart(true).getInt();
|
||||
cache.level3Mult = config.get(sectionUpgrades.getQualifiedName(), "level3Mult", 3).setLanguageKey(LANG_PREFIX + "upgrades.level3Mult").setRequiresWorldRestart(true).getInt();
|
||||
cache.level4Mult = config.get(sectionUpgrades.getQualifiedName(), "level4Mult", 5).setLanguageKey(LANG_PREFIX + "upgrades.level4Mult").setRequiresWorldRestart(true).getInt();
|
||||
cache.level5Mult = config.get(sectionUpgrades.getQualifiedName(), "level5Mult", 8).setLanguageKey(LANG_PREFIX + "upgrades.level5Mult").setRequiresWorldRestart(true).getInt();
|
||||
cache.level6Mult = config.get(sectionUpgrades.getQualifiedName(), "level6Mult", 13).setLanguageKey(LANG_PREFIX + "upgrades.level6Mult").setRequiresWorldRestart(true).getInt();
|
||||
|
||||
if (config.hasChanged())
|
||||
config.save();
|
||||
}
|
||||
@@ -128,4 +146,15 @@ public class ConfigManager
|
||||
ConfigSection section = blockSectionsMap.get(blockName);
|
||||
return section.getCategory().get("baseStorage").getInt();
|
||||
}
|
||||
|
||||
public int getStorageUpgradeMultiplier (int level) {
|
||||
switch (level) {
|
||||
case 2: return cache.level2Mult;
|
||||
case 3: return cache.level3Mult;
|
||||
case 4: return cache.level4Mult;
|
||||
case 5: return cache.level5Mult;
|
||||
case 6: return cache.level6Mult;
|
||||
default: return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user