net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext Java Examples

The following examples show how to use net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext. 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: MiningGadgets.java    From MiningGadgets with MIT License 6 votes vote down vote up
public MiningGadgets() {
    IEventBus event = FMLJavaModLoadingContext.get().getModEventBus();

    // Register all of our items, blocks, item blocks, etc
    ModItems.ITEMS.register(event);
    ModItems.UPGRADE_ITEMS.register(event);
    ModBlocks.BLOCKS.register(event);
    ModBlocks.TILES_ENTITIES.register(event);
    ModContainers.CONTAINERS.register(event);

    event.addListener(this::setup);
    event.addListener(this::setupClient);

    ModLoadingContext.get().registerConfig(ModConfig.Type.CLIENT, Config.CLIENT_CONFIG);
    ModLoadingContext.get().registerConfig(ModConfig.Type.COMMON, Config.COMMON_CONFIG);

    // Register the setup method for modloading
    event.addListener(this::setup);
    MinecraftForge.EVENT_BUS.register(this);

    Config.loadConfig(Config.CLIENT_CONFIG, FMLPaths.CONFIGDIR.get().resolve(MOD_ID + "-client.toml"));
    Config.loadConfig(Config.COMMON_CONFIG, FMLPaths.CONFIGDIR.get().resolve(MOD_ID + "-common.toml"));
}
 
Example #2
Source File: SurvivalistMod.java    From Survivalist with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
public SurvivalistMod()
{
    instance = this;

    ModLoadingContext modLoadingContext = ModLoadingContext.get();
    IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus();

    HELPER.subscribeEvents(modEventBus);
    SurvivalistBlocks.HELPER.subscribeEvents(modEventBus);
    SurvivalistItems.HELPER.subscribeEvents(modEventBus);
    SurvivalistTileEntityTypes.HELPER.subscribeEvents(modEventBus);

    modEventBus.addGenericListener(ContainerType.class, this::registerContainers);
    modEventBus.addGenericListener(IRecipeSerializer.class, this::registerRecipeSerializers);
    modEventBus.addGenericListener(GlobalLootModifierSerializer.class, this::lootModifiers);
    modEventBus.addListener(this::commonSetup);
    modEventBus.addListener(this::clientSetup);
    modEventBus.addListener(this::gatherData);

    MinecraftForge.EVENT_BUS.addListener(this::serverStarting);

    modLoadingContext.registerConfig(ModConfig.Type.SERVER, ConfigManager.SERVER_SPEC);
}
 
Example #3
Source File: Patchwork.java    From patchwork-api with GNU Lesser General Public License v2.1 5 votes vote down vote up
private static void dispatch(Map<ForgeInitializer, FMLModContainer> mods, Function<ModContainer, Event> provider) {
	for (FMLModContainer container : mods.values()) {
		ModLoadingContext.get().setActiveContainer(container, new FMLJavaModLoadingContext(container));

		container.getEventBus().post(provider.apply(container));

		ModLoadingContext.get().setActiveContainer(null, "minecraft");
	}
}
 
Example #4
Source File: CodeChickenLib.java    From CodeChickenLib with GNU Lesser General Public License v2.1 5 votes vote down vote up
public CodeChickenLib() {
    proxy = DistExecutor.runForDist(() -> ProxyClient::new, () -> Proxy::new);
    FMLJavaModLoadingContext.get().getModEventBus().register(this);
    DistExecutor.runWhenOn(Dist.CLIENT, () -> () -> {
        FMLJavaModLoadingContext.get().getModEventBus().addListener(OpenGLUtils::onModelRegistryEvent);
    });
}
 
Example #5
Source File: XRay.java    From XRay-Mod with GNU General Public License v3.0 5 votes vote down vote up
public XRay() {
	IEventBus eventBus = FMLJavaModLoadingContext.get().getModEventBus();

	eventBus.addListener(this::onSetup);
	eventBus.addListener(this::onLoadComplete);
	eventBus.addListener(this::onExit);

	ModLoadingContext.get().registerConfig(ModConfig.Type.CLIENT, Configuration.SPEC);

	// Keybindings
	MinecraftForge.EVENT_BUS.register(KeyBindings.class);
}
 
Example #6
Source File: BleachHack.java    From bleachhack-1.14 with GNU General Public License v3.0 4 votes vote down vote up
public BleachHack() {
	FMLJavaModLoadingContext.get().getModEventBus().addListener(this::init);
    MinecraftForge.EVENT_BUS.register(this);
    MinecraftForge.EVENT_BUS.register(new ScreenInjector());
}
 
Example #7
Source File: ForgeSparkMod.java    From spark with GNU General Public License v3.0 4 votes vote down vote up
public ForgeSparkMod() {
    FMLJavaModLoadingContext.get().getModEventBus().register(this);
    MinecraftForge.EVENT_BUS.register(this);
    ModLoadingContext.get().registerExtensionPoint(ExtensionPoint.DISPLAYTEST, () -> Pair.of(() -> FMLNetworkConstants.IGNORESERVERONLY, (a, b) -> true));
}
 
Example #8
Source File: EnderStorage.java    From EnderStorage with MIT License 4 votes vote down vote up
public EnderStorage() {
    proxy = DistExecutor.runForDist(() -> ProxyClient::new, () -> Proxy::new);
    FMLJavaModLoadingContext.get().getModEventBus().register(this);
    EnderStorageConfig.load();
}
 
Example #9
Source File: ModelRegistryHelper.java    From CodeChickenLib with GNU Lesser General Public License v2.1 4 votes vote down vote up
public ModelRegistryHelper() {
    FMLJavaModLoadingContext.get().getModEventBus().register(this);
}
 
Example #10
Source File: MultiRegistryHelper.java    From CodeChickenLib with GNU Lesser General Public License v2.1 4 votes vote down vote up
public MultiRegistryHelper(String modId) {
    this(modId, FMLJavaModLoadingContext.get().getModEventBus());
}
 
Example #11
Source File: SpriteRegistryHelper.java    From CodeChickenLib with GNU Lesser General Public License v2.1 4 votes vote down vote up
public SpriteRegistryHelper() {
    this(FMLJavaModLoadingContext.get().getModEventBus());
}