Search in sources :

Example 1 with QueuedTasks

use of logisticspipes.ticks.QueuedTasks 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);
    }
}
Also used : SpecialPipeConnection(logisticspipes.proxy.specialconnection.SpecialPipeConnection) MachineProgressProvider(logisticspipes.proxy.progressprovider.MachineProgressProvider) LPChatListener(logisticspipes.commands.chathelper.LPChatListener) InventoryUtilFactory(logisticspipes.utils.InventoryUtilFactory) RouterManager(logisticspipes.routing.RouterManager) ChannelManagerProvider(logisticspipes.routing.channels.ChannelManagerProvider) SpecialTankHandler(logisticspipes.proxy.specialtankhandler.SpecialTankHandler) ClientPacketBufferHandlerThread(logisticspipes.ticks.ClientPacketBufferHandlerThread) ServerPacketBufferHandlerThread(logisticspipes.ticks.ServerPacketBufferHandlerThread) RoutingTableUpdateThread(logisticspipes.ticks.RoutingTableUpdateThread) LogisticsManager(logisticspipes.logistics.LogisticsManager) LPTickHandler(logisticspipes.ticks.LPTickHandler) QueuedTasks(logisticspipes.ticks.QueuedTasks) FMLServerStartedEvent(net.minecraftforge.fml.common.event.FMLServerStartedEvent) RoutedItemHelper(logisticspipes.utils.RoutedItemHelper) NewGuiHandler(logisticspipes.network.NewGuiHandler) GuiHandler(logisticspipes.network.GuiHandler) Method(java.lang.reflect.Method) SpecialTileConnection(logisticspipes.proxy.specialconnection.SpecialTileConnection) RenderTickHandler(logisticspipes.ticks.RenderTickHandler) TankUtilFactory(logisticspipes.utils.TankUtilFactory)

Aggregations

Method (java.lang.reflect.Method)1 LPChatListener (logisticspipes.commands.chathelper.LPChatListener)1 LogisticsManager (logisticspipes.logistics.LogisticsManager)1 GuiHandler (logisticspipes.network.GuiHandler)1 NewGuiHandler (logisticspipes.network.NewGuiHandler)1 MachineProgressProvider (logisticspipes.proxy.progressprovider.MachineProgressProvider)1 SpecialPipeConnection (logisticspipes.proxy.specialconnection.SpecialPipeConnection)1 SpecialTileConnection (logisticspipes.proxy.specialconnection.SpecialTileConnection)1 SpecialTankHandler (logisticspipes.proxy.specialtankhandler.SpecialTankHandler)1 RouterManager (logisticspipes.routing.RouterManager)1 ChannelManagerProvider (logisticspipes.routing.channels.ChannelManagerProvider)1 ClientPacketBufferHandlerThread (logisticspipes.ticks.ClientPacketBufferHandlerThread)1 LPTickHandler (logisticspipes.ticks.LPTickHandler)1 QueuedTasks (logisticspipes.ticks.QueuedTasks)1 RenderTickHandler (logisticspipes.ticks.RenderTickHandler)1 RoutingTableUpdateThread (logisticspipes.ticks.RoutingTableUpdateThread)1 ServerPacketBufferHandlerThread (logisticspipes.ticks.ServerPacketBufferHandlerThread)1 InventoryUtilFactory (logisticspipes.utils.InventoryUtilFactory)1 RoutedItemHelper (logisticspipes.utils.RoutedItemHelper)1 TankUtilFactory (logisticspipes.utils.TankUtilFactory)1