Java 类net.minecraftforge.fml.common.event.FMLInterModComms 实例源码

项目:ObsidianSuite    文件:ObsidianAnimator.java   
@Mod.EventHandler
public void init(FMLInitializationEvent event)
{       
    FMLInterModComms.sendRuntimeMessage(MODID, "VersionChecker", "addVersionCheck", VERSION_LINK);

    instance = this;        
    proxy.init();

       EventHandler eventHandler = new EventHandler();
       MinecraftForge.EVENT_BUS.register(eventHandler);

       if(FMLCommonHandler.instance().getEffectiveSide().isClient())
           FMLCommonHandler.instance().bus().register(eventHandler);

       //Minecraft.getMinecraft().gameSettings.showInventoryAchievementHint = false;
       Minecraft.getMinecraft().gameSettings.saveOptions();

       //Stop space from activating buttons, allowing it to be used for adding keyframes in the timeline.
       InputMap im = (InputMap)UIManager.get("Button.focusInputMap");
       im.put(KeyStroke.getKeyStroke("pressed SPACE"), "none");
       im.put(KeyStroke.getKeyStroke("released SPACE"), "none");
}
项目:Randores2    文件:Randores.java   
@Mod.EventHandler
public void onInit(FMLInitializationEvent ev) {
    info("Randores is Initializing...",
            "Sending handler message to WAILA.");
    FMLInterModComms.sendMessage("waila", "register", "com.gmail.socraticphoenix.randores.waila.RandoresWailaHandler.callbackRegister");
    if (Loader.isModLoaded("waila")) {
        info("WAILA was found and should have receieved the handler message.");
    } else {
        info("WAILA wasn't found. The handler message will be ignored.");
    }

    info("Registering up GUI handler and world generators...");
    NetworkRegistry.INSTANCE.registerGuiHandler(this, new RandoresGuiHandler());
    GameRegistry.registerWorldGenerator(new RandoresWorldGenerator(), 10);
    GameRegistry.registerWorldGenerator(new RandoresAltarGenerator(), -100);
    info("Registered GUI hander and world generators.", "Calling proxy Initialization...");
    Randores.PROXY.initSided(ev);
    info("Finished Initialization.");
}
项目:Never-Enough-Currency    文件:Currency.java   
@EventHandler
public void init(FMLInitializationEvent event) {
    proxy.init(event);

    NetworkRegistry.INSTANCE.registerGuiHandler(Currency.INSTANCE, new GuiHandler());

    AccountCapability.register();
    CartCapability.register();

    PacketDispatcher.registerPackets();

    FMLInterModComms.sendMessage("waila", "register", "com.zundrel.currency.common.compat.waila.CurrencyWailaProvider.callbackRegister");

    GameRegistry.registerTileEntity(TileEntityShopController.class, ModInfo.MODID + ":" + "shop_controller");
    GameRegistry.registerTileEntity(TileEntityDisplay.class, ModInfo.MODID + ":" + "display");
    GameRegistry.registerTileEntity(TileEntityStockCrate.class, ModInfo.MODID + ":" + "stock_crate");
}
项目:Thermionics    文件:Thermionics.java   
@EventHandler
public void onInit(FMLInitializationEvent e) {
    proxy.init();
    //TODO: When smores has ore voting stabilized, update and re-enable this
    //NBTTagCompound oresTag = new NBTTagCompound();
    //oresTag.setBoolean("oreCopper", true);
    //oresTag.setBoolean("ingotCopper", true);
    //oresTag.setBoolean("dustCopper", true);
    //oresTag.setBoolean("gearCopper", true);
    //oresTag.setBoolean("plateCopper", true);
    //FMLInterModComms.sendMessage("smores", "recipeVote", oresTag);

    //Thermionics machines are *unusually* safe for charset to carry around
    FMLInterModComms.sendMessage("charset", "addCarry", ThermionicsBlocks.FIREBOX.getRegistryName());
    FMLInterModComms.sendMessage("charset", "addCarry", ThermionicsBlocks.OVEN.getRegistryName());
    FMLInterModComms.sendMessage("charset", "addCarry", ThermionicsBlocks.BATTERY_LEAD.getRegistryName()); //Avoid creative battery carry!
    FMLInterModComms.sendMessage("charset", "addCarry", ThermionicsBlocks.HAMMER_MILL.getRegistryName());
    FMLInterModComms.sendMessage("charset", "addCarry", ThermionicsBlocks.MOTOR_CONVECTION.getRegistryName());
    FMLInterModComms.sendMessage("charset", "addCarry", ThermionicsBlocks.SERGER.getRegistryName());
}
项目:BackTools    文件:BackTools.java   
@EventHandler
public void onIMCMessage(FMLInterModComms.IMCEvent event)
{
    for(FMLInterModComms.IMCMessage message : event.getMessages())
    {
        if(message.key.equalsIgnoreCase("blacklist") && message.isItemStackMessage())
        {
            if(!blacklist.contains(message.getItemStackValue().getItem()))
            {
                blacklist.add(message.getItemStackValue().getItem());
                logger.info("Registered " + message.getItemStackValue().getItem().toString() + " to Item blacklist");
            }
        }
        else if(message.key.equalsIgnoreCase("backtool") && message.isItemStackMessage())
        {
            if(!orientationMap.containsKey(message.getItemStackValue().getItem().getClass()))
            {
                orientationMap.put(message.getItemStackValue().getItem().getClass(), message.getItemStackValue().getCount());
                logger.warn("Registered " + message.getItemStackValue().getItem().getClass().getName() + " to backtools");
            }
        }
    }
}
项目:CustomWorldGen    文件:Loader.java   
public void initializeMods()
{
    progressBar.step("Initializing mods Phase 2");
    // Mod controller should be in the initialization state here
    modController.distributeStateMessage(LoaderState.INITIALIZATION);
    progressBar.step("Initializing mods Phase 3");
    modController.transition(LoaderState.POSTINITIALIZATION, false);
    modController.distributeStateMessage(FMLInterModComms.IMCEvent.class);
    ItemStackHolderInjector.INSTANCE.inject();
    modController.distributeStateMessage(LoaderState.POSTINITIALIZATION);
    progressBar.step("Finishing up");
    modController.transition(LoaderState.AVAILABLE, false);
    modController.distributeStateMessage(LoaderState.AVAILABLE);
    PersistentRegistryManager.freezeData();
    FMLLog.info("Forge Mod Loader has successfully loaded %d mod%s", mods.size(), mods.size() == 1 ? "" : "s");
    progressBar.step("Completing Minecraft initialization");
}
项目:Possessed    文件:Possessed.java   
@Mod.EventHandler
public void onReceiveIMC(FMLInterModComms.IMCEvent event) {
    for (FMLInterModComms.IMCMessage message : event.getMessages()) {
        if (message.key.equalsIgnoreCase("possess_handler")) {
            if (message.isStringMessage()) {
                try {
                    Class<? extends EntityPossessHandler> clazz = (Class<? extends EntityPossessHandler>) Class.forName(message.getStringValue());
                    EntityPossessHandler handler = clazz.getDeclaredConstructor().newInstance();
                    PossessHandler.registerHandler(handler);
                } catch (Exception e) {
                    System.err.println("Received invalid IMC EntityPossessHandler class from mod " + message.getSender() + " (" + message.getStringValue() + ")");
                    e.printStackTrace();
                }
            }
        }
    }
}
项目:Toms-Mod    文件:ClientProxy.java   
@Override
public void postInit() {
    if (Loader.isModLoaded("VersionChecker")) {
        FMLInterModComms.sendRuntimeMessage(Reference.MOD_ID, "VersionChecker", "addVersionCheck", Reference.VersionURL);
    } else {
        VersionCheck versionCheck = new VersionCheck();
        Thread versionCheckThread = new Thread(versionCheck, "Version Check");
        versionCheckThread.start();
    }
    if (Loader.isModLoaded("CarpentersBlocks")) {
        MwChunk.carpenterdata();
    }
    if (Loader.isModLoaded("ForgeMultipart")) {
        MwChunk.FMPdata();

    }
    MwAPI.registerDataProvider("Slime", new OverlaySlime());
    MwAPI.registerDataProvider("Grid", new OverlayGrid());
}
项目:ExNihiloAdscensio    文件:ExNihiloAdscensio.java   
@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();
    }
}
项目:Factorization    文件:Compat_Railcraft.java   
@Override
public void init(FMLInitializationEvent event) {
/*    rollingmachine_recipes = RailcraftCraftingManager.rollingMachine.getRecipeList();
    crusher_recipes = RailcraftCraftingManager.rockCrusher.getRecipes();
    coke_oven = RailcraftCraftingManager.cokeOven.getRecipes();
    blast_furnace = RailcraftCraftingManager.blastFurnace.getRecipes(); */

    FMLInterModComms.sendMessage(DocumentationModule.modid, "AddRecipeCategory", "tile.railcraft.machine.alpha.rolling.machine.name|factorization.compat.railcraft.Compat_Railcraft|rollingmachine_recipes");
    //FMLInterModComms.sendMessage(DocumentationModule.modid, "AddRecipeCategory", "tile.railcraft.machine.alpha.rock.crusher.name|factorization.compat.railcraft.Compat_Railcraft|crusher_recipes");
    FMLInterModComms.sendMessage(DocumentationModule.modid, "AddRecipeCategory", "railcraft.gui.coke.oven|factorization.compat.railcraft.Compat_Railcraft|coke_oven");
    FMLInterModComms.sendMessage(DocumentationModule.modid, "AddRecipeCategory", "railcraft.gui.blast.furnace|factorization.compat.railcraft.Compat_Railcraft|blast_furnace");

    NBTTagCompound tag = new NBTTagCompound();
    tag.setString("category", "tile.railcraft.machine.alpha.rock.crusher.name|factorization.compat.railcraft.Compat_Railcraft|crusher_recipes");
    tag.setTag("input", list("getInput()"));
    tag.setTag("output", list("getPossibleOuputs()"));
    FMLInterModComms.sendMessage(DocumentationModule.modid, "AddRecipeCategoryGuided", tag);
}
项目:Cyclic    文件:InterModCommsRegistry.java   
/**
 * 
 * https://minecraft.curseforge.com/projects/crafting-tweaks https://github.com/blay09/CraftingTweaks/blob/1.12/README.md
 */
