net.minecraftforge.fml.common.Mod Java Examples

The following examples show how to use net.minecraftforge.fml.common.Mod. 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 6 votes vote down vote up
@Mod.EventHandler
public void init(FMLInitializationEvent e) {
    MinecraftForge.EVENT_BUS.register(new NetworkListener());
    MinecraftForge.EVENT_BUS.register(playerListener);
    MinecraftForge.EVENT_BUS.register(guiScreenListener);
    MinecraftForge.EVENT_BUS.register(renderListener);
    MinecraftForge.EVENT_BUS.register(scheduler);
    MinecraftForge.EVENT_BUS.register(newScheduler);

    ClientCommandHandler.instance.registerCommand(new SkyblockAddonsCommand());

    addKeybinds(new SkyblockKeyBinding("open_settings", Keyboard.KEY_NONE, Message.SETTING_SETTINGS),
            new SkyblockKeyBinding( "edit_gui", Keyboard.KEY_NONE, Message.SETTING_EDIT_LOCATIONS),
            new SkyblockKeyBinding( "lock_slot", Keyboard.KEY_L, Message.SETTING_LOCK_SLOT),
            new SkyblockKeyBinding( "freeze_backpack", Keyboard.KEY_F, Message.SETTING_FREEZE_BACKPACK_PREVIEW));
}
 
Example #2
Source File: GTMod.java    From GT-Classic with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Mod.EventHandler
public synchronized void preInit(FMLPreInitializationEvent event) {
	logger = event.getModLog();
	proxy.preInit(event);
	logger.info("Hello from GregTech Classic!");
	GTBlocks.registerTiles();
	GTMaterialGen.initFlags();
	GTMaterialGen.init();
	GTBlocks.registerBlocks();
	GTItems.initItems();
	GTItems.registerItems();
	GTCrops.init();
	GTOreDict.init();
	GTEventLootTableLoad.init();
	MinecraftForge.EVENT_BUS.register(GTSounds.class);
}
 
Example #3
Source File: I18nUpdateMod.java    From I18nUpdateMod with MIT License 6 votes vote down vote up
@Mod.EventHandler
public void init(FMLInitializationEvent event) {
    // 国际化检查
    if (I18nConfig.internationalization.openI18n && !isChinese()) {
        return;
    }

    // 命令注册
    ClientCommandHandler.instance.registerCommand(new CmdNotice());
    ClientCommandHandler.instance.registerCommand(new CmdReport());
    ClientCommandHandler.instance.registerCommand(new CmdReload());
    ClientCommandHandler.instance.registerCommand(new CmdGetLangpack());
    ClientCommandHandler.instance.registerCommand(new CmdUpload());
    ClientCommandHandler.instance.registerCommand(new CmdToken());

    // 热键注册
    if (!I18nConfig.key.closedKey) {
        MinecraftForge.EVENT_BUS.register(new HotKeyHandler());
    }
}
 
Example #4
Source File: BakaDanmaku.java    From BakaDanmaku with MIT License 6 votes vote down vote up
@Mod.EventHandler
public void init(FMLInitializationEvent event) {
    // 装载各大平台的弹幕线程
    DanmakuThreadFactory.setDanmakuThread("bilibili", new BilibiliDanmakuThread());
    DanmakuThreadFactory.setDanmakuThread("douyu", new DouyuDanmakuThread());
    DanmakuThreadFactory.setDanmakuThread("chushou", new ChushouDanmakuThread());

    // 注册开启,关闭弹幕事件处理器
    MinecraftForge.EVENT_BUS.register(StartStopHandler.class);

    // 注册聊天事件处理器
    MinecraftForge.EVENT_BUS.register(ChatMsgHandler.class);

    // 注册屏幕信息事件处理器
    // TODO: MinecraftForge.EVENT_BUS.register(ScreenMsgHandler.class);

    // 客户端命令注册
    ClientCommandHandler.instance.registerCommand(new CommandBakaDM());
}
 
Example #5
Source File: NovaMinecraft.java    From NOVA-Core with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Mod.EventHandler
public void init(FMLInitializationEvent evt) {
	try {
		proxy.init(evt);
		nativeConverters.stream().forEachOrdered(forgeLoadable -> forgeLoadable.init(evt));
		int size = novaModWrappers.size() + novaWrappers.size();
		if (size > 0) {
			ProgressManager.ProgressBar progressBar = ProgressManager.push("Initializing NOVA wrappers", size);
			FMLProgressBar fmlProgressBar = new FMLProgressBar(progressBar);
			novaModWrappers.stream().forEachOrdered(wrapper -> {
				fmlProgressBar.step(wrapper.getClass());
				wrapper.init(evt);
			});
			novaWrappers.stream().forEachOrdered(wrapper -> {
				fmlProgressBar.step(wrapper.getClass());
				wrapper.init(evt);
			});
			fmlProgressBar.finish();
			ProgressManager.pop(progressBar);
		}
	} catch (Exception e) {
		Game.logger().error("Error during init");
		e.printStackTrace();
		throw new InitializationException(e);
	}
}
 
