net.minecraftforge.fml.common.event.FMLPreInitializationEvent Java Examples

The following examples show how to use net.minecraftforge.fml.common.event.FMLPreInitializationEvent. 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: CustomMainMenu.java    From Custom-Main-Menu with MIT License 7 votes vote down vote up
@EventHandler
public void preInit(FMLPreInitializationEvent event)
{
	configFolder = event.getModConfigurationDirectory();
	config = new Config();
	// Load Transparent
	transparentTexture = new ResourceLocation("custommainmenu:textures/gui/transparent.png");

	EVENT_HANDLER = new CMMEventHandler();
	MinecraftForge.EVENT_BUS.register(EVENT_HANDLER);
	FMLCommonHandler.instance().bus().register(EVENT_HANDLER);

	logger = event.getModLog();

	configLoader = new ConfigurationLoader(config);

	try
	{
		configLoader.load();
	}
	catch (Exception e)
	{
		logger.log(Level.ERROR, "Error while loading config file. Will have to crash here :(.");
		throw new RuntimeException(e);
	}
}
 
Example #2
Source File: RenderUtility.java    From NOVA-Core with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public void preInit(FMLPreInitializationEvent event) {
	//Load models
	Game.render().modelProviders.forEach(m -> {
		ResourceLocation resource = new ResourceLocation(m.domain, "models/" + m.name + "." + m.getType());
		try {
			IResource res = Minecraft.getMinecraft().getResourceManager().getResource(resource);
			m.load(res.getInputStream());
		} catch (IOException e) {
			throw new RuntimeException("IO Exception reading model format", e);
		}
	});
}
 
Example #3
Source File: MooFluids.java    From Moo-Fluids with GNU General Public License v3.0 6 votes vote down vote up
@Mod.EventHandler
public static void preInit(FMLPreInitializationEvent event) {
  ConfigurationHandler.setConfigFile(event.getSuggestedConfigurationFile());
  ConfigurationHandler.init();
  ConfigurationHandler.updateGlobalConfiguration();
  proxy.initContainableFluids();
  ConfigurationHandler.updateFluidConfiguration();
  proxy.registerEntities();
  proxy.registerEntitySpawns();
  proxy.registerEventHandlers();

  if (ModInformation.DEBUG_MODE) {
    LogHelper.info(String.format("Finished pre-initialisation stage for %s",
                                 ModInformation.MOD_ID));
  }
}
 
Example #4
Source File: ClientProxy.java    From Wizardry with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public void preInit(FMLPreInitializationEvent event) {
	super.preInit(event);

	if (ConfigValues.versionCheckerEnabled)
		VersionChecker.register();

	ModEntities.initModels();

	CustomBlockMapSprites.INSTANCE.register(new ResourceLocation(Wizardry.MODID, "blocks/mana_crystal_ring"));
	CustomBlockMapSprites.INSTANCE.register(new ResourceLocation(Wizardry.MODID, "blocks/mana_crystal_ring_outer"));
	CustomBlockMapSprites.INSTANCE.register(new ResourceLocation(Wizardry.MODID, "blocks/mana_crystal"));
	CustomBlockMapSprites.INSTANCE.register(new ResourceLocation(Wizardry.MODID, "blocks/outputPearl"));
	CustomBlockMapSprites.INSTANCE.register(new ResourceLocation(Wizardry.MODID, "blocks/mana_orb"));
	CustomBlockMapSprites.INSTANCE.register(new ResourceLocation(Wizardry.MODID, "blocks/mana_pearl_cube"));
	CustomBlockMapSprites.INSTANCE.register(new ResourceLocation(Wizardry.MODID, "blocks/nacre_pearl_cube"));

	// Load and bake the 2D models
	ModelBakery.registerItemVariants(ModItems.BOOK, new ModelResourceLocation("wizardry:book", "inventory"));
	ModelResourceLocation default3dPath = new ModelResourceLocation("wizardry:book", "inventory");
	ModelLoader.setCustomMeshDefinition(ModItems.BOOK, stack -> default3dPath);

	ModKeybinds.register();
}
 
