Package cpw.mods.fml.common

Examples of cpw.mods.fml.common.ModContainer


      addOutput.invoke(recipe, new ItemStack(MineFactoryReloadedCore.factoryDecorativeStoneBlock, 1, 9), 1.0f); // Cobble Whitestone -> Gravel + flint
      addOutput.invoke(recipe, new ItemStack(Item.flint, 1, 0), 0.05f);
    }
    catch (Throwable _)
    {
      ModContainer This = FMLCommonHandler.instance().findContainerFor(this);
      FMLLog.log(This.getModId(), Level.SEVERE, "There was a problem loading %s.", This.getName());
      _.printStackTrace();
    }
  }
View Full Code Here


  }
 
  public static String getMod(ItemStack stack)
  {
    try {
      ModContainer mod = GameData.findModOwner(GameData.getItemRegistry().getNameForObject(stack.getItem()));
      return mod == null ? "Minecraft" : mod.getName();
    } catch(Exception e) {
      return "null";
    }
  }
View Full Code Here

            itemset.with(item);
        }

        API.addSubset("Mod.Minecraft", modSubsets.remove("minecraft"));
        for(Entry<String, ItemStackSet> entry : modSubsets.entrySet()) {
            ModContainer mc = FMLCommonHandler.instance().findContainerFor(entry.getKey());
            if(mc == null)
                NEIClientConfig.logger.error("Missing container for "+entry.getKey());
            else
                API.addSubset("Mod."+mc.getName(), entry.getValue());
        }
    }
View Full Code Here

            if(s.length() > 20)
                throw new IllegalArgumentException("Mod ID ("+s+") too long for use as channel (20 chars). Use a string identifier");
            return s;
        }

        ModContainer mc = FMLCommonHandler.instance().findContainerFor(channelKey);
        if (mc != null)
            return mc.getModId();

        throw new IllegalArgumentException("Invalid channel: " + channelKey);
    }
View Full Code Here

    public Plugin loadPlugin(File file) throws InvalidPluginException, UnknownDependencyException {
        if (file.getName().endsWith("fmlmod"))
        {
            String modName = file.getName().substring(0, file.getName().lastIndexOf("."));
            FMLLog.info("Attempting to load bukkit plugin for mod %s", modName);
            ModContainer mc = Loader.instance().getIndexedModList().get(modName);
            return null;
        }
        else
        {
            return super.loadPlugin(file);
View Full Code Here

    public PluginDescriptionFile getPluginDescription(File file) throws InvalidDescriptionException {
        if (file.getName().endsWith("fmlmod"))
        {
            String modName = file.getName().substring(0, file.getName().lastIndexOf("."));
            FMLLog.info("Scanning %s for bukkit plugin data", modName);
            ModContainer mc = Loader.instance().getIndexedModList().get(modName);
            String clName = BukkitContainer.instance.pluginManager.getBukkitPluginClass(mc);
            return new PluginDescriptionFile(mc.getModId(), mc.getVersion(), clName);
        }
        else
        {
            return super.getPluginDescription(file);
        }
View Full Code Here

      }
      return loaded;
    }
    @Override
    public String getModVersion(String name) {
            ModContainer mod = Loader.instance().getIndexedModList().get(name);
            if (mod == null) return null;
            return mod.getVersion();
    }
View Full Code Here

            else
                return server.getServerHostname();
        }
        @Override
        public File getModContainerFile(String name) {
            ModContainer mod = Loader.instance().getIndexedModList().get(name);
            if (mod == null) return null;
            return mod.getSource();
        }
View Full Code Here

        }

        @Override
        public InputStream openResource(String modid, String rname) {
            if (modid != null) {
                ModContainer mc = Loader.instance().getIndexedModList().get(modid);
                Object mod = mc.getMod();
                if (mod != null) {
                    InputStream is = mod.getClass().getClassLoader().getResourceAsStream(rname);
                    if (is != null) {
                        return is;
                    }
                }
            }
            List<ModContainer> mcl = Loader.instance().getModList();
            for (ModContainer mc : mcl) {
                Object mod = mc.getMod();
                if (mod == null) continue;
                InputStream is = mod.getClass().getClassLoader().getResourceAsStream(rname);
                if (is != null) {
                    return is;
                }
View Full Code Here

    private static Object handleMod(Class c)
    {
        String modid;
        Object obj = null;

        ModContainer contain = null;
        for (ModContainer container : Loader.instance().getModList())
        {
            if (container.getMod() != null && container.getMod().getClass().equals(c))
            {
                contain = container;
                obj = container.getMod();
                break;
            }
        }

        if (obj == null || contain == null)
        {
            throw new RuntimeException(c + " isn't an loaded mod class!");
        }

        modid = contain.getModId() + "--" + contain.getVersion();

        if (modClasses.add(c))
        {
            OutputHandler.felog.info("Modules from " + modid + " are being loaded");
        }
View Full Code Here

TOP

Related Classes of cpw.mods.fml.common.ModContainer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.