Skip to content

Commit 9472760

Browse files
committed
add auto mode for maxItemTypes & fix mod detection
fix #39
1 parent e6a23ca commit 9472760

3 files changed

Lines changed: 21 additions & 4 deletions

File tree

src/main/java/com/zerofall/ezstorage/configuration/EZConfiguration.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,15 @@ public class EZConfiguration {
2323
@Config.RangeInt(min = 1)
2424
public static int hyperCapacity;
2525

26-
@Config.Comment("The maximum amount of different items that can be stored within one storage core.\nIn the past this option tried to ensure the NBT data wont get too large wich would normally lead to world corruption. Today it is not needed anymore, that's why the default value is 0 (disbaled).")
26+
@Config.Comment("The maximum amount of different items that can be stored within one storage core, 0 disables the feature, -1 enables the automatic mode.\nThis option tries to ensure the NBT data wont get too large wich would normally lead to world corruption (network packages going too large).\nIt is hightly recommended to install hodgepodge to increase the network package size limit!")
2727
@Config.DefaultInt(0)
2828
@Config.RangeInt(min = 0)
2929
public static int maxItemTypes;
3030

31+
@Config.Comment("If enabled, sets the limit of 'maxItemTypes' automatically to a possibly harmless value, depending if Hodgepodge is present or not.\nIt is hightly recommended to install hodgepodge to increase the network package size limit!")
32+
@Config.DefaultBoolean(true)
33+
public static boolean maxItemTypesAutoMode;
34+
3135
@Config.Comment("Focus the input field when opening a storage GUI.")
3236
@Config.DefaultBoolean(true)
3337
public static boolean focusGuiInput;
@@ -41,4 +45,8 @@ public static void init() {
4145
ConfigurationManager.registerConfig(EZConfiguration.class);
4246
} catch (ConfigException ignore) {}
4347
}
48+
49+
public static void save() {
50+
ConfigurationManager.save(EZConfiguration.class);
51+
}
4452
}

src/main/java/com/zerofall/ezstorage/integration/ModIds.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@ public enum ModIds {
88
NEI("NotEnoughItems"),
99
ETFUTURUM("etfuturum"),
1010
BAUBLES("Baubles"),
11-
BAUBLESEXPANDED("Baubles|Expanded");
11+
BAUBLESEXPANDED("Baubles|Expanded"),
12+
HODGEPODGE("lawoeju2398");
1213

1314
public final String modId;
14-
private static boolean loaded;
15-
private static boolean loadedCached;
15+
private boolean loaded;
16+
private boolean loadedCached;
1617

1718
ModIds(String modId) {
1819
this.modId = modId;

src/main/java/com/zerofall/ezstorage/proxy/CommonProxy.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import com.zerofall.ezstorage.init.EZBlocks;
99
import com.zerofall.ezstorage.init.EZItems;
1010
import com.zerofall.ezstorage.integration.IntegrationUtils;
11+
import com.zerofall.ezstorage.integration.ModIds;
1112

1213
import cpw.mods.fml.common.FMLCommonHandler;
1314
import cpw.mods.fml.common.event.FMLInitializationEvent;
@@ -43,5 +44,12 @@ public void init(EZStorage instance, FMLInitializationEvent event) {
4344

4445
// Register integrations
4546
IntegrationUtils.init();
47+
48+
// Set maxItemTypes
49+
if (EZConfiguration.maxItemTypesAutoMode) {
50+
EZConfiguration.maxItemTypes = ModIds.HODGEPODGE.isLoaded() ? 65000 : 1000;
51+
EZConfiguration.save();
52+
EZStorage.instance.LOG.info("Automatically set maxItemTypes to " + EZConfiguration.maxItemTypes);
53+
}
4654
}
4755
}

0 commit comments

Comments
 (0)