2014-06-19 20:18:04 +02:00
|
|
|
package com.pahimar.ee3.handler;
|
|
|
|
|
2016-05-18 19:53:13 +02:00
|
|
|
import com.pahimar.ee3.exchange.EnergyValueRegistry;
|
2016-05-20 21:57:20 +02:00
|
|
|
import com.pahimar.ee3.knowledge.PlayerKnowledgeRegistry;
|
2016-05-18 19:53:13 +02:00
|
|
|
import com.pahimar.ee3.recipe.AludelRecipeManager;
|
|
|
|
import com.pahimar.ee3.recipe.RecipeRegistry;
|
|
|
|
import com.pahimar.ee3.util.LogHelper;
|
2014-09-04 21:15:16 +02:00
|
|
|
import cpw.mods.fml.common.FMLCommonHandler;
|
2014-06-19 20:18:04 +02:00
|
|
|
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
2014-09-04 21:15:16 +02:00
|
|
|
import cpw.mods.fml.relauncher.Side;
|
2014-06-19 20:18:04 +02:00
|
|
|
import net.minecraftforge.event.world.WorldEvent;
|
|
|
|
|
2016-05-18 19:53:13 +02:00
|
|
|
public class WorldEventHandler {
|
2014-09-16 18:08:16 +02:00
|
|
|
public static boolean hasInitilialized = false;
|
2014-07-14 18:04:20 +02:00
|
|
|
|
2014-06-19 20:18:04 +02:00
|
|
|
@SubscribeEvent
|
2016-05-18 19:53:13 +02:00
|
|
|
public void onWorldLoadEvent(WorldEvent.Load event) {
|
2023-01-03 17:47:36 +01:00
|
|
|
if (!hasInitilialized
|
|
|
|
&& FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER) {
|
2016-05-20 19:56:53 +02:00
|
|
|
RecipeRegistry.INSTANCE.registerVanillaRecipes();
|
2016-05-18 19:53:13 +02:00
|
|
|
AludelRecipeManager.registerRecipes();
|
|
|
|
|
|
|
|
long startTime = System.nanoTime();
|
2023-01-03 17:47:36 +01:00
|
|
|
if (ConfigurationHandler.Settings.regenerateEnergyValuesWhen.equalsIgnoreCase(
|
|
|
|
"As Needed"
|
|
|
|
)) {
|
2016-05-23 05:28:30 +02:00
|
|
|
EnergyValueRegistry.INSTANCE.load();
|
2023-01-03 17:47:36 +01:00
|
|
|
} else {
|
2016-05-23 05:28:30 +02:00
|
|
|
EnergyValueRegistry.INSTANCE.compute();
|
|
|
|
}
|
2023-01-03 17:47:36 +01:00
|
|
|
LogHelper.info(
|
|
|
|
EnergyValueRegistry.ENERGY_VALUE_MARKER,
|
|
|
|
"Energy value system initialized {} values after {} ms",
|
|
|
|
EnergyValueRegistry.INSTANCE.getEnergyValues().size(),
|
|
|
|
(System.nanoTime() - startTime) / 100000
|
|
|
|
);
|
2014-07-14 18:04:20 +02:00
|
|
|
hasInitilialized = true;
|
2016-05-20 21:57:20 +02:00
|
|
|
|
|
|
|
PlayerKnowledgeRegistry.INSTANCE.load();
|
2014-07-14 18:04:20 +02:00
|
|
|
}
|
2014-06-19 20:18:04 +02:00
|
|
|
}
|
|
|
|
}
|