Example #5
Source File: ClientProxy.java    From Valkyrien-Skies with Apache License 2.0 6 votes vote down vote up
@Override
public void preInit(FMLPreInitializationEvent e) {
    super.preInit(e);
    OBJLoader.INSTANCE.addDomain(ValkyrienSkiesMod.MOD_ID.toLowerCase());
    RenderingRegistry.registerEntityRenderingHandler(PhysicsWrapperEntity.class,
        new PhysicsWrapperEntityRenderFactory());
    // Register events
    MinecraftForge.EVENT_BUS.register(new EventsClient());
    MinecraftForge.EVENT_BUS.register(keyEvents);

    // Register VS Minecraft resource reload listener.
    IReloadableResourceManager mcResourceManager = (IReloadableResourceManager) Minecraft
        .getMinecraft()
        .getResourceManager();

    // When Minecraft reloads resources tell GibsModelRegistry to delete all its caches.
    mcResourceManager.registerReloadListener(GibsModelRegistry::onResourceManagerReload);

    registerAnimations();
}
 
Example #6
Source File: VersionChecker.java    From VersionChecker with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent event)
{
    MinecraftForge.EVENT_BUS.register(new EventHandler());

    FMLCommonHandler.instance().bus().register(new ConfigHandler());

    ConfigHandler.init(event);

    RemoveHandler.init();

    FMLInterModComms.sendRuntimeMessage(Reference.MOD_ID, "VersionChecker", "addVersionCheck", REMOTE_VERSION_URL);

    if (!disableNEMCheck)
        NEMChecker.execute();

    /*
    NBTTagCompound compound = new NBTTagCompound();
    compound.setString("curseProjectName", "221140-version-checker");
    compound.setString("curseFilenameParser", "VersionChecker-[].jar");

    FMLInterModComms.sendRuntimeMessage(Reference.MOD_ID, "VersionChecker", "addCurseCheck", compound);
    */

    //sendABunchOfDerpyMessages();
}
 
Example #7
Source File: ClientProxy.java    From IGW-mod with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void preInit(FMLPreInitializationEvent event){
    MinecraftForge.EVENT_BUS.register(new TickHandler());

    MinecraftForge.EVENT_BUS.register(new TooltipOverlayHandler());

    //Not being used, as it doesn't really add anything...
    // MinecraftForge.EVENT_BUS.register(new HighlightHandler());

    openInterfaceKey = new KeyBinding("igwmod.keys.wiki", Constants.DEFAULT_KEYBIND_OPEN_GUI, "igwmod.keys.category");//TODO blend keybinding category in normal
    ClientRegistry.registerKeyBinding(openInterfaceKey);
    MinecraftForge.EVENT_BUS.register(this);//subscribe to key events.

    ConfigHandler.init(event.getSuggestedConfigurationFile());

    WikiRegistry.registerWikiTab(new IGWWikiTab());
    WikiRegistry.registerWikiTab(new BlockAndItemWikiTab());
    WikiRegistry.registerWikiTab(new EntityWikiTab());

    WikiRegistry.registerRecipeIntegrator(new IntegratorImage());
    WikiRegistry.registerRecipeIntegrator(new IntegratorCraftingRecipe());
    WikiRegistry.registerRecipeIntegrator(new IntegratorFurnace());
    WikiRegistry.registerRecipeIntegrator(new IntegratorStack());
    WikiRegistry.registerRecipeIntegrator(new IntegratorComment());
}
 
Example #8
Source File: Signals.java    From Signals with GNU General Public License v3.0 6 votes vote down vote up
@EventHandler
public void PreInit(FMLPreInitializationEvent event){
    event.getModMetadata().version = Versions.fullVersionString();
    NetworkRegistry.INSTANCE.registerGuiHandler(instance, proxy);
    proxy.preInit();
    ModBlocks.init();
    ModItems.init();
    CapabilityMinecartDestination.register();
    CapabilityDestinationProvider.register();
    MinecraftForge.EVENT_BUS.register(proxy);
    MinecraftForge.EVENT_BUS.register(new com.minemaarten.signals.event.EventHandler());
    MinecraftForge.EVENT_BUS.register(new RailReplacerEventHandler());
    BlockDispenser.DISPENSE_BEHAVIOR_REGISTRY.putObject(ModItems.TICKET, new BehaviorDispenseTicket());

    ChunkLoadManager.INSTANCE.init();

    asmData = event.getAsmData();

    if(!SignalsConfig.enableRailNetwork) {
        Log.warning("RAIL NETWORK IS NOT FUNCTIONAL!");
    }
}
 
