Java Code Examples for net.minecraftforge.fml.common.Mod#EventHandler

The following examples show how to use net.minecraftforge.fml.common.Mod#EventHandler . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SkyblockAddons.java    From SkyblockAddons with MIT License 5 votes vote down vote up
@Mod.EventHandler
public void postInit(FMLPostInitializationEvent e) {
    onlineData = new Gson().fromJson(new JsonReader(utils.getBufferedReader("data.json")), OnlineData.class);
    configValues.loadValues();
    persistentValues.loadValues();

    setKeyBindingDescriptions();

    usingLabymod = utils.isModLoaded("labymod");
    usingOofModv1 = utils.isModLoaded("refractionoof", "1.0");

    utils.pullOnlineData();
    scheduleMagmaBossCheck();

    for (Feature feature : Feature.values()) {
        if (feature.isGuiFeature()) feature.getSettings().add(EnumUtils.FeatureSetting.GUI_SCALE);
        if (feature.isColorFeature()) feature.getSettings().add(EnumUtils.FeatureSetting.COLOR);
    }

    if (configValues.isEnabled(Feature.FANCY_WARP_MENU)) {
        // Load in these textures so they don't lag the user loading them in later...
        for (IslandWarpGui.Island island : IslandWarpGui.Island.values()) {
            Minecraft.getMinecraft().getTextureManager().bindTexture(island.getResourceLocation());
        }
    }
    Minecraft.getMinecraft().getTextureManager().bindTexture(SkyblockAddonsGui.LOGO);
    Minecraft.getMinecraft().getTextureManager().bindTexture(SkyblockAddonsGui.LOGO_GLOW);
}
 
Example 2
Source File: GokiStats.java    From GokiStats with MIT License 5 votes vote down vote up
@Mod.EventHandler
public void serverStart(FMLServerStartingEvent event) {
    MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance();
    ICommandManager command = server.getCommandManager();
    ServerCommandManager serverCommand = (ServerCommandManager) command;
    serverCommand.registerCommand(new StatsCommand());
    // TODO notice it's a reversion
}
 
Example 3
Source File: ValkyrienSkiesMod.java    From Valkyrien-Skies with Apache License 2.0 5 votes vote down vote up
@Mod.EventHandler
public void onFingerprintViolation(FMLFingerprintViolationEvent event) {
    if (MixinLoaderForge.isObfuscatedEnvironment) { //only print signature warning in obf
        FMLLog.bigWarning(
            "Valkyrien Skies JAR fingerprint corrupted, which means this copy of the mod "
                + "may have come from unofficial sources. Please check out our official website: "
                + "https://valkyrienskies.org");
    }
}
 
Example 4
Source File: GokiStats.java    From GokiStats with MIT License 5 votes vote down vote up
@Mod.EventHandler
public void construct(FMLConstructionEvent event) {
    try {
        for (Class<?> clz : loadClasses)
            Class.forName(clz.getName());
    } catch (ClassNotFoundException e) {
        log.warn("Cannot load classes, this may cause some issues", e);
    }
}
 
Example 5
Source File: GTMod.java    From GT-Classic with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Mod.EventHandler
public void init(FMLInitializationEvent e) {
	GTMaterialElement.init();
	GTRecipeIterators.init();
	GTTileCentrifuge.init();
	GTTileUUMAssembler.init();
	GTTileMagicEnergyConverter.init();
	GTRecipe.initShapeless();
	GTRecipe.initItems();
	GTRecipe.initBlocks();
	GTRecipe.initIC2();
	GTRecipe.initIC2Circuits();
	GTRecipe.initIC2Jetpacks();
	GTRecipe.initIC2Overrides();
	GTRecipe.initProcessing();
	GTBedrockOreHandler.bedrockOresInit();
	GameRegistry.registerWorldGenerator(new GTWorldGen(), 0);
	MinecraftForge.EVENT_BUS.register(new GTEventOnLivingFall());
	MinecraftForge.EVENT_BUS.register(new GTEventLootTableLoad());
	MinecraftForge.EVENT_BUS.register(new GTEventCheckSpawn());
	MinecraftForge.EVENT_BUS.register(new GTEventEntityViewRenderEvent());
	MinecraftForge.EVENT_BUS.register(new GTEventPopulateChunk());
	MinecraftForge.EVENT_BUS.register(new GTEventItemTooltip());
	if (!Loader.isModLoaded(GTValues.MOD_ID_FASTLEAF)) {
		MinecraftForge.EVENT_BUS.register(new GTEventNeighborNotifyEvent());
	}
	MinecraftForge.TERRAIN_GEN_BUS.register(new GTEventDecorateBiome());
	IC2.saveManager.registerGlobal("IDSU_Storage", GTIDSUStorageManager.class, false);
	proxy.init(e);
}
 
