use of logisticspipes.ticks.RoutingTableUpdateThread in project LogisticsPipes by RS485.
the class LogisticsPipes method init.
@Mod.EventHandler
public void init(FMLInitializationEvent event) {
// TODO data fileS!!!!!
registerRecipes();
// Register Network channels
MainProxy.createChannels();
RouterManager manager = new RouterManager();
SimpleServiceLocator.setRouterManager(manager);
SimpleServiceLocator.setChannelConnectionManager(manager);
SimpleServiceLocator.setSecurityStationManager(manager);
SimpleServiceLocator.setLogisticsManager(new LogisticsManager());
SimpleServiceLocator.setInventoryUtilFactory(new InventoryUtilFactory());
SimpleServiceLocator.setTankUtilFactory(new TankUtilFactory());
SimpleServiceLocator.setSpecialConnectionHandler(new SpecialPipeConnection());
SimpleServiceLocator.setSpecialConnectionHandler(new SpecialTileConnection());
SimpleServiceLocator.setSpecialTankHandler(new SpecialTankHandler());
SimpleServiceLocator.setMachineProgressProvider(new MachineProgressProvider());
SimpleServiceLocator.setRoutedItemHelper(new RoutedItemHelper());
SimpleServiceLocator.setChannelManagerProvider(new ChannelManagerProvider());
NetworkRegistry.INSTANCE.registerGuiHandler(LogisticsPipes.instance, new GuiHandler());
MinecraftForge.EVENT_BUS.register(new LPTickHandler());
if (event.getSide().equals(Side.CLIENT)) {
RenderTickHandler sub = new RenderTickHandler();
MinecraftForge.EVENT_BUS.register(sub);
}
MinecraftForge.EVENT_BUS.register(new QueuedTasks());
if (event.getSide() == Side.CLIENT) {
SimpleServiceLocator.setClientPacketBufferHandlerThread(new ClientPacketBufferHandlerThread());
}
SimpleServiceLocator.setServerPacketBufferHandlerThread(new ServerPacketBufferHandlerThread());
for (int i = 0; i < Configs.MULTI_THREAD_NUMBER; i++) {
new RoutingTableUpdateThread(i);
}
MinecraftForge.EVENT_BUS.register(new LogisticsEventListener());
MinecraftForge.EVENT_BUS.register(new LPChatListener());
MinecraftForge.EVENT_BUS.register(PropertyUpdaterEventListener.INSTANCE);
LPDataFixer.INSTANCE.init();
if (event.getSide() == Side.SERVER) {
LogisticsPipes.textures.registerBlockIcons(null);
} else if (event.getSide() == Side.CLIENT) {
LPFontRenderer.Factory.asyncPreload();
}
// load all the models so they don't get loaded and crash on concurrent class loading
// the OBJParser is a non-sharable static thing
LogisticsNewRenderPipe.loadModels();
LogisticsNewSolidBlockWorldRenderer.loadModels();
CurveTubeRenderer.loadModels();
GainTubeRenderer.loadModels();
LineTubeRenderer.loadModels();
SpeedupTubeRenderer.loadModels();
SCurveTubeRenderer.loadModels();
if (isTesting()) {
final Class<?> testClass;
try {
testClass = Class.forName("network.rs485.logisticspipes.integration.MinecraftTest");
} catch (ReflectiveOperationException e) {
throw new RuntimeException("Error loading minecraft test class", e);
}
final Object minecraftTestInstance;
try {
minecraftTestInstance = testClass.getDeclaredField("INSTANCE").get(null);
final Method serverStartMethod = testClass.getDeclaredMethod("serverStart", FMLServerStartedEvent.class);
minecraftTestStartMethod = (FMLServerStartedEvent serverStartedEvent) -> {
try {
serverStartMethod.invoke(minecraftTestInstance, serverStartedEvent);
} catch (ReflectiveOperationException e) {
throw new RuntimeException("Could not run server started hook in " + minecraftTestInstance, e);
}
};
} catch (ReflectiveOperationException e) {
throw new RuntimeException("Error accessing minecraft test instance", e);
}
MinecraftForge.EVENT_BUS.register(minecraftTestInstance);
}
}
Aggregations