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

The following examples show how to use net.minecraftforge.fml.common.event.FMLPreInitializationEvent. These examples are extracted from open source projects. 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
@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 2
Source Project: Moo-Fluids   Source File: MooFluids.java    License: 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 3
Source Project: Custom-Main-Menu   Source File: CustomMainMenu.java    License: MIT License 6 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 4
Source Project: IGW-mod   Source File: ClientProxy.java    License: 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 5
Source Project: Signals   Source File: Signals.java    License: 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 6
Source Project: Wizardry   Source File: ClientProxy.java    License: 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 7
Source Project: Valkyrien-Skies   Source File: ClientProxy.java    License: 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 8
/**
 * Register all Nova items
 *
 * @param evt {@inheritDoc}
 */
@Override
public void preInit(FMLPreInitializationEvent evt) {
	registerNOVAItemsToMinecraft();
	registerMinecraftItemsToNOVA();
	registerSubtypeResolution();
}
 
Example 9
@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 10
Source Project: Sakura_mod   Source File: ClientProxy.java    License: MIT License 5 votes vote down vote up
@Override
public void preInit(FMLPreInitializationEvent event) {
    super.preInit(event);
    BlockLoader.registerRenders();
    ItemLoader.registerRenders();
    DrinksLoader.registerRender();
    SakuraEntityRegister.entityRender();

    TileEntityRegistry.render();
}
 
Example 11
Source Project: Sakura_mod   Source File: PotionLoader.java    License: MIT License 5 votes vote down vote up
public PotionLoader(FMLPreInitializationEvent event) {
	 ForgeRegistries.POTIONS.register(exp_up);
	 ForgeRegistries.POTIONS.register(cannon);
	 ForgeRegistries.POTIONS.register(golden_heart);
	 ForgeRegistries.POTIONS.register(poisom);
	 ForgeRegistries.POTIONS.register(poisom_big);
	 ForgeRegistries.POTIONS.register(fire_blade);
	 registerPotionEvent();
}
 
Example 12
Source Project: HoloInventory   Source File: HoloInventory.java    License: MIT License 5 votes vote down vote up
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent event)
{
    logger = event.getModLog();

    config = new Configuration(event.getSuggestedConfigurationFile());
    updateConfig();

    int id = 0;
    snw = NetworkRegistry.INSTANCE.newSimpleChannel(MODID);

    // Request packets (client -> server)
    snw.registerMessage(EntityRequest.Handler.class, EntityRequest.class, id++, Side.SERVER);
    snw.registerMessage(TileRequest.Handler.class, TileRequest.class, id++, Side.SERVER);

    // Response packets (server -> client)
    snw.registerMessage(PlainInventory.Handler.class, PlainInventory.class, id++, Side.CLIENT);
    snw.registerMessage(MerchantRecipes.Handler.class, MerchantRecipes.class, id++, Side.CLIENT);

    if (event.getSide().isClient())
    {
        //noinspection MethodCallSideOnly
        ClientEventHandler.init();
    }

    MinecraftForge.EVENT_BUS.register(this);
    MinecraftForge.EVENT_BUS.register(ServerEventHandler.I);
}
 
Example 13
Source Project: Sakura_mod   Source File: CommonProxy.java    License: 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 Project: Valkyrien-Skies   Source File: ValkyrienSkiesMod.java    License: 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 15
Source Project: FastAsyncWorldedit   Source File: ForgeMain.java    License: 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 16
Source Project: ModdingTutorials   Source File: TeleportMod.java    License: 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 17
Source Project: NOVA-Core   Source File: CommonProxy.java    License: 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 18
@Override
public void onPreInit(FMLPreInitializationEvent event) {
	PacketHandler.registerMessages("hyperstellar");
	EntityRegistry.registerModEntity(new ResourceLocation(CommunityGlobals.MOD_ID, "BaseVehicle"), BaseVehicleEntity.class, "BaseVehicle", 45, CommunityMod.INSTANCE, 64, 3, true);
	if (!ForgeChunkManager.getConfig().hasCategory(CommunityGlobals.MOD_ID)) {
		ForgeChunkManager.getConfig().get(CommunityGlobals.MOD_ID, "maximumChunksPerTicket", MaxRocketSize / 16)
				.setMinValue(0);
		ForgeChunkManager.getConfig().get(CommunityGlobals.MOD_ID, "maximumTicketCount", 10000).setMinValue(0);
		ForgeChunkManager.getConfig().save();
	}
	HDataSerializers.register();
}
 
Example 19
@Override
public void onPreInit(FMLPreInitializationEvent event) {
	network = NetworkRegistry.INSTANCE.newSimpleChannel(CommunityGlobals.MOD_ID);
	network.registerMessage(new PacketUpdateAltar.Handler(), PacketUpdateAltar.class, 0, Side.CLIENT);
	network.registerMessage(new PacketRequestUpdateAltar.Handler(), PacketRequestUpdateAltar.class, 1, Side.SERVER);
	network.registerMessage(new PacketAltarAnimation.Handler(), PacketAltarAnimation.class, 2, Side.CLIENT);
}
 
Example 20
@Override
public void onPreInit(FMLPreInitializationEvent e)
{
	GameRegistry.registerTileEntity(TileEntityGnomeCache.class, new ResourceLocation(CommunityGlobals.MOD_ID, "te_gnomecache"));

	if (e.getSide().isClient())
	{
		RenderingRegistry.registerEntityRenderingHandler(EntityGnomeWood.class, RenderGnomeWood::new);
	}
}
 
Example 21
@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 22
Source Project: Production-Line   Source File: ProductionLine.java    License: 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 23
/**
 * Register all Nova blocks
 */
@Override
public void preInit(FMLPreInitializationEvent evt) {
	registerCapabilities();
	registerNOVAItemsToMinecraft();
	registerMinecraftItemsToNOVA();
	registerSubtypeResolution();
}
 
Example 24
Source Project: ModdingTutorials   Source File: TeleportMod.java    License: 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 25
Source Project: WearableBackpacks   Source File: WearableBackpacks.java    License: 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 26
Source Project: EnderZoo   Source File: Config.java    License: 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 27
Source Project: TinkersToolLeveling   Source File: TinkerToolLeveling.java    License: 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);
}
 
Example 28
@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 29
Source Project: TFC2   Source File: CommonProxy.java    License: 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 30
Source Project: Traverse-Legacy-1-12-2   Source File: TraverseConfig.java    License: 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();
}