This commit is contained in:
pahimar 2016-05-14 22:11:46 -04:00
parent d5d03c61f6
commit 22c8dee145
3 changed files with 41 additions and 12 deletions

View file

@ -119,7 +119,7 @@ public class EquivalentExchange3
{
CachedOreDictionary.getInstance();
Abilities.initNotLearnables();
NewEnergyValueRegistry.INSTANCE.load();
NewEnergyValueRegistry.INSTANCE.compute();
}
@EventHandler

View file

@ -136,7 +136,7 @@ public class NewEnergyValueRegistry {
.forEach(wrappedStack -> stackValueMap.put(wrappedStack, preCalculationValueMap.get(wrappedStack)));
// Calculate values from the known methods to create items, and the pre-calculation value mappings
// TODO Re-implement DynEMC here
calculate();
// Add in all post-calculation energy value mappings
postCalculationValueMap.keySet().stream()
@ -152,6 +152,35 @@ public class NewEnergyValueRegistry {
save();
}
private void calculate() {
Map<WrappedStack, EnergyValue> computedMap;
int passNumber, passComputed, totalComputed;
passNumber = passComputed = totalComputed = 0;
boolean firstPass = true;
LogHelper.info(ENERGY_VALUE_MARKER, "Beginning energy value calculation");
long startingTime = System.nanoTime();
while ((firstPass || passComputed > 0) && passNumber < 16) {
long passStartTime = System.nanoTime();
passNumber++;
passComputed = 0;
if (firstPass) {
firstPass = false;
}
long passDuration = System.nanoTime() - passStartTime;
// TODO Tie this extra logging into a debug config option
boolean debug = false;
if (debug) {
LogHelper.info(ENERGY_VALUE_MARKER, "Pass {}: Calculated {} values for objects in {} ns", passNumber, passComputed, passDuration);
}
}
long endingTime = System.nanoTime() - startingTime;
LogHelper.info(ENERGY_VALUE_MARKER, "Finished dynamic value calculation (calculated {} values for objects in {} ns)", totalComputed, endingTime);
}
/**
* Saves the pre-calculation, post-calculation, and calculated energy value maps to disk
*/

View file

@ -56,17 +56,17 @@ public class ModItems
GameRegistry.registerItem(knowledgeScroll, Names.Items.KNOWLEDGE_SCROLL);
GameRegistry.registerItem(potionLethe, Names.Items.POTION_LETHE);
GameRegistry.registerItem(shovelDarkMatter, Names.Tools.DARK_MATTER_SHOVEL);
GameRegistry.registerItem(pickAxeDarkMatter, Names.Tools.DARK_MATTER_PICKAXE);
GameRegistry.registerItem(hammerDarkMatter, Names.Tools.DARK_MATTER_HAMMER);
GameRegistry.registerItem(axeDarkMatter, Names.Tools.DARK_MATTER_AXE);
GameRegistry.registerItem(hoeDarkMatter, Names.Tools.DARK_MATTER_HOE);
GameRegistry.registerItem(fishingRodDarkMatter, Names.Tools.DARK_MATTER_FISHING_ROD);
GameRegistry.registerItem(shearsDarkMatter, Names.Tools.DARK_MATTER_SHEARS);
// GameRegistry.registerItem(shovelDarkMatter, Names.Tools.DARK_MATTER_SHOVEL);
// GameRegistry.registerItem(pickAxeDarkMatter, Names.Tools.DARK_MATTER_PICKAXE);
// GameRegistry.registerItem(hammerDarkMatter, Names.Tools.DARK_MATTER_HAMMER);
// GameRegistry.registerItem(axeDarkMatter, Names.Tools.DARK_MATTER_AXE);
// GameRegistry.registerItem(hoeDarkMatter, Names.Tools.DARK_MATTER_HOE);
// GameRegistry.registerItem(fishingRodDarkMatter, Names.Tools.DARK_MATTER_FISHING_ROD);
// GameRegistry.registerItem(shearsDarkMatter, Names.Tools.DARK_MATTER_SHEARS);
GameRegistry.registerItem(bowDarkMatter, Names.Weapons.DARK_MATTER_BOW);
GameRegistry.registerItem(arrowDarkMatter, Names.Weapons.DARK_MATTER_ARROW);
GameRegistry.registerItem(swordDarkMatter, Names.Weapons.DARK_MATTER_SWORD);
// GameRegistry.registerItem(bowDarkMatter, Names.Weapons.DARK_MATTER_BOW);
// GameRegistry.registerItem(arrowDarkMatter, Names.Weapons.DARK_MATTER_ARROW);
// GameRegistry.registerItem(swordDarkMatter, Names.Weapons.DARK_MATTER_SWORD);
// Helm
// Chest