Example 6
Source File: I18nUpdateMod.java    From I18nUpdateMod with MIT License 5 votes vote down vote up
@Mod.EventHandler
public void construct(FMLConstructionEvent event) {
    // 国际化检查
    if (I18nConfig.internationalization.openI18n && !isChinese()) {
        return;
    }

    DownloadInfoHelper.init();

    // 设置中文
    if (I18nConfig.download.setupChinese) {
        setupLang();
    }

    if (!I18nConfig.download.shouldDownload) {
        return;
    }

    ResourcePackBuilder builder = new ResourcePackBuilder();
    boolean needUpdate = builder.checkUpdate();
    ResourcePackInstaller.setResourcesRepository();

    if (needUpdate) {
        String localPath;
        try {
            localPath = new File(I18nUtils.getLocalRepositoryFolder(I18nConfig.download.localRepoPath), "I18nRepo").getPath();
        } catch (IllegalArgumentException e) {
            shouldDisplayErrorScreen = true;
            return;
        }
        ResourcePackRepository repo = new ResourcePackRepository(localPath, builder.getAssetDomains());
        RepoUpdateManager updateManager = new RepoUpdateManager(repo);
        updateManager.update();
        if (updateManager.getStatus() == DownloadStatus.SUCCESS) {
            builder.updateAllNeededFilesFromRepo(repo);
            builder.touch();
            ShowNoticeFirst.shouldShowNotice = true;
        }
    }
}
 
Example 7
Source File: ValkyrienSkiesControl.java    From Valkyrien-Skies with Apache License 2.0 5 votes vote down vote up
@Mod.EventHandler
public void init(FMLInitializationEvent event) {
    registerTileEntities();
    registerNetworks();
    registerCapabilities();
    proxy.init(event);
}
 
Example 8
Source File: NovaMinecraft.java    From NOVA-Core with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Mod.EventHandler
public void serverStopping(FMLServerStoppingEvent event) {
	Game.events().publish(new ServerEvent.Stop());
}
 
Example 9
Source File: NovaMinecraft.java    From NOVA-Core with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Mod.EventHandler
public void serverStopping(FMLServerStoppingEvent event) {
	Game.events().publish(new ServerEvent.Stop());
}
 
Example 10
Source File: Wizardry.java    From Wizardry with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Mod.EventHandler
public void serverLoad(FMLServerStartingEvent event) {
    event.registerServerCommand(new CommandWizardry());
}
 
Example 11
Source File: ForgeMain.java    From FastAsyncWorldedit with GNU General Public License v3.0 4 votes vote down vote up
@Mod.EventHandler
public void serverLoad(FMLServerStartingEvent event) {
    IMP.insertCommands();
}
 
Example 12
Source File: ForgeMain.java    From FastAsyncWorldedit with GNU General Public License v3.0 4 votes vote down vote up
@Mod.EventHandler
public void serverLoad(FMLServerStartingEvent event) {
    for (Map.Entry<String, FaweCommand> entry : IMP.getCommands().entrySet()) {
        event.registerServerCommand(new ForgeCommand(entry.getKey(), entry.getValue()));
    }
}
 
Example 13
Source File: LogisticsPipes2.java    From Logistics-Pipes-2 with MIT License 4 votes vote down vote up
@Mod.EventHandler
public void postInit(FMLPostInitializationEvent event){
	proxy.postInit(event);
}
 
Example 14
Source File: I18nUpdateMod.java    From I18nUpdateMod with MIT License 4 votes vote down vote up
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent event) {
    if (shouldDisplayErrorScreen) {
        throw new I18nUtils.InvalidPathConfigurationException();
    }
}
 
Example 15
Source File: EmergingTechnology.java    From EmergingTechnology with MIT License 4 votes vote down vote up
@Mod.EventHandler
public void postInit(FMLPostInitializationEvent event) {
  proxy.postInit(event);
}
 
Example 16
Source File: ForgeMain.java    From FastAsyncWorldedit with GNU General Public License v3.0 4 votes vote down vote up
@Mod.EventHandler
public void serverStopping(FMLServerStoppingEvent event) {
    for (EntityPlayerMP player : FMLCommonHandler.instance().getMinecraftServerInstance().getPlayerList().getPlayers()) {
        handleQuit(player);
    }
}
 
Example 17
Source File: ForgeMain.java    From FastAsyncWorldedit with GNU General Public License v3.0 4 votes vote down vote up
@Mod.EventHandler
public void serverLoad(FMLServerStartingEvent event) {
    for (Map.Entry<String, FaweCommand> entry : IMP.getCommands().entrySet()) {
        event.registerServerCommand(new ForgeCommand(entry.getKey(), entry.getValue()));
    }
}
 
Example 18
Source File: ForgeMain.java    From FastAsyncWorldedit with GNU General Public License v3.0 4 votes vote down vote up
@Mod.EventHandler
public void serverStopping(FMLServerStoppingEvent event) {
    for (EntityPlayerMP player : (List<EntityPlayerMP>)FMLCommonHandler.instance().getMinecraftServerInstance().getPlayerList().getPlayerList()) {
        handleQuit(player);
    }
}
 
Example 19
Source File: TraverseMod.java    From Traverse-Legacy-1-12-2 with MIT License 4 votes vote down vote up
@Mod.EventHandler
public void postInit(FMLPostInitializationEvent event) {
    proxy.postInit(event);
}
 
Example 20
Source File: ProductionLine.java    From Production-Line with MIT License 4 votes vote down vote up
@Mod.EventHandler
public void postInit(FMLPostInitializationEvent event) {
    //register Event. 注册事件
    MinecraftForge.EVENT_BUS.register(new PLEvent());
}