private static void registerCraftingTweaks() {
  //first the players inventory 
  NBTTagCompound tagCompound = new NBTTagCompound();
  tagCompound.setString("ContainerClass", ContainerPlayerExtWorkbench.class.getName());
  tagCompound.setInteger("GridSlotNumber", 6);
  //    tagCompound.setInteger("GridSize", 9);
  FMLInterModComms.sendMessage("craftingtweaks", "RegisterProvider", tagCompound);
  //then the grey workbench 
  tagCompound = new NBTTagCompound();
  tagCompound.setString("ContainerClass", ContainerWorkBench.class.getName());
  tagCompound.setInteger("GridSlotNumber", 1);
  FMLInterModComms.sendMessage("craftingtweaks", "RegisterProvider", tagCompound);
  //then the purple autocrafter
  tagCompound = new NBTTagCompound();
  tagCompound.setString("ContainerClass", ContainerCrafter.class.getName());
  tagCompound.setInteger("GridSlotNumber", 10);
  FMLInterModComms.sendMessage("craftingtweaks", "RegisterProvider", tagCompound);
}
项目:CreativeBlocks    文件:CreativeBlocks.java   
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent event)
{
    creativeBlockPlacer = new ItemCreativeBlockPlacer();
    GameRegistry.register(creativeBlockPlacer, blockPlacerResourceLocation);
    proxy.preInit(event);
    Config.preInit(event);
    sourceFile = event.getSourceFile();
    MinecraftForge.EVENT_BUS.register(this);

    JSONConfigHandler.setup(event.getModConfigurationDirectory());
    CreativeBlocksRegistry.init();
    NetworkHandler.init();


    FMLInterModComms.sendMessage("Waila", "register", "squeek.creativeblocks.integration.waila.WailaRegistrar.register");
    FMLInterModComms.sendMessage("VersionChecker", "addVersionCheck", "http://www.ryanliptak.com/minecraft/versionchecker/squeek502/CreativeBlocks");
}
项目:IvToolkit    文件:IvFMLIntercommHandler.java   
public void onIMCMessage(FMLInterModComms.IMCMessage message, boolean server, boolean runtime)
{
    try
    {
        boolean didHandle = handleMessage(message, server, runtime);

        if (!didHandle)
        {
            logger.warn("Could not handle message with key '" + message.key + "' of type '" + message.getMessageType().getName() + "'");
        }
    }
    catch (Exception ex)
    {
        logger.error("Exception on message with key '" + message.key + "' of type '" + message.getMessageType().getName() + "'");
        ex.printStackTrace();
    }
}
项目:SecurityCraft    文件:SecurityCraft.java   
@EventHandler
public void init(FMLInitializationEvent event){
    log("Setting up inter-mod stuff...");

    FMLInterModComms.sendMessage("Waila", "register", "net.geforcemods.securitycraft.imc.waila.WailaDataProvider.callbackRegister");

    if(config.checkForUpdates) {
        NBTTagCompound vcUpdateTag = VersionUpdateChecker.getNBTTagCompound();
        if(vcUpdateTag != null)
            FMLInterModComms.sendRuntimeMessage(MODID, "VersionChecker", "addUpdate", vcUpdateTag);
    }

    log("Registering mod content... (PT 2/2)");
    NetworkRegistry.INSTANCE.registerGuiHandler(this, guiHandler);
    RegistrationHandler.registerEntities();
    EnumCustomModules.refresh();
    serverProxy.registerRenderThings();
}
项目:SecurityCraft    文件:SecurityCraft.java   
@EventHandler
public void init(FMLInitializationEvent event){
    log("Setting up inter-mod stuff...");

    FMLInterModComms.sendMessage("waila", "register", "net.geforcemods.securitycraft.imc.waila.WailaDataProvider.callbackRegister");

    if(config.checkForUpdates) {
        NBTTagCompound vcUpdateTag = VersionUpdateChecker.getNBTTagCompound();
        if(vcUpdateTag != null)
            FMLInterModComms.sendRuntimeMessage(MODID, "VersionChecker", "addUpdate", vcUpdateTag);
    }

    log("Regisering mod content... (PT 2/2)");
    NetworkRegistry.INSTANCE.registerGuiHandler(this, guiHandler);
    RegistrationHandler.registerEntities();
    EnumCustomModules.refresh();
    serverProxy.registerRenderThings();
}
项目:SecurityCraft    文件:SecurityCraft.java   
@EventHandler
public void init(FMLInitializationEvent event){
    log("Setting up inter-mod stuff...");

    FMLInterModComms.sendMessage("Waila", "register", "net.geforcemods.securitycraft.imc.waila.WailaDataProvider.callbackRegister");

    if(config.checkForUpdates) {
        NBTTagCompound vcUpdateTag = VersionUpdateChecker.getNBTTagCompound();
        if(vcUpdateTag != null)
            FMLInterModComms.sendRuntimeMessage(MODID, "VersionChecker", "addUpdate", vcUpdateTag);
    }

    log("Registering mod content... (PT 2/2)");
    SecurityCraft.serverProxy.registerResourceLocations();
    NetworkRegistry.INSTANCE.registerGuiHandler(this, guiHandler);
    RegistrationHandler.registerEntities();
    EnumCustomModules.refresh();
    serverProxy.registerRenderThings();
}
项目:SecurityCraft    文件:SecurityCraft.java   
@EventHandler
public void init(FMLInitializationEvent event){
    log("Setting up inter-mod stuff...");

    FMLInterModComms.sendMessage("Waila", "register", "net.geforcemods.securitycraft.imc.waila.WailaDataProvider.callbackRegister");

    if(config.checkForUpdates) {
        NBTTagCompound vcUpdateTag = VersionUpdateChecker.getNBTTagCompound();
        if(vcUpdateTag != null)
            FMLInterModComms.sendRuntimeMessage(MODID, "VersionChecker", "addUpdate", vcUpdateTag);
    }

    log("Registering mod content... (PT 2/2)");
    SecurityCraft.serverProxy.registerResourceLocations();
    NetworkRegistry.INSTANCE.registerGuiHandler(this, guiHandler);
    RegistrationHandler.registerEntities();
    EnumCustomModules.refresh();
    serverProxy.registerRenderThings();
}
项目:SecurityCraft    文件:SecurityCraft.java   
@EventHandler
public void init(FMLInitializationEvent event){
    log("Setting up inter-mod stuff...");
    FMLInterModComms.sendMessage("waila", "register", "net.geforcemods.securitycraft.imc.waila.WailaDataProvider.callbackRegister");

    if(config.checkForUpdates) {
        NBTTagCompound vcUpdateTag = VersionUpdateChecker.getNBTTagCompound();
        if(vcUpdateTag != null)
            FMLInterModComms.sendRuntimeMessage(MODID, "VersionChecker", "addUpdate", vcUpdateTag);
    }

    log("Registering mod content... (PT 2/2)");
    NetworkRegistry.INSTANCE.registerGuiHandler(this, guiHandler);
    RegistrationHandler.registerEntities();
    EnumCustomModules.refresh();
    serverProxy.registerRenderThings();
}
项目:NotEnoughCodecs    文件:NotEnoughCodecs.java   
@EventHandler
public void handleIMC(IMCEvent evt) {
    NBTTagCompound extensions = new NBTTagCompound();
    NBTTagList data = new NBTTagList();
    for (Map.Entry<String, String> e : KNOWN_MIME_TYPES.entrySet()) {
        NBTTagCompound entry = new NBTTagCompound();
        entry.setString("mime", e.getKey());
        entry.setString("ext", e.getValue());
        data.appendTag(entry);
    }
    extensions.setTag("data", data);

    for (IMCMessage msg : evt.getMessages())
        if ("listCodecs".equalsIgnoreCase(msg.key)) {
            String sender = msg.getSender();
            Log.info("Received codec list request from %s, responding", sender);
            FMLInterModComms.sendMessage(sender, "knownCodecs", extensions);
        }
}
项目:ZeldaSwordSkills    文件:ZSSMain.java   
@Mod.EventHandler
public void load(FMLInitializationEvent event) {
    proxy.init();
    ZSSItems.init();
    MinecraftForge.EVENT_BUS.register(instance);
    MinecraftForge.EVENT_BUS.register(new ZSSCombatEvents());
    MinecraftForge.EVENT_BUS.register(new ZSSEntityEvents());
    MinecraftForge.EVENT_BUS.register(new ZSSItemEvents());
    NetworkRegistry.INSTANCE.registerGuiHandler(this, new GuiHandler());
    MinecraftForge.EVENT_BUS.register(new ZSSWorldGenEvent());
    if (Config.areBossDungeonsEnabled()) {
        ZSSBossDungeonGen dungeonGen = new ZSSBossDungeonGen();
        MinecraftForge.EVENT_BUS.register(dungeonGen);
        MinecraftForge.TERRAIN_GEN_BUS.register(dungeonGen);
    }
    if (Config.getGossipStoneRate() > 0) {
        MinecraftForge.EVENT_BUS.register(WorldGenGossipStones.INSTANCE);
    }
    MinecraftForge.EVENT_BUS.register(WorldGenJars.INSTANCE);
    FMLInterModComms.sendRuntimeMessage(ModInfo.ID, "VersionChecker", "addVersionCheck", ModInfo.VERSION_LIST);
}
项目:VersionChecker    文件:UpdateChecker.java   
@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();
    }
}
项目:VersionChecker    文件:VersionChecker.java   
@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();
}
项目:pnc-repressurized    文件:EnderIO.java   
private void registerFuel(Fluid fluid, int powerPerCycle, int burnTime) {
    NBTTagCompound tag = new NBTTagCompound();
    tag.setString("fluidName", fluid.getName());
    tag.setInteger("powerPerCycle", powerPerCycle);
    tag.setInteger("totalBurnTime", burnTime);
    FMLInterModComms.sendMessage(ModIds.EIO, "fluidFuel:add", tag);
}
项目:MobBlocker    文件:WailaCompatibility.java   
public static void register(){
    if (registered)
        return;
    registered = true;
    String mcVersion = Loader.instance().getMinecraftModContainer().getVersion();
    MobBlocker.logger.info(mcVersion);
    if (mcVersion.equals("1.10.2")) {
        FMLInterModComms.sendMessage("Waila", "register", "maxwell_lt.mobblocker.integration.WailaCompatibility.load");
        MobBlocker.logger.info("Sent IMC");
    } else FMLInterModComms.sendMessage("waila", "register", "maxwell_lt.mobblocker.integration.WailaCompatibility.load");
}
项目:DankNull    文件:TOP.java   
public static void init() {
    if (registered) {
        return;
    }
    ModLogger.info(Mods.TOP.getName() + " Integation: Enabled");
    registered = true;
    FMLInterModComms.sendFunctionMessage("theoneprobe", "getTheOneProbe", "p455w0rd.danknull.integration.TOP$GetTheOneProbe");
}
项目:interactionwheel    文件:InteractionWheel.java   
@Mod.EventHandler
public void imcCallback(FMLInterModComms.IMCEvent event) {
    for (FMLInterModComms.IMCMessage message : event.getMessages()) {
        if (message.key.equalsIgnoreCase("getTheWheel")) {
            Optional<Function<IInteractionWheel, Void>> value = message.getFunctionValue(IInteractionWheel.class, Void.class);
            if (value.isPresent()) {
                value.get().apply(interactionWheelImp);
            } else {
                logger.warn("Some mod didn't return a valid result with getTheWheel!");
            }
        }
    }
}
项目:Simple-Chunks    文件:TOPCompat.java   
public static void register()
{
    if (registered)
    {
        return;
    }

    registered = true;

    FMLInterModComms.sendFunctionMessage("theoneprobe", "getTheOneProbe", "net.darkmorford.simplechunks.compat.TOPCompat$GetTOP");
}
项目:Adventurers-Toolbox    文件:TConstructCompat.java   
public static void preInit() {
    //Add soulforged steel as a liquid
    if (Loader.isModLoaded("betterwithmods")) {
        Fluid soulforgedSteel = new Fluid("soulforged_steel", new ResourceLocation("tconstruct:blocks/fluids/molten_metal"), new ResourceLocation("tconstruct:blocks/fluids/molten_metal_flow"));
        FluidRegistry.registerFluid(soulforgedSteel);
        FluidRegistry.addBucketForFluid(soulforgedSteel);

        NBTTagCompound tag = new NBTTagCompound();
        tag.setString("fluid", soulforgedSteel.getName());
        tag.setString("ore", "SoulforgedSteel");
        tag.setBoolean("toolforge", false);
        FMLInterModComms.sendMessage("tconstruct", "integrateSmeltery", tag);
    }
}
项目:EndermanEvolution    文件:TOP.java   
public static void init() {
    if (registered) {
        return;
    }
    registered = true;
    FMLInterModComms.sendFunctionMessage("theoneprobe", "getTheOneProbe", "p455w0rd.endermanevo.integration.TOP$GetTheOneProbe");
}
项目:modName    文件:BiomeModule.java   
public static void fromIMC(FMLInterModComms.IMCMessage message) {
    if (!message.isNBTMessage()) {
        ExampleMod.logger.warn("Invalid IMC sent by {} - biomeModule expects NBT", message.getSender());
        return;
    }

    NBTTagCompound tag = message.getNBTValue();

    if (!tag.hasKey("name") || tag.getString("name").isEmpty()) {
        ExampleMod.logger.warn("Invalid IMC sent by {} - biomeModule requires a name in the 'name' tag", message.getSender());
        return;
    }
    if (!tag.hasKey("json") || tag.getString("json").isEmpty()) {
        ExampleMod.logger.warn("Invalid IMC sent by {} - biomeModule requires biome settings data in the 'json' tag", message.getSender());
        return;
    }

    BiomeSettings settings = new BiomeSettings();

    try {
        settings.readFromJson(tag.getString("json"));
    } catch (Exception e) {
        ExampleMod.logger.warn("Invalid IMC sent by {} - biomeModule received invalid biome json data", message.getSender());
        return;
    }

    BiomeModule module = new BiomeModule(tag.getString("name"), message.getSender(), settings, tag.getBoolean("enabled"));

    ExampleMod.globalRegistry.biomeModules.add(module);
}
项目:SAO-UI---1.8.8    文件:SAOCore.java   
@SuppressWarnings("unchecked")
@Mod.EventHandler
public void postInit(FMLPostInitializationEvent evt) {
    final Minecraft mc = Minecraft.getMinecraft();

    GLCore.setFont(mc, OptionCore.CUSTOM_FONT.getValue());
    FMLInterModComms.sendRuntimeMessage(SAOCore.MODID, "VersionChecker", "addVersionCheck", "https://gitlab.com/saomc/PublicVersions/raw/master/saoui1.8ver.json");
}
项目:FFS    文件:TOPCompatibility.java   
public static void register() {
    if(registered) {
        return;
    }

    registered = true;
    FMLInterModComms.sendFunctionMessage("theoneprobe", "getTheOneProbe", "com.lordmau5.ffs.compat.top.TOPCompatibility$GetTheOneProbe");
}
项目:interactionwheel    文件:InteractionWheel.java   
@Mod.EventHandler
public void imcCallback(FMLInterModComms.IMCEvent event) {
    for (FMLInterModComms.IMCMessage message : event.getMessages()) {
        if (message.key.equalsIgnoreCase("getTheWheel")) {
            Optional<Function<IInteractionWheel, Void>> value = message.getFunctionValue(IInteractionWheel.class, Void.class);
            if (value.isPresent()) {
                value.get().apply(interactionWheelImp);
            } else {
                logger.warn("Some mod didn't return a valid result with getTheWheel!");
            }
        }
    }
}
项目:Toms-Mod    文件:FuelHandler.java   
private static void callEnderio(Fluid fluid, int burnTime) {
    NBTTagCompound tag = new NBTTagCompound();
    tag.setString(EIOConstants.KEY_FLUID_NAME, fluid.getName());
    tag.setInteger(EIOConstants.KEY_TOTAL_BURN_TIME, Config.getEIOBurnTime(fluid.getName(), burnTime * 5));
    tag.setInteger(EIOConstants.KEY_POWER_PER_CYCLE, Config.getEIOPowerPerCycle(fluid.getName(), burnTime * 2 / 10));
    FMLInterModComms.sendMessage(Configs.EIO, EIOConstants.FLUID_FUEL_ADD, tag);
}
项目:BaseGems    文件:CommonProxy.java   
public void preInit(FMLPreInitializationEvent event) {

        Config.init();

        Materials.init();
        Fluids.init();
        ItemGroups.init();
        Blocks.init();
        Items.init();
        VillagerTrades.init();

        FMLInterModComms.sendFunctionMessage("orespawn", "api", "com.mcmoddev.orespawn.BaseGemsOreSpawn");

        IntegrationManager.INSTANCE.preInit(event);
    }
