Search in sources :

Example 1 with SpongeEventHooks

use of org.spongepowered.mod.event.SpongeEventHooks in project SpongeForge by SpongePowered.

the class SpongeMod method onPreInit.

@Subscribe
public void onPreInit(FMLPreInitializationEvent event) {
    try {
        SpongeImpl.getGame().getEventManager().registerListeners(SpongeImpl.getPlugin().getInstance().get(), SpongeInternalListeners.getInstance());
        registerService(ChunkTicketManager.class, new SpongeChunkTicketManager());
        SpongeBootstrap.initializeServices();
        SpongeBootstrap.initializeCommands();
        SpongeImpl.getRegistry().preInit();
        SpongeModMessageHandler.init();
        Preconditions.checkArgument(Class.forName("org.spongepowered.api.entity.ai.task.AbstractAITask").getSuperclass().equals(SpongeEntityAICommonSuperclass.class));
        MinecraftForge.EVENT_BUS.register(new SpongeEventHooks());
        SpongeInternalListeners.getInstance().registerServiceCallback(PermissionService.class, input -> input.registerContextCalculator(new SpongeContextCalculator()));
        // Add the SyncScheduler as a listener for ServerTickEvents
        MinecraftForge.EVENT_BUS.register(this);
        MinecraftForge.EVENT_BUS.register(this.game.getChannelRegistrar());
        if (event.getSide().isServer()) {
            SpongeHooks.enableThreadContentionMonitoring();
        }
    } catch (Throwable t) {
        this.controller.errorOccurred(this, t);
    }
}
Also used : SpongeContextCalculator(org.spongepowered.common.service.permission.SpongeContextCalculator) SpongeChunkTicketManager(org.spongepowered.mod.service.world.SpongeChunkTicketManager) SpongeEventHooks(org.spongepowered.mod.event.SpongeEventHooks) SpongeEntityAICommonSuperclass(org.spongepowered.common.entity.ai.SpongeEntityAICommonSuperclass) Subscribe(com.google.common.eventbus.Subscribe)

Aggregations

Subscribe (com.google.common.eventbus.Subscribe)1 SpongeEntityAICommonSuperclass (org.spongepowered.common.entity.ai.SpongeEntityAICommonSuperclass)1 SpongeContextCalculator (org.spongepowered.common.service.permission.SpongeContextCalculator)1 SpongeEventHooks (org.spongepowered.mod.event.SpongeEventHooks)1 SpongeChunkTicketManager (org.spongepowered.mod.service.world.SpongeChunkTicketManager)1