Example #6
Source File: NovaMinecraft.java    From NOVA-Core with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Mod.EventHandler
@Override
@SuppressWarnings("deprecation")
public void init(FMLInitializationEvent evt) {
	try {
		proxy.init(evt);
		nativeConverters.stream().forEachOrdered(forgeLoadable -> forgeLoadable.init(evt));
		net.minecraftforge.fml.common.ProgressManager.ProgressBar progressBar
			= net.minecraftforge.fml.common.ProgressManager.push("Initializing NOVA wrappers",
				(novaModWrappers.isEmpty() ? 1 : novaModWrappers.size()) + novaWrappers.size());
		FMLProgressBar fmlProgressBar = new FMLProgressBar(progressBar);
		novaModWrappers.stream().forEachOrdered(wrapper -> {
			fmlProgressBar.step(wrapper.getClass());
			wrapper.init(evt);
		});
		novaWrappers.stream().forEachOrdered(wrapper -> {
			fmlProgressBar.step(wrapper.getClass());
			wrapper.init(evt);
		});
		fmlProgressBar.finish();
		net.minecraftforge.fml.common.ProgressManager.pop(progressBar);
	} catch (Exception e) {
		Game.logger().error("Error during init", e);
		e.printStackTrace();
		throw new InitializationException(e);
	}
}
 
Example #7
Source File: ForgeMain.java    From FastAsyncWorldedit with GNU General Public License v3.0 5 votes vote down vote up
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent event) {
    this.logger = event.getModLog();
    File directory = new File(event.getModConfigurationDirectory() + File.separator + "FastAsyncWorldEdit");
    MinecraftForge.EVENT_BUS.register(this);
    FMLCommonHandler.instance().bus().register(this);
    this.IMP = new FaweForge(this, event.getModLog(), event.getModMetadata(), directory);
    try {
        Class.forName("org.spongepowered.api.Sponge");
        Settings.IMP.QUEUE.PARALLEL_THREADS = 1;
    } catch (Throwable ignore) {}
}
 
Example #8
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 #9
Source File: LogisticsPipes2.java    From Logistics-Pipes-2 with MIT License 5 votes vote down vote up
@Mod.EventHandler
public void init(FMLInitializationEvent event){
	proxy.init(event);
	LPWorldGen worldGen = new LPWorldGen();
	GameRegistry.registerWorldGenerator(worldGen, 0);
	MinecraftForge.EVENT_BUS.register(worldGen);
}
 
Example #10
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 postInit(FMLPostInitializationEvent e) {
	proxy.postInit(e);
	GTMaterialGen.postInitProperities();
	GTRecipeIterators.postInit();
	GTTileMatterFabricator.postInit();
	GTTileMultiFusionReactor.postInit();
	GTRecipeMods.postInit();
	GTTileDisassembler.init();
	if (GTConfig.modcompat.compatTwilightForest && Loader.isModLoaded(GTValues.MOD_ID_TFOREST)) {
		GTTwilightForestHandler.initStalactites();
	}
}
 
Example #11
Source File: ForgeMain.java    From FastAsyncWorldedit with GNU General Public License v3.0 5 votes vote down vote up
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent event) {
    this.logger = event.getModLog();
    File directory = new File(event.getModConfigurationDirectory() + File.separator + "FastAsyncWorldEdit");
    MinecraftForge.EVENT_BUS.register(this);
    FMLCommonHandler.instance().bus().register(this);
    this.IMP = new FaweForge(this, event.getModLog(), event.getModMetadata(), directory);
    try {
        Class.forName("org.spongepowered.api.Sponge");
        Settings.IMP.QUEUE.PARALLEL_THREADS = 1;
    } catch (Throwable ignore) {}
}
 
Example #12
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 #13
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 #14
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 #15
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 #16
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 #17
Source File: ForgeMain.java    From FastAsyncWorldedit with GNU General Public License v3.0 5 votes vote down vote up
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent event) {
    this.logger = event.getModLog();
    File directory = new File(event.getModConfigurationDirectory() + File.separator + "FastAsyncWorldEdit");
    MinecraftForge.EVENT_BUS.register(this);
    FMLCommonHandler.instance().bus().register(this);
    this.IMP = new FaweForge(this, event.getModLog(), event.getModMetadata(), directory);
    try {
        Class.forName("org.spongepowered.api.Sponge");
        Settings.IMP.QUEUE.PARALLEL_THREADS = 1;
    } catch (Throwable ignore) {}
}
 
Example #18
Source File: ForgeHax.java    From ForgeHax with MIT License 5 votes vote down vote up
@Mod.EventHandler
public void init(FMLInitializationEvent event) {
  if (event.getSide() == Side.CLIENT) {
    // add shutdown hook to serialize all binds
    Runtime.getRuntime()
        .addShutdownHook(new Thread(() -> getModManager().forEach(BaseMod::unload)));
    
    // registerAll mod events
    getModManager().forEach(BaseMod::load);
  }
}
 
