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

The following examples show how to use net.minecraftforge.fml.common.event.FMLInterModComms. 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: 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 #2
Source File: UpdateChecker.java    From VersionChecker with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public void run()
{
    int count = 0;

    try
    {
        while (count < VERSION_CHECK_ATTEMPTS - 1 && (count == 0 || !modsToCheck.isEmpty()))
        {
            IMCHandler.processMessages(FMLInterModComms.fetchRuntimeMessages(Reference.MOD_ID));
            checkVersion();
            count++;

            Thread.sleep(10000);
        }
    }
    catch (InterruptedException e)
    {
        e.printStackTrace();
    }
}
 
Example #3
Source File: ExNihiloAdscensio.java    From ExNihiloAdscensio with MIT License 6 votes vote down vote up
@EventHandler
public static void init(FMLInitializationEvent event) {
	OreRegistry.loadJson(new File(configDirectory, "OreRegistry.json"));
	loadConfigs();

	Recipes.init();
	OreRegistry.doRecipes();

	proxy.initOreModels();
	proxy.registerColorHandlers();

	FMLInterModComms.sendMessage("Waila", "register",
			"exnihiloadscensio.compatibility.CompatWaila.callbackRegister");
	
	if (Loader.isModLoaded("theoneprobe") && Config.doTOPCompat) {
		CompatTOP.init();
	}
}
 
Example #4
Source File: EventHandler.java    From VersionChecker with GNU Lesser General Public License v3.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onGuiInit(GuiScreenEvent.InitGuiEvent evt)
{
    if (evt.getGui() instanceof GuiMainMenu)
    {
        IMCHandler.processMessages(FMLInterModComms.fetchRuntimeMessages(Reference.MOD_ID));
        GuiMainMenuHandler.initGui(evt.getGui(), evt.getButtonList());
    }
}
 
Example #5
Source File: GuiUpdates.java    From VersionChecker with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void initGui()
{
    IMCHandler.processMessages(FMLInterModComms.fetchRuntimeMessages(Reference.MOD_ID));
    super.initGui();

    windowStartX = width / 2 - 110 + listShift;
    windowStartY = height / 2 - 90;
    windowEndX = width / 2 + 110 + listShift;
    windowEndY = height / 2 + 70;

    buttonList.add(new GuiButton(0, width / 2 - 75 + listShift, height - 30, 150, 20, I18n.translateToLocal("gui.done")));

    buttonList.add(updateButton = new GuiButton(1, width / 2 - 100 + listShift, height / 2 + 40, 96, 20, I18n.translateToLocal(Strings.UPDATE)));

    buttonList.add(closeButton = new GuiButton(2, width / 2 + 4 + listShift, height / 2 + 40, 96, 20, I18n.translateToLocal("gui.done")));

    buttonList.add(new GuiButton(3, 10, height - 30, 150, 20, I18n.translateToLocal(Strings.MOD_FOLDER)));

    buttonList.add(buttonDownloaded = new GuiButtonDownloaded(4, width / 2 - 100 + listShift, height / 2 + 15));

    buttonList.add(NEMButton = new GuiButtonNEM(getUpdateListProperties(), 5, width / 2 + 90 + listShift, height - 30));
    buttonList.add(curseButton = new GuiButtonCurse(getUpdateListProperties(), 6, width / 2 + 125 + listShift, height - 30));

    updateList = new GuiUpdateList(this, 300, height - 60, 20, height - 40, width / 2 - 150 + listShift);
    changeLogList = new GuiChangeLogList(this, 200, 75, height / 2 - 60, height / 2 + 15, width / 2 - 100 + listShift);

    if (openUpdate != null)
    {
        openInfoScreen(openUpdate);
    }
    else
    {
        closeInfoScreen();
    }
}
 
Example #6
Source File: IMCHandler.java    From VersionChecker with GNU Lesser General Public License v3.0 5 votes vote down vote up
public static void processMessages(List<FMLInterModComms.IMCMessage> messageList)
{
    for (FMLInterModComms.IMCMessage message : messageList)
    {
        if (message.key.equalsIgnoreCase(IMCOperations.ADD_UPDATE))
        {
            LogHandler.info("Received update from mod " + message.getSender());
            if (message.isNBTMessage())
            {
                processAddUpdateMessage(message.getNBTValue(), message.getSender());
            }
            else if (message.isStringMessage())
            {
                processAddUpdateMessage(message.getStringValue(), message.getSender());
            }
        }
        else if (message.key.equalsIgnoreCase(IMCOperations.ADD_VERSION_CHECK))
        {
            LogHandler.info("Received version check from mod " + message.getSender());
            if (message.isStringMessage())
            {
                processVersionCheckMessage(message.getSender(), message.getStringValue());
            }
        }
        else if (message.key.equalsIgnoreCase(IMCOperations.ADD_CURSE_CHECK))
        {
            LogHandler.info("Received curse check from mod " + message.getSender());
            if (message.isNBTMessage())
            {
                processCurseCheckMessage(message.getSender(), message.getNBTValue());
            }
        }
    }
}
 
Example #7
Source File: ThaumcraftPlugin.java    From AgriCraft with MIT License 5 votes vote down vote up
@Override
public void initPlugin() {

    // Fix Golems
    FMLInterModComms.sendMessage(
            "Thaumcraft",
            "harvestClickableCrop",
            new ItemStack(AgriBlocks.getInstance().CROP, 1, Constants.MATURE)
    );

}
 
Example #8
Source File: CommonProxy.java    From LunatriusCore with MIT License 5 votes vote down vote up
public void processIMC(final FMLInterModComms.IMCEvent event) {
    for (final FMLInterModComms.IMCMessage message : event.getMessages()) {
        if ("checkUpdate".equals(message.key) && message.isStringMessage()) {
            processMessage(message.getSender(), message.getStringValue());
        }
    }
}
 