Example #9
Source File: ValkyrienSkiesMod.java    From Valkyrien-Skies with Apache License 2.0 5 votes vote down vote up
@EventHandler
public void preInit(FMLPreInitializationEvent event) {
    log.debug("Initializing configuration");
    runConfiguration();

    log.debug("Instantiating the physics thread executor");
    ValkyrienSkiesMod.PHYSICS_THREADS_EXECUTOR = Executors
        .newFixedThreadPool(VSConfig.threadCount);

    log.debug("Beginning asynchronous Kryo initialization");
    serializationInitAsync();
    registerNetworks(event);

    registerCapabilities();
    proxy.preInit(event);

    log.debug("Initializing the VS API");
    try {
        Field instanceField = IPhysicsEntityManager.class.getDeclaredField("INSTANCE");
        // Make the field accessible
        instanceField.setAccessible(true);
        // Remove the final modifier
        Field modifiersField = Field.class.getDeclaredField("modifiers");
        modifiersField.setAccessible(true);
        modifiersField.setInt(instanceField, instanceField.getModifiers() & ~Modifier.FINAL);
        // Finally set the new value of the field.
        instanceField.set(null, new VS_APIPhysicsEntityManager());
    } catch (Exception e) {
        e.printStackTrace();
        log.fatal("FAILED TO INITIALIZE VS API!");
    }
    // Initialize VS API end.
}
 
Example #10
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 #11
Source File: ToroQuest.java    From ToroQuest with GNU General Public License v3.0 5 votes vote down vote up
@EventHandler
public void preInit(FMLPreInitializationEvent e) {
	proxy.preInit(e);

	ConfigurationHandler.init(e.getSuggestedConfigurationFile());
	MinecraftForge.EVENT_BUS.register(new ConfigurationHandler());
}
 
Example #12
Source File: EntityConverter.java    From NOVA-Core with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
@SideOnly(Side.CLIENT)
public void preInit(FMLPreInitializationEvent evt) {
	/**
	 * Backward register all particle effects
	 */
	//Look up for particle factory and pass it into BWEntityFX
	for (EnumParticleTypes type : EnumParticleTypes.values()) {
		Game.entities().register(Game.info().name + ":" + type.getParticleName(), () -> new BWEntityFX(type.getParticleID()));
	}
}
 
Example #13
Source File: CommonProxy.java    From Sakura_mod with MIT License 5 votes vote down vote up
public void preInit(FMLPreInitializationEvent event) {
      tab = new CreativeTabsSakura();
      new PotionLoader(event);
      new BlockLoader(event);
      new ItemLoader(event);
      new DrinksLoader();
      SakuraEntityRegister.entityRegister();
      
      new SakuraOreDictLoader();
      VillagerCreationWA.registerComponents();
VillagerCreationWA villageHandler = new VillagerCreationWA();
VillagerRegistry.instance().registerVillageCreationHandler(villageHandler);
  }
 
Example #14
Source File: TeleportMod.java    From ModdingTutorials with GNU General Public License v2.0 5 votes vote down vote up
@EventHandler
public void preInit(FMLPreInitializationEvent event)
{
	TeleportBlocks.init();
	TeleportBlocks.register();
	TeleportItems.init();
	TeleportItems.register();
	TeleportTileEntities.register();
}
 
Example #15
Source File: ClientProxy.java    From Logistics-Pipes-2 with MIT License 5 votes vote down vote up
@Override
public void preInit(FMLPreInitializationEvent event){
	super.preInit(event);
	
	OBJLoader.INSTANCE.addDomain(References.MODID);
	BlockRegistry.initModels();
	PipeRegistry.initModels();
	ItemRegistry.initModels();
}
 