Example #19
Source File: FullscreenWindowed.java    From Fullscreen-Windowed-Minecraft with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent event)
{
    //Items and blocks
    if(proxy != null)
        proxy.subscribeEvents(event.getSuggestedConfigurationFile());

}
 
Example #20
Source File: ForgeMain.java    From FastAsyncWorldedit with GNU General Public License v3.0 5 votes vote down vote up
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent event) {
    this.logger = event.getModLog();
    File directory = new File(event.getModConfigurationDirectory() + File.separator + "FastAsyncWorldEdit");
    MinecraftForge.EVENT_BUS.register(this);
    FMLCommonHandler.instance().bus().register(this);
    this.IMP = new FaweForge(this, event.getModLog(), event.getModMetadata(), directory);
    try {
        Class.forName("org.spongepowered.api.Sponge");
        Settings.IMP.QUEUE.PARALLEL_THREADS = 1;
    } catch (Throwable ignore) {}
}
 
Example #21
Source File: ForgeHax.java    From ForgeHax with MIT License 5 votes vote down vote up
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent event) {
  if (event.getSide() == Side.CLIENT) {
    // ---- initialize mods ----//
    getModManager().loadAll();
  }
}
 
Example #22
Source File: ForgeMain.java    From FastAsyncWorldedit with GNU General Public License v3.0 5 votes vote down vote up
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent event) {
    this.logger = event.getModLog();
    File directory = new File(event.getModConfigurationDirectory() + File.separator + "FastAsyncWorldEdit");
    MinecraftForge.EVENT_BUS.register(this);
    FMLCommonHandler.instance().bus().register(this);
    this.IMP = new FaweForge(this, event.getModLog(), event.getModMetadata(), directory);
    try {
        Class.forName("org.spongepowered.api.Sponge");
        Settings.IMP.QUEUE.PARALLEL_THREADS = 1;
    } catch (Throwable ignore) {}
}
 
Example #23
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 #24
Source File: NovaMinecraft.java    From NOVA-Core with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Mod.EventHandler
@Override
@SuppressWarnings("deprecation")
public void postInit(FMLPostInitializationEvent evt) {
	try {
		proxy.postInit(evt);
		nativeConverters.stream().forEachOrdered(forgeLoadable -> forgeLoadable.postInit(evt));
		Game.recipes().init();
		net.minecraftforge.fml.common.ProgressManager.ProgressBar progressBar
			= net.minecraftforge.fml.common.ProgressManager.push("Post-initializing NOVA wrappers",
				(novaModWrappers.isEmpty() ? 1 : novaModWrappers.size()) + novaWrappers.size());
		FMLProgressBar fmlProgressBar = new FMLProgressBar(progressBar);
		novaModWrappers.stream().forEachOrdered(wrapper -> {
			fmlProgressBar.step(wrapper.getClass());
			wrapper.postInit(evt);
		});
		novaWrappers.stream().forEachOrdered(wrapper -> {
			fmlProgressBar.step(wrapper.getClass());
			wrapper.postInit(evt);
		});
		fmlProgressBar.finish();
		net.minecraftforge.fml.common.ProgressManager.pop(progressBar);
	} catch (Exception e) {
		Game.logger().error("Error during postInit", e);
		e.printStackTrace();
		throw new InitializationException(e);
	}
}
 
Example #25
Source File: NotEnoughItems.java    From NotEnoughItems with MIT License 4 votes vote down vote up
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent event) {
    proxy.preInit(event);
    NEIInitialization.scrapeData(event.getAsmData());
    ModDescriptionEnhancer.registerEnhancement(MOD_ID, "NotEnoughItems");
}
 
Example #26
Source File: GokiStats.java    From GokiStats with MIT License 4 votes vote down vote up
@Mod.EventHandler
public void init(FMLInitializationEvent event) {
    proxy.registerHandlers();
    FMLCommonHandler.instance().getDataFixer().registerVanillaWalker(FixTypes.PLAYER, new StatFix());
}
 
Example #27
Source File: GokiStats.java    From GokiStats with MIT License 4 votes vote down vote up
@Mod.EventHandler
public void postInit(FMLPostInitializationEvent event) {
    MinecraftEffects.STRENGTH = ForgeRegistries.POTIONS.getValue(new ResourceLocation("minecraft:strength"));
    MinecraftEffects.JUMP = ForgeRegistries.POTIONS.getValue(new ResourceLocation("minecraft:jump"));
}
 
Example #28
Source File: ProductionLine.java    From Production-Line with MIT License 4 votes vote down vote up
@Mod.EventHandler
public void construct(FMLConstructionEvent event) {
    MinecraftForge.EVENT_BUS.register(INSTANCE);
}
 
Example #29
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());
}
 
Example #30
Source File: GokiStats.java    From GokiStats with MIT License 4 votes vote down vote up
@Mod.EventHandler
public void loadComplete(FMLLoadCompleteEvent event) {
    StatBase.stats.forEach(StatBase::reloadConfig);
    ConfigManager.INSTANCE.reloadConfig();
}