Example #9
Source File: EnderZoo.java    From EnderZoo with Creative Commons Zero v1.0 Universal 5 votes vote down vote up
@EventHandler
 public void preInit(FMLPreInitializationEvent event) {
  
MinecraftForge.EVENT_BUS.register(new RegistryHandler());
  
   itemForCreativeMenuIcon = ItemForCreativeMenuIcon.create();

   Config.load(event);
   
   itemWitheringDust = ItemWitheringDust.create();
   itemConfusingDust = ItemConfusingDust.create();
   itemEnderFragment = ItemEnderFragment.create();
   itemGuardiansBow = ItemGuardiansBow.create();   
   itemOwlEgg = ItemOwlEgg.create();

   if (Config.confusingChargeEnabled) {
     blockConfusingCharge = BlockConfusingCharge.create();
   }
   if (Config.enderChargeEnabled) {
     blockEnderCharge = BlockEnderCharge.create();
   }
   if (Config.concussionChargeEnabled) {
     blockConcussionCharge = BlockConcussionCharge.create();
   }
   potions = new Potions();

   FMLInterModComms.sendMessage("waila", "register", "crazypants.enderzoo.waila.WailaCompat.load");
   proxy.preInit();
 }
 
Example #10
Source File: IMCItemStack.java    From customstuff4 with GNU General Public License v3.0 4 votes vote down vote up
@Override
protected void doInit(InitPhase phase, ContentHelper helper)
{
    FMLInterModComms.sendMessage(modId, key, value.getItemStack().copy());
}
 
Example #11
Source File: IGWMod.java    From IGW-mod with GNU General Public License v2.0 4 votes vote down vote up
@EventHandler
public void processIMCRequests(FMLInterModComms.IMCEvent event){
    proxy.processIMC(event);
}
 
Example #12
Source File: VersionChecker.java    From VersionChecker with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Mod.EventHandler
public void handleIMCMessages(FMLInterModComms.IMCEvent event)
{
    IMCHandler.processMessages(event.getMessages());
}
 
Example #13
Source File: LunatriusCore.java    From LunatriusCore with MIT License 4 votes vote down vote up
@Mod.EventHandler
public void processIMC(final FMLInterModComms.IMCEvent event) {
    proxy.processIMC(event);
}
 
Example #14
Source File: CommonProxy.java    From LunatriusCore with MIT License 4 votes vote down vote up
public void preInit(final FMLPreInitializationEvent event) {
    Reference.logger = event.getModLog();

    FMLInterModComms.sendMessage(Reference.MODID, "checkUpdate", Reference.FORGE);
}
 
Example #15
Source File: WailaPlugin.java    From Moo-Fluids with GNU General Public License v3.0 4 votes vote down vote up
public static void init() {
  LogHelper.info("WAILA detected. Registering entities with WAILA registry.");
  FMLInterModComms.sendMessage("waila", "register", REGISTRAR_CLASSPATH);
}
 
Example #16
Source File: TheOneProbePlugin.java    From Moo-Fluids with GNU General Public License v3.0 4 votes vote down vote up
public static void init() {
  LogHelper.info("TheOneProbe detected. Registering entities with TheOneProbe registry.");
  FMLInterModComms.sendFunctionMessage("theoneprobe", "getTheOneProbe", REGISTRAR_CLASSPATH);
}
 
Example #17
Source File: TheOneProbePlugin.java    From AgriCraft with MIT License 4 votes vote down vote up
@Override
public void initPlugin() {
    AgriCore.getLogger("agricraft").debug("Calling One Probe Register! Result: {0}!",
            FMLInterModComms.sendFunctionMessage("theoneprobe", "getTheOneProbe", this.getClass().getPackage().getName() + ".GetTheOneProbe"));
}
 
Example #18
Source File: CompatTOP.java    From ExNihiloAdscensio with MIT License 4 votes vote down vote up
public static void init() {
    if (registered)
        return;
    registered = true;
    FMLInterModComms.sendFunctionMessage("theoneprobe", "getTheOneProbe", "exnihiloadscensio.compatibility.theoneprobe.CompatTOP$GetTheOneProbe");
}
 
Example #19
Source File: IMCString.java    From customstuff4 with GNU General Public License v3.0 4 votes vote down vote up
@Override
protected void doInit(InitPhase phase, ContentHelper helper)
{
    FMLInterModComms.sendMessage(modId, key, value);
}
 
Example #20
Source File: IMCResourceLocation.java    From customstuff4 with GNU General Public License v3.0 4 votes vote down vote up
@Override
protected void doInit(InitPhase phase, ContentHelper helper)
{
    FMLInterModComms.sendMessage(modId, key, value);
}
 
Example #21
Source File: IMCFunction.java    From customstuff4 with GNU General Public License v3.0 4 votes vote down vote up
@Override
protected void doInit(InitPhase phase, ContentHelper helper)
{
    FMLInterModComms.sendFunctionMessage(modId, key, value);
}
 
Example #22
Source File: IMCNBT.java    From customstuff4 with GNU General Public License v3.0 4 votes vote down vote up
@Override
protected void doInit(InitPhase phase, ContentHelper helper)
{
    FMLInterModComms.sendMessage(modId, key, value);
}
 
Example #23
Source File: CustomStuff4.java    From customstuff4 with GNU General Public License v3.0 4 votes vote down vote up
private void sendIMCs()
{
    FMLInterModComms.sendMessage("waila", "register", "cubex2.cs4.compat.waila.CompatWaila.callbackRegister");
}
 
Example #24
Source File: IProxy.java    From IGW-mod with GNU General Public License v2.0 votes vote down vote up
public void processIMC(FMLInterModComms.IMCEvent event);