equivalent-exchange-3/src/main/java/com/pahimar/ee3/reference/Files.java
Pahimar f41b0279a6 Added some more NPE protection to the ID based ItemStack comparator
Added back in the small and medium sized Alchemical Chest aludel recipes
Added a recipe to make a chalk block from 4 pieces of chalk
Created an EE test suite to test EE specific energy values
Re-registered several EE items
Removed a duplicate Gson type adapter registration
Changed the ItemStackSerializer to return JsonNull in the event that there is no registered name for the item (the item would never deserialize as it wouldn't have a name to lookup)
Changed the EnergyValueMapSerializer to allow serializing of null energy values (as JsonNull). Used for energy value testing.
2016-05-26 12:02:37 -04:00

55 lines
3 KiB
Java

package com.pahimar.ee3.reference;
import com.pahimar.ee3.blacklist.BlacklistRegistry;
import com.pahimar.ee3.exchange.EnergyValueRegistry;
import com.pahimar.ee3.knowledge.PlayerKnowledgeRegistry;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import java.io.File;
public class Files {
public static File globalDataDirectory;
public static File globalTestDirectory;
public static File playerDataDirectory;
private static final String ENERGY_VALUES_JSON_FILENAME = "energy-values.json";
private static final String PRE_CALCULATION_ENERGY_VALUES_FILENAME = "pre-calculation-energy-values.json";
private static final String POST_CALCULATION_ENERGY_VALUES_FILENAME = "post-calculation-energy-values.json";
public static final String TEMPLATE_PLAYER_KNOWLEDGE_FILENAME = "template-player-knowledge.json";
public static final String KNOWLEDGE_BLACKLIST_FILENAME = "knowledge-blacklist.json";
public static final String EXCHANGE_BLACKLIST_FILENAME = "exchange-blacklist.json";
public static void init(FMLPreInitializationEvent event) {
globalDataDirectory = new File(event.getModConfigurationDirectory().getParentFile(), "data" + File.separator + Reference.LOWERCASE_MOD_ID);
globalTestDirectory = new File(globalDataDirectory, "tests");
globalTestDirectory.mkdirs();
EnergyValueRegistry.energyValuesDirectory = new File(globalDataDirectory, "energy-values");
EnergyValueRegistry.energyValuesDirectory.mkdirs();
EnergyValueRegistry.energyValuesFile = new File(EnergyValueRegistry.energyValuesDirectory, ENERGY_VALUES_JSON_FILENAME);
EnergyValueRegistry.preCalculationValuesFile = new File(EnergyValueRegistry.energyValuesDirectory, PRE_CALCULATION_ENERGY_VALUES_FILENAME);
EnergyValueRegistry.postCalculationValuesFile = new File(EnergyValueRegistry.energyValuesDirectory, POST_CALCULATION_ENERGY_VALUES_FILENAME);
File templatePlayerKnowledgeDirectory = new File(globalDataDirectory, "knowledge" + File.separator + "transmutation");
templatePlayerKnowledgeDirectory.mkdirs();
PlayerKnowledgeRegistry.templatePlayerKnowledgeFile = new File(templatePlayerKnowledgeDirectory, TEMPLATE_PLAYER_KNOWLEDGE_FILENAME);
BlacklistRegistry.knowledgeBlacklistFile = new File(globalDataDirectory, "blacklist" + File.separator + KNOWLEDGE_BLACKLIST_FILENAME);
BlacklistRegistry.exchangeBlacklistFile = new File(globalDataDirectory, "blacklist" + File.separator + EXCHANGE_BLACKLIST_FILENAME);
}
/**
* Updates the references to the instance specific EE3 data directories, creating them if they don't already exist
*/
public static void updateFileReferences() {
playerDataDirectory = new File(FMLCommonHandler.instance().getMinecraftServerInstance().getEntityWorld().getSaveHandler().getWorldDirectory(), "playerdata" + File.separator + Reference.LOWERCASE_MOD_ID);
playerDataDirectory.mkdirs();
}
}