项目:EverythingBlocks    文件:EverythingBlocksAPI.java   
/** Call this method to override the default color of the specified ItemStack. NOTE: only use 
 * this for items you can't get access to (i.e, vanilla items). Otherwise, use IOverrideEBColor! */
public static void setCustomColorForItemStack(ItemStack stack, int colorOverride) {
    NBTTagCompound tag = new NBTTagCompound();
    stack.writeToNBT(tag);
    tag.setInteger("colorOverride", colorOverride);
    FMLInterModComms.sendMessage("EverythingBlocks", "stackColorOverride", tag);
}
项目:Dark-Utilities    文件:AddonHandler.java   
/**
 * Triggers the onInit method in all registered addons.
 */
public static void onInit () {

    if (Loader.isModLoaded("Waila")) {
        FMLInterModComms.sendMessage("Waila", "register", "net.darkhax.darkutils.addons.waila.DarkUtilsTileProvider.registerAddon");
    }

    for (final ModAddon addon : addonRegistry) {
        addon.onInit();
    }
}
项目:GraphLib    文件:GraphApiTest.java   
@EventHandler
public void init(FMLInitializationEvent event)
{
    proxy.init();

    FMLInterModComms.sendMessage("Waila", "register", "gigaherz.graph.api.WailaProviders.callbackRegister");
}
项目:Factorization    文件:Compat_erebus.java   
@Override
public void init(FMLInitializationEvent event) {
    compost_recipes = find("erebus.recipes.ComposterRegistry", "registry");
    if (compost_recipes != null) {
        FMLInterModComms.sendMessage(DocumentationModule.modid, "AddRecipeCategory", "container.composter|factorization.compat.erebus.Compat_erebus|compost_recipes");
    }
    offering_altar_recipes = find("erebus.recipes.OfferingAltarRecipe", "list");
    if (offering_altar_recipes != null) {
        FMLInterModComms.sendMessage(DocumentationModule.modid, "AddRecipeCategory", "tile.erebus.offeringAltar.name|factorization.compat.erebus.Compat_erebus|offering_altar_recipes");
    }
    smoothie_recipes = find("erebus.recipes.SmoothieMakerRecipe", "recipes");
    if (smoothie_recipes != null) {
        FMLInterModComms.sendMessage(DocumentationModule.modid, "AddRecipeCategory", "tile.erebus.smoothieMaker.name|factorization.compat.erebus.Compat_erebus|smoothie_recipes");
    }
}