equivalent-exchange-3/src/main/java/com/pahimar/ee3/handler/WorldEventHandler.java

43 lines
1.6 KiB
Java
Raw Normal View History

package com.pahimar.ee3.handler;
import com.pahimar.ee3.exchange.EnergyValueRegistry;
import com.pahimar.ee3.knowledge.PlayerKnowledgeRegistry;
import com.pahimar.ee3.recipe.AludelRecipeManager;
import com.pahimar.ee3.recipe.RecipeRegistry;
import com.pahimar.ee3.util.LogHelper;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.relauncher.Side;
import net.minecraftforge.event.world.WorldEvent;
public class WorldEventHandler {
public static boolean hasInitilialized = false;
@SubscribeEvent
public void onWorldLoadEvent(WorldEvent.Load event) {
2023-01-03 17:47:36 +01:00
if (!hasInitilialized
&& FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER) {
RecipeRegistry.INSTANCE.registerVanillaRecipes();
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
);
hasInitilialized = true;
PlayerKnowledgeRegistry.INSTANCE.load();
}
}
}