Example #16
Source File: CyberwareConfig.java    From Cyberware with MIT License 5 votes vote down vote up
public static void preInit(FMLPreInitializationEvent event)
{
	configDirectory = event.getModConfigurationDirectory();
	config = new Configuration(new File(event.getModConfigurationDirectory(), Cyberware.MODID + ".cfg"));
	startingItems = defaultStartingItems = new String[EnumSlot.values().length][0];
	startingStacks = new ItemStack[EnumSlot.values().length][LibConstants.WARE_PER_SLOT];
	
	int j = 0;
	for (int i = 0; i < EnumSlot.values().length; i++)
	{
		if (EnumSlot.values()[i].hasEssential())
		{
			if (EnumSlot.values()[i].isSided())
			{
				defaultStartingItems[i] = new String[] { "cyberware:bodyPart 1 " + j, "cyberware:bodyPart 1 " + (j + 1)  };
				j += 2;
			}
			else
			{
				defaultStartingItems[i] = new String[] { "cyberware:bodyPart 1 " + j };
				j++;
			}
		}
		else
		{
			defaultStartingItems[i] = new String[0];
		}
	}
	loadConfig();
	
	config.load();
	for (int index = 0; index < EnumSlot.values().length; index++)
	{
		EnumSlot slot = EnumSlot.values()[index];
		startingItems[index] = config.getStringList("Default augments for " + slot.getName() + " slot",
				"Defaults", defaultStartingItems[index], "Use format 'id amount metadata'");
	}
	config.save();
	
}
 
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: EntityConverter.java    From NOVA-Core with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
@SideOnly(Side.CLIENT)
public void preInit(FMLPreInitializationEvent evt) {
	/**
	 * Backward register all particle effects
	 */
	//Look up for particle factory and pass it into BWParticle
	for (EnumParticleTypes type : EnumParticleTypes.values()) {
		Game.entities().register(Game.info().name + ":" + type.getParticleName(), () -> new BWParticle(type.getParticleID()));
	}
}
 
Example #19
Source File: CommonProxy.java    From NOVA-Core with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void preInit(FMLPreInitializationEvent evt) {
	GameRegistry.registerTileEntity(FWTile.class, "novaTile");
	GameRegistry.registerTileEntity(FWTileUpdater.class, "novaTileUpdater");
	int globalUniqueEntityId = EntityRegistry.findGlobalUniqueEntityId();
	EntityRegistry.registerGlobalEntityID(FWEntity.class, "novaEntity", globalUniqueEntityId);
	EntityRegistry.registerModEntity(FWEntity.class, "novaEntity", globalUniqueEntityId, NovaMinecraft.instance, 64, 20, true);
}
 
Example #20
Source File: ProductionLine.java    From Production-Line with MIT License 5 votes vote down vote up
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent event) {
    isIC2Loaded = Loader.isModLoaded("IndustrialCraft 2");
    setupMeta();
    PLConfig.init(event.getSuggestedConfigurationFile());
    PLEntity.init();
    proxy.preInit();
}
 
Example #21
Source File: ItemConverter.java    From NOVA-Core with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Register all Nova blocks
 */
@Override
public void preInit(FMLPreInitializationEvent evt) {
	registerCapabilities();
	registerNOVAItemsToMinecraft();
	registerMinecraftItemsToNOVA();
	registerSubtypeResolution();
}
 
Example #22
Source File: TeleportMod.java    From ModdingTutorials with GNU General Public License v2.0 5 votes vote down vote up
@EventHandler
public void preInit(FMLPreInitializationEvent event)
{
	TeleportBlocks.init();
	TeleportBlocks.register();
	TeleportItems.init();
	TeleportItems.register();
	TeleportTileEntities.register();
}
 
Example #23
Source File: ClientProxy.java    From NOVA-Core with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void preInit(FMLPreInitializationEvent evt) {
	super.preInit(evt);
	MinecraftForge.EVENT_BUS.register(RenderUtility.instance);
	ClientRegistry.bindTileEntitySpecialRenderer(FWTile.class, FWTileRenderer.instance);
	RenderUtility.instance.preInit(evt);
}
 
Example #24
Source File: CraftingKeys.java    From CraftingKeys with MIT License 5 votes vote down vote up
/**
 * This method will be executed before Init.
 *
 * @param event Input Event from FML
 */
@EventHandler
public void preInit(FMLPreInitializationEvent event) {
    Logger.info("preInit(e)", "Loading Config now.");
    Config.loadConfig(event);
    Logger.info("preInit(e)", "Finished loading Config.");
}
 
Example #25
Source File: TraverseConfig.java    From Traverse-Legacy-1-12-2 with MIT License 5 votes vote down vote up
public static void initialize(FMLPreInitializationEvent event) {
	configDir = new File(event.getModConfigurationDirectory(), TraverseConstants.MOD_ID);
	if (!configDir.exists()) {
		configDir.mkdir();
	}

	mainConfig = new File(configDir, "traverse.cfg");
	traverseConfiguration = initialize();
}
 
Example #26
Source File: CommonProxy.java    From TFC2 with GNU General Public License v3.0 5 votes vote down vote up
public void preInit(FMLPreInitializationEvent event)
{
	TFC_Sounds.register();
	registerWorldGen();

	DimensionManager.unregisterDimension(0);
	DimensionManager.registerDimension(0, DimensionTFC.SURFACE);
	DimensionManager.registerDimension(2, DimensionTFC.PATHS);

	ResourceLocation still = Core.CreateRes(Reference.getResID()+"blocks/water_still");
	ResourceLocation flow = Core.CreateRes(Reference.getResID()+"blocks/water_flow");
	TFCFluids.SALTWATER = new FluidTFC("saltwater", still, flow).setBaseColor(0xff001945);
	TFCFluids.FRESHWATER = new FluidTFC("freshwater", still, flow).setBaseColor(0xff001945);
	FluidRegistry.registerFluid(TFCFluids.SALTWATER);
	FluidRegistry.registerFluid(TFCFluids.FRESHWATER);
	registerCrops();
	TFCBlocks.LoadBlocks();
	TFCBlocks.RegisterBlocks();
	TFCBlocks.RegisterTileEntites();
	TFCItems.Load();
	TFCItems.SetupCreativeTabs();
	TFCItems.Register();
	registerCropProduce();//Must run after item setup
	setupOre();
	registerOreDictionary();

	SkillsManager.instance.registerSkill(new Skill("gui.skill.woodworker", 1.0f, 1f));
	SkillsManager.instance.registerSkill(new Skill("gui.skill.smith", 1.0f, 1f));
	SkillsManager.instance.registerSkill(new Skill("gui.skill.toolsmith", 1.0f, 10f));
	SkillsManager.instance.registerSkill(new Skill("gui.skill.weaponsmith", 1.0f, 10f));
	SkillsManager.instance.registerSkill(new Skill("gui.skill.armorsmith", 1.0f, 10f));
	SkillsManager.instance.registerSkill(new Skill("gui.skill.farmer", 1.0f, 1f));
	SkillsManager.instance.registerSkill(new Skill("gui.skill.fisherman", 1.0f, 1f));
	SkillsManager.instance.registerSkill(new Skill("gui.skill.butcher", 1.0f, 1f));

	readSizeWeight();
}
 
Example #27
Source File: MCLanguageManager.java    From NOVA-Core with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
@SuppressWarnings("deprecation")
public void preInit(FMLPreInitializationEvent evt) {
	this.languageMap.forEach((language, map) -> {
		String lang = language.replace('-', '_');
		map.forEach((key, value) -> LanguageRegistry.instance().addStringLocalization(key, lang, value));
	});

	Game.events().on(LanguageEvent.RegisterTranslation.class).withPriority(EventBus.PRIORITY_LOW).bind(this::register);
}
 
Example #28
Source File: WearableBackpacks.java    From WearableBackpacks with MIT License 5 votes vote down vote up
@EventHandler
public void preInit(FMLPreInitializationEvent event) {
	LOG = event.getModLog();
	CHANNEL = new BackpacksChannel();
	
	CONFIG = new BackpacksConfig(event.getSuggestedConfigurationFile());
	CONFIG.load();
	CONFIG.save();
	
	CONTENT = new BackpacksContent();
	CONTENT.registerRecipes();
	
	PROXY.preInit();
}
 
Example #29
Source File: Config.java    From EnderZoo with Creative Commons Zero v1.0 Universal 5 votes vote down vote up
public static void load(FMLPreInitializationEvent event) {
  MinecraftForge.EVENT_BUS.register(new Config());
  configDirectory = new File(event.getModConfigurationDirectory(), EnderZoo.MODID.toLowerCase());
  if (!configDirectory.exists()) {
    configDirectory.mkdir();
  }

  File configFile = new File(configDirectory, "EnderZoo.cfg");
  config = new Configuration(configFile);
  syncConfig();
}
 
Example #30
Source File: TinkerToolLeveling.java    From TinkersToolLeveling with MIT License 5 votes vote down vote up
@EventHandler
public void preInit(FMLPreInitializationEvent event) {
  modConfigurationDirectory = event.getModConfigurationDirectory();
  networkWrapper = new NetworkWrapper("tinkerlevel" + ":sync");
  networkWrapper.registerPacketClient(ConfigSyncPacket.class);

  CapabilityDamageXp.register();

  MinecraftForge.EVENT_BUS.register(this);
}