Java 类net.minecraftforge.common.ForgeVersion 实例源码

项目:CustomWorldGen    文件:FMLCommonHandler.java   
public void computeBranding()
{
    if (brandings == null)
    {
        Builder<String> brd = ImmutableList.builder();
        brd.add(Loader.instance().getMCVersionString());
        brd.add(Loader.instance().getMCPVersionString());
        brd.add("Powered by Forge " + ForgeVersion.getVersion());
        if (sidedDelegate!=null)
        {
            brd.addAll(sidedDelegate.getAdditionalBrandingInformation());
        }
        if (Loader.instance().getFMLBrandingProperties().containsKey("fmlbranding"))
        {
            brd.add(Loader.instance().getFMLBrandingProperties().get("fmlbranding"));
        }
        int tModCount = Loader.instance().getModList().size();
        int aModCount = Loader.instance().getActiveModList().size();
        brd.add(String.format("%d mod%s loaded, %d mod%s active", tModCount, tModCount!=1 ? "s" :"", aModCount, aModCount!=1 ? "s" :"" ));
        brandings = brd.build();
        brandingsNoMC = brandings.subList(1, brandings.size());
    }
}
项目:CustomWorldGen    文件:NotificationModUpdateScreen.java   
/**
 * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the
 * window resizes, the buttonList is cleared beforehand.
 */
@Override
public void initGui()
{
    if (!hasCheckedForUpdates)
    {
        if (modButton != null)
        {
            for (ModContainer mod : Loader.instance().getModList())
            {
                Status status = ForgeVersion.getResult(mod).status;
                if (status == Status.OUTDATED || status == Status.BETA_OUTDATED)
                {
                    // TODO: Needs better visualization, maybe stacked icons
                    // drawn in a terrace-like pattern?
                    showNotification = Status.OUTDATED;
                }
            }
        }
        hasCheckedForUpdates = true;
    }
}
项目:4Space-5    文件:ObfMapping.java   
public static File confDirectoryGuess(int i, ConfigTag tag) {
    File mcDir = (File) FMLInjectionData.data()[6];
    switch (i) {
        case 0:
            return tag.value != null ? new File(tag.getValue()) : null;
        case 1:
            return new File(mcDir, "../conf");
        case 2:
            return new File(mcDir, "../build/unpacked/conf");
        case 3:
            return new File(System.getProperty("user.home"), ".gradle/caches/minecraft/net/minecraftforge/forge/"+
                FMLInjectionData.data()[4]+"-"+ ForgeVersion.getVersion()+"/unpacked/conf");
        default:
            JFileChooser fc = new JFileChooser(mcDir);
            fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
            fc.setDialogTitle("Select an mcp conf dir for the deobfuscator.");
            int ret = fc.showDialog(null, "Select");
            return ret == JFileChooser.APPROVE_OPTION ? fc.getSelectedFile() : null;
    }
}
项目:muon    文件:MuonModContainer.java   
public URL getUpdateUrl() {
    String jsonURL = md.updateJSON;
    FMLLog.info("[Muon] %s", "Returning JSON url "+jsonURL);
    if (jsonURL != null && jsonURL != "")
    {
        jsonURL += "?version="+md.version+"&mcversion="+ForgeVersion.mcVersion+"&launcher="+Minecraft.getMinecraft().getVersion();
        try
        {
            return new URL(jsonURL);
        }
        catch (MalformedURLException e)
        {
            FMLLog.log(getModId(), Level.DEBUG, "Specified json URL invalid: %s", jsonURL);
        }
    }
    return null;
}
项目:CodeChickenCore    文件:CCUpdateChecker.java   
public static void updateCheck(final String mod, final String version) {
    updateCheck("http://www.chickenbones.net/Files/notification/version.php?" +
            "version=" + mcVersion() + "&" +
            "file=" + mod, new Function<String, Void>() {
        @Override
        public Void apply(String ret) {
            if (!ret.startsWith("Ret: ")) {
                CodeChickenCorePlugin.logger.error("Failed to check update for " + mod + " returned: " + ret);
                return null;
            }
            ComparableVersion newVersion = new ComparableVersion(ret.substring(5));
            if (newVersion.compareTo(new ComparableVersion(version)) > 0) {
                ModDescriptionEnhancer.setUpdateStatus(mod, ForgeVersion.Status.OUTDATED, newVersion);
                addUpdateMessage("Version " + newVersion + " of " + mod + " is available");
            }
            return null;
        }
    });
}
项目:ModLibary    文件:CoreLib.java   
/**
 * Constructor
 */
public CoreLib() {
    super(new ModMetadataFetcherCoreLib().getModmeta());

    // Allow access to cloudflare protected urls
    System.setProperty("http.agent", "Chrome");

    McVersionCompare versioncompare = new McVersionCompare(mcversion);

    if (!versioncompare.containsVersion(ForgeVersion.mcVersion)) {
        CrashReport crash = CrashReport.makeCrashReport(new WrongMinecraftVersionException(this), "Mcversion is not supported! Allowed: " + mcversion);
        CoreLib.getLogger().error(crash.getCompleteReport());
        FMLCommonHandler.instance().exitJava(0, true);
    }

    instance = this;
}
项目:ModLibary    文件:UpdaterInformation.java   
@SubscribeEvent
public void firstRender(RenderGameOverlayEvent event) {
    Minecraft mc = Minecraft.getMinecraft();
    if (!mc.inGameHasFocus || mc.thePlayer == null) {
        return;
    }
    if (!show) {
        show = true;
        for (ModContainer container : Loader.instance().getActiveModList()) {
            if (!container.getModId().startsWith("mcp") && !container.getModId().equalsIgnoreCase("mcp") && !container.getModId().equalsIgnoreCase("FML") && !container.getModId().equalsIgnoreCase("Forge")) {
                CheckResult res = ForgeVersion.getResult(container);
                if ((res != null && res.status != Status.PENDING) && res.status == Status.BETA_OUTDATED || res.status == Status.OUTDATED) {
                    IChatComponent comp = new ChatComponentText("\u00a7eNew version (\u00a77" + res.target + "\u00a7e) for\u00a7a " + container.getName() + " \u00a7eis available for Minecraft " + ForgeVersion.mcVersion + "!\n\u00a7bDownload at: \u00a7a" + res.url);
                    ChatStyle style = comp.getChatStyle();
                    style.setColor(EnumChatFormatting.YELLOW);
                    style.setChatHoverEvent(new HoverEvent(net.minecraft.event.HoverEvent.Action.SHOW_TEXT, new ChatComponentText("\u00a7cClick to open download page.")));
                    style.setChatClickEvent(new ClickEvent(net.minecraft.event.ClickEvent.Action.OPEN_URL, res.url));
                    comp.setChatStyle(style);
                    mc.thePlayer.addChatComponentMessage(comp);
                }
            }
        }
    }
}
项目:SimpleMenu    文件:GuiNewMainMenu.java   
@Override
public void drawScreen(int mouseX, int mouseY, float partialTick) {
    if (!renderWorld) {
        drawDefaultBackground();
        this.mc.renderEngine.func_110577_a(backgroundImageLocation);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        int[] d = getPositions();
        drawTexRect(d[0], d[1], d[2], d[3]);
    }

    this.mc.renderEngine.func_110577_a(brandingResourceLocation);
    drawTexRect(startX, startY - brandingHeight, brandingWidth, brandingHeight);

    for (GButton btn : buttons) {
        btn.drawButton(mouseX, mouseY);
    }

    Gui.drawRect(0, height - 12, fontRenderer.getStringWidth("Minecraft " + mcVersion + "/Forge " + ForgeVersion.getVersion()) + 5, height, new Color(0, 0, 0, 150).getRGB());
    fontRenderer.drawString("Minecraft " + mcVersion + "/Forge " + ForgeVersion.getVersion(), 2, height - 9, new Color(255, 255, 255, 255).getRGB());

}
项目:CreeperHostGui    文件:CreeperHostServer.java   
public void setupPlayerKicker()
{

    if (kicker == null)
    {
        String className = "net.creeperhost.minetogether.serverstuffs.hacky.NewPlayerKicker";
        String mcVersion;
        try
        {
            /*
            We need to get this at runtime as Java is smart and interns final fields.
            Certainly not the dirtiest hack we do in this codebase.
            */
            mcVersion = (String) ForgeVersion.class.getField("mcVersion").get(null);
        }
        catch (Throwable e)
        {
            mcVersion = "unknown"; // will default to new method
        }
        if (oldVersions.contains(mcVersion))
        {
            className = "net.creeperhost.minetogether.serverstuffs.hacky.OldPlayerKicker";
        }

        try
        {
            Class clazz = Class.forName(className);
            kicker = (IPlayerKicker) clazz.newInstance();
        }
        catch (Throwable t)
        {
        }
    }
}
项目:CreeperHostGui    文件:EventHandler.java   
private ResourceLocation getToastResourceLocation()
{
    if (mcVersion == null)
        try
        {
            /*
            We need to get this at runtime as Java is smart and interns final fields.
            Certainly not the dirtiest hack we do in this codebase.
            */
            mcVersion = (String) ForgeVersion.class.getField("mcVersion").get(null);
        }
        catch (Throwable e)
        {
            mcVersion = "unknown"; // will default to new method
        }
    String[] split = mcVersion.split("\\.");
    if (split.length >= 2)
    {
        if (split[1].equals("10") || split[1].equals("11") || split[1].equals("9") || split[1].equals("7"))
        {
            u = 96;
            v = 202;
            return earlyResource;
        }
    }
    return newResouce;
}
项目:CreeperHostGui    文件:Util.java   
public static IBufferProxy getBufferProxy()
{
    if (proxyGetter == null)
    {
        String className = "net.creeperhost.minetogether.gui.hacky.BufferProxyGetterNew";
        String mcVersion;
        try
        {
            /*
            We need to get this at runtime as Java is smart and interns final fields.
            Certainly not the dirtiest hack we do in this codebase.
            */
            mcVersion = (String) ForgeVersion.class.getField("mcVersion").get(null);
        }
        catch (Throwable e)
        {
            mcVersion = "unknown"; // will default to new method
        }
        if (oldVersions.contains(mcVersion))
        {
            className = "net.creeperhost.minetogether.gui.hacky.BufferProxyGetterOld";
        }

        try
        {
            Class clazz = Class.forName(className);
            proxyGetter = (IBufferProxyGetter) clazz.newInstance();
        }
        catch (Throwable t)
        {
            t.printStackTrace();
        }
    }

    return proxyGetter.get();
}
项目:CreeperHostGui    文件:Util.java   
public static IServerListEntryWrapper getWrapper()
{
    if (wrapper == null)
    {
        String className = "net.creeperhost.minetogether.gui.hacky.ServerListEntryWrapperNew";
        String mcVersion;
        try
        {
            /*
            We need to get this at runtime as Java is smart and interns final fields.
            Certainly not the dirtiest hack we do in this codebase.
            */
            mcVersion = (String) ForgeVersion.class.getField("mcVersion").get(null);
        }
        catch (Throwable e)
        {
            mcVersion = "unknown"; // will default to new method
        }
        if (oldVersions.contains(mcVersion))
        {
            className = "net.creeperhost.minetogether.gui.hacky.ServerListEntryWrapperOld";
        }

        try
        {
            Class clazz = Class.forName(className);
            wrapper = (IServerListEntryWrapper) clazz.newInstance();
        }
        catch (Throwable t)
        {
            t.printStackTrace();
        }
    }

    return wrapper;
}
项目:Autotip    文件:UniversalUtil.java   
public static String getMinecraftVersion() {
    try {
        Field f = getField(ForgeVersion.class, "mcVersion");
        if (f != null) {
            return (String) f.get(null);
        } else {
            return "1.8";
        }
    } catch (IllegalAccessException e) {
        e.printStackTrace();
        return "1.8";
    }
}
项目:CustomWorldGen    文件:FMLInjectionData.java   
static void build(File mcHome, LaunchClassLoader classLoader)
{
    minecraftHome = mcHome;
    major = String.valueOf(ForgeVersion.majorVersion);
    minor = String.valueOf(ForgeVersion.minorVersion);
    rev = String.valueOf(ForgeVersion.revisionVersion);
    build = String.valueOf(ForgeVersion.buildVersion);
    mccversion = ForgeVersion.mcVersion;
    mcpversion = ForgeVersion.mcpVersion;
}
项目:CustomWorldGen    文件:GuiSlotModList.java   
@Override
protected void drawSlot(int idx, int right, int top, int height, Tessellator tess)
{
    ModContainer mc       = mods.get(idx);
    String       name     = StringUtils.stripControlCodes(mc.getName());
    String       version  = StringUtils.stripControlCodes(mc.getDisplayVersion());
    FontRenderer font     = this.parent.getFontRenderer();
    CheckResult  vercheck = ForgeVersion.getResult(mc);

    if (Loader.instance().getModState(mc) == ModState.DISABLED)
    {
        font.drawString(font.trimStringToWidth(name,       listWidth - 10), this.left + 3 , top +  2, 0xFF2222);
        font.drawString(font.trimStringToWidth(version,    listWidth - (5 + height)), this.left + 3 , top + 12, 0xFF2222);
        font.drawString(font.trimStringToWidth("DISABLED", listWidth - 10), this.left + 3 , top + 22, 0xFF2222);
    }
    else
    {
        font.drawString(font.trimStringToWidth(name,    listWidth - 10), this.left + 3 , top +  2, 0xFFFFFF);
        font.drawString(font.trimStringToWidth(version, listWidth - (5 + height)), this.left + 3 , top + 12, 0xCCCCCC);
        font.drawString(font.trimStringToWidth(mc.getMetadata() != null ? mc.getMetadata().getChildModCountString() : "Metadata not found", listWidth - 10), this.left + 3 , top + 22, 0xCCCCCC);

        if (vercheck.status.shouldDraw())
        {
            //TODO: Consider adding more icons for visualization
            Minecraft.getMinecraft().getTextureManager().bindTexture(VERSION_CHECK_ICONS);
            GlStateManager.color(1, 1, 1, 1);
            GlStateManager.pushMatrix();
            Gui.drawModalRectWithCustomSizedTexture(right - (height / 2 + 4), top + (height / 2 - 4), vercheck.status.getSheetOffset() * 8, (vercheck.status.isAnimated() && ((System.currentTimeMillis() / 800 & 1)) == 1) ? 8 : 0, 8, 8, 64, 16);
            GlStateManager.popMatrix();
        }
    }
}
项目:CustomWorldGen    文件:ForgeGuiFactory.java   
@Override
protected GuiScreen buildChildScreen()
{
    ConfigCategory cfg = ForgeModContainer.getConfig().getCategory(VERSION_CHECK_CAT);
    Map<String, Property> values = new HashMap<String, Property>(cfg.getValues());
    values.remove("Global");

    Property global = ForgeModContainer.getConfig().get(VERSION_CHECK_CAT, "Global", true);

    List<Property> props = new ArrayList<Property>();

    for (ModContainer mod : ForgeVersion.gatherMods().keySet())
    {
        values.remove(mod.getModId());
        props.add(ForgeModContainer.getConfig().get(VERSION_CHECK_CAT, mod.getModId(), true)); //Get or make the value in the config
    }
    props.addAll(values.values()); // Add any left overs from the config
    Collections.sort(props, new Comparator<Property>()
    {
        @Override
        public int compare(Property o1, Property o2)
        {
            return o1.getName().compareTo(o2.getName());
        }
    });

    List<IConfigElement> list = new ArrayList<IConfigElement>();
    list.add(new ConfigElement(global));
    for (Property prop : props)
    {
        list.add(new ConfigElement(prop));
    }

    // This GuiConfig object specifies the configID of the object and as such will force-save when it is closed. The parent
    // GuiConfig object's propertyList will also be refreshed to reflect the changes.
    return new GuiConfig(this.owningScreen,
            list,
            this.owningScreen.modID, VERSION_CHECK_CAT, true, true,
            GuiConfig.getAbridgedConfigPath(ForgeModContainer.getConfig().toString()));
}
项目:muon    文件:MuonModContainer.java   
@SubscribeEvent
public void playerJoin(final EntityJoinWorldEvent event) {
    if (!updateMsgDone && !event.isCanceled() && event.getWorld().isRemote && (event.getEntity() instanceof EntityPlayer)) {
        final EntityPlayer player = (EntityPlayer) event.getEntity();
        ForgeVersion.CheckResult versioncheck = ForgeVersion.getResult(this);
        if (player != null && !player.isDead && versioncheck != null && (versioncheck.status == ForgeVersion.Status.OUTDATED || versioncheck.status == ForgeVersion.Status.BETA_OUTDATED)) {
            String msg = "Version "+versioncheck.target+" of "+getMCModInfo().name+" is available";
            player.sendMessage(new TextComponentString(msg));
        }
        updateMsgDone = true;
    }
}
项目:CodeChickenCore    文件:ModDescriptionEnhancer.java   
public static void setUpdateStatus(ModContainer container, CheckResult result) {
    try {
        Map<ModContainer, CheckResult> resultMap = ReflectionManager.getField(ForgeVersion.class, Map.class, null, "results");
        synchronized (resultMap) {
            resultMap.put(container, result);
        }

    } catch (Exception e) {
        e.printStackTrace();
    }
}
项目:DynamicSurroundings    文件:VersionChecker.java   
@Nullable
private String getUpdateMessage(@Nonnull final String modId) {
    final ModContainer mod = ForgeUtils.findModContainer(modId);
    if (mod == null)
        return null;
    final CheckResult result = ForgeVersion.getResult(mod);
    if (dontPrintMessage(result))
        return null;
    final String t = result.target.toString();
    final String u = result.url.toString();
    return Localization.format(this.messageId, mod.getName(), t, u);
}
项目:MC-Prefab    文件:UpdateChecker.java   
/**
 * Checks the current version against the git-hub version.
 */
public static void checkVersion()
{
    // Pull the repository information.
    ModContainer prefabMod = null;

    for (ModContainer modContainer : Loader.instance().getModList())
    {
        if (modContainer.getName().toLowerCase().equals(Prefab.MODID.toLowerCase()))
        {
            prefabMod = modContainer;
            break;
        }
    }

    if (prefabMod != null)
    {
        CheckResult result = ForgeVersion.getResult(prefabMod);

        if (result != null && result.status == Status.OUTDATED)
        {
            // Current version is out dated, show the message when the user is logged in.
            UpdateChecker.messageToShow = "[Prefab] There is a new version available! New Version: [" + result.target.toString() + "] Your Version: ["
                    + Prefab.VERSION + "]";

            UpdateChecker.showMessage = true;
        }
    }
}
项目:DiscordCE    文件:MixpanelUtil.java   
/**
 * Sends a track event with game startup information
 *
 * @param runAsync Whether or not to run async
 */
public static void setStartGameEvent(boolean runAsync)
{
    // Stopping if user does not want to send this kind of event
    if (!Config.trackGameStart)
        return;

    Runnable r = () ->
    {
        TimeZone tz = Calendar.getInstance().getTimeZone();
        Date now = Calendar.getInstance().getTime();
        String time = new SimpleDateFormat("EEEE, MMMM d, YYYY h:mma").format(now);

        JSONObject props = new JSONObject()
                .put("forge_version", ForgeVersion.getVersion())
                .put("mc_version", MinecraftForge.MC_VERSION)
                .put("language", FMLCommonHandler.instance().getCurrentLanguage())
                .put("dce_version", Reference.VERSION);

        MixpanelUtil.sendEvent("Start Game", props);
    };

    // Running async
    if (runAsync)
        ConcurrentUtil.executor.execute(r);

    // Run sync
    else
        r.run();
}
项目:parachute    文件:Parachute.java   
@SuppressWarnings("unused")
@Mod.EventHandler
public void Construct(FMLConstructionEvent event) {
    int buildVersion = ForgeVersion.getBuildVersion();
    int minimumForgeBuildVersion = 2555;
    if (buildVersion < minimumForgeBuildVersion) {
        error(String.format("This mod requires Forge Mod Loader build version of %d or higher", minimumForgeBuildVersion));
        error(String.format("You are running Forge Mod Loader build version %d", buildVersion));
    }
}
项目:LunatriusCore    文件:ForgeVersionCheck.java   
public static ForgeVersion.Status getStatus(final ComparableVersion versionRemote, final ComparableVersion versionLocal) {
    final int diff = versionRemote.compareTo(versionLocal);

    if (diff == 0) {
        return ForgeVersion.Status.UP_TO_DATE;
    }

    if (diff > 0) {
        return ForgeVersion.Status.OUTDATED;
    }

    return ForgeVersion.Status.AHEAD;
}
项目:LunatriusCore    文件:ForgeVersionCheck.java   
public static void notify(final ModContainer container, final ForgeVersion.Status status, final ComparableVersion target, final Map<ComparableVersion, String> changes, final String url) {
    try {
        final Map<ModContainer, ForgeVersion.CheckResult> versionMap = getVersionMap();
        final ForgeVersion.CheckResult checkResult = getCheckResult(status, target, changes, url);

        if (versionMap != null && checkResult != null) {
            versionMap.put(container, checkResult);
        }
    } catch (final Throwable t) {
        Reference.logger.error("Failed to notify Forge!", t);
    }
}
项目:LunatriusCore    文件:ForgeVersionCheck.java   
@SuppressWarnings({ "unchecked" })
private static Map<ModContainer, ForgeVersion.CheckResult> getVersionMap() throws ReflectiveOperationException {
    try {
        final Field field = ForgeVersion.class.getDeclaredField("results");
        field.setAccessible(true);
        return (Map<ModContainer, ForgeVersion.CheckResult>) field.get(null);
    } catch (final Throwable t) {
        Reference.logger.error("Failed to get the version map!", t);
    }

    return null;
}
项目:LunatriusCore    文件:ForgeVersionCheck.java   
private static ForgeVersion.CheckResult getCheckResult(final ForgeVersion.Status status, final ComparableVersion target, final Map<ComparableVersion, String> changes, final String url) throws ReflectiveOperationException {
    try {
        final Constructor<?> constructor = ForgeVersion.CheckResult.class.getDeclaredConstructor(ForgeVersion.Status.class, ComparableVersion.class, Map.class, String.class);
        constructor.setAccessible(true);
        return (ForgeVersion.CheckResult) constructor.newInstance(status, target, changes, url);
    } catch (final Throwable t) {
        Reference.logger.error("Failed to construct the CheckResult object!", t);
    }

    return null;
}
项目:MC-Ray-Tracer    文件:TheMod.java   
@EventHandler
public void init(FMLInitializationEvent event)
{
    Log.info("" + ForgeVersion.mcVersion);
    MinecraftForge.EVENT_BUS.register(new mod.id107.raytracer.coretransform.EventHandler());
}
项目:ForgeHax    文件:MCVersionChecker.java   
public static String getMcVersion() {
    return ForgeVersion.mcVersion;
}
项目:flex-fov    文件:TheMod.java   
@EventHandler
public void init(FMLInitializationEvent event)
{
    Log.info("" + ForgeVersion.mcVersion);
}
项目:MercuriusUpdater    文件:MercuriusUpdaterMod.java   
@EventHandler
public void preInit(FMLPreInitializationEvent e)
{
    if (Loader.isModLoaded("mercurius"))
    {
        LogHelper.info("Normal Mercurius found, disabeling stub");
        return;
    }

    File librariesDir = Utils.findMaven(MinecraftForge.class, e.getSide() == Side.CLIENT);
    if (librariesDir == null)
        return;

    File libFile = Utils.updateMercurius(librariesDir, ForgeVersion.mcVersion);
    if (libFile == null)
    {
        LogHelper.fatal("Mercurius Updating failed");
        return;
    }


    try
    {
        ClassLoader cl = addClassPath(MercuriusUpdaterMod.class.getClassLoader(), libFile);
        if (cl == null)
        {
            LogHelper.fatal("Could not add Mercurius to class path! ClassLoaders:");
            cl = MercuriusUpdaterMod.class.getClassLoader();
            while (cl != null)
            {
                LogHelper.fatal("  " + cl.getClass().getName());
                cl = cl.getParent();
            }
            return;
        }
        loadedMercurius = cl.loadClass("net.minecraftforge.mercurius.StatsMod");
        loadedMercuriusInstance = loadedMercurius.newInstance();
    }
    catch (Exception e1)
    {
        e1.printStackTrace();
    }

    invokeEvent("preInit", e);
}
项目:MercuriusUpdater    文件:MercuriusUpdaterMod.java   
@EventHandler
public void preInit(FMLPreInitializationEvent e)
{
    if (Loader.isModLoaded("mercurius"))
    {
        LogHelper.info("Normal Mercurius found, disabeling stub");
        return;
    }

    File librariesDir = Utils.findMaven(MinecraftForge.class, e.getSide() == Side.CLIENT);
    if (librariesDir == null)
        return;

    File libFile = Utils.updateMercurius(librariesDir, ForgeVersion.mcVersion);
    if (libFile == null)
    {
        LogHelper.fatal("Mercurius Updating failed");
        return;
    }


    try
    {
        ClassLoader cl = addClassPath(MercuriusUpdaterMod.class.getClassLoader(), libFile);
        if (cl == null)
        {
            LogHelper.fatal("Could not add Mercurius to class path! ClassLoaders:");
            cl = MercuriusUpdaterMod.class.getClassLoader();
            while (cl != null)
            {
                LogHelper.fatal("  " + cl.getClass().getName());
                cl = cl.getParent();
            }
            return;
        }
        loadedMercurius = cl.loadClass("net.minecraftforge.mercurius.StatsMod");
        loadedMercuriusInstance = loadedMercurius.newInstance();
    }
    catch (Exception e1)
    {
        e1.printStackTrace();
    }

    invokeEvent("preInit", e);
}
项目:MercuriusUpdater    文件:MercuriusUpdaterMod.java   
@EventHandler
public void preInit(FMLPreInitializationEvent e)
{
    if (Loader.isModLoaded("mercurius"))
    {
        LogHelper.info("Normal Mercurius found, disabeling stub");
        return;
    }

    File librariesDir = Utils.findMaven(MinecraftForge.class, e.getSide() == Side.CLIENT);
    if (librariesDir == null)
        return;

    File libFile = Utils.updateMercurius(librariesDir, ForgeVersion.mcVersion);
    if (libFile == null)
    {
        LogHelper.fatal("Mercurius Updating failed");
        return;
    }


    try
    {
        ClassLoader cl = addClassPath(MercuriusUpdaterMod.class.getClassLoader(), libFile);
        if (cl == null)
        {
            LogHelper.fatal("Could not add Mercurius to class path! ClassLoaders:");
            cl = MercuriusUpdaterMod.class.getClassLoader();
            while (cl != null)
            {
                LogHelper.fatal("  " + cl.getClass().getName());
                cl = cl.getParent();
            }
            return;
        }
        loadedMercurius = cl.loadClass("net.minecraftforge.mercurius.StatsMod");
        loadedMercuriusInstance = loadedMercurius.newInstance();
    }
    catch (Exception e1)
    {
        e1.printStackTrace();
    }

    invokeEvent("preInit", e);
}
项目:MercuriusUpdater    文件:MercuriusUpdaterMod.java   
@EventHandler
public void preInit(FMLPreInitializationEvent e)
{
    if (Loader.isModLoaded("mercurius"))
    {
        LogHelper.info("Normal Mercurius found, disabeling stub");
        return;
    }

    File librariesDir = Utils.findMaven(MinecraftForge.class, e.getSide() == Side.CLIENT);
    if (librariesDir == null)
        return;

    File libFile = Utils.updateMercurius(librariesDir, ForgeVersion.mcVersion);
    if (libFile == null)
    {
        LogHelper.fatal("Mercurius Updating failed");
        return;
    }


    try
    {
        ClassLoader cl = addClassPath(MercuriusUpdaterMod.class.getClassLoader(), libFile);
        if (cl == null)
        {
            LogHelper.fatal("Could not add Mercurius to class path! ClassLoaders:");
            cl = MercuriusUpdaterMod.class.getClassLoader();
            while (cl != null)
            {
                LogHelper.fatal("  " + cl.getClass().getName());
                cl = cl.getParent();
            }
            return;
        }
        loadedMercurius = cl.loadClass("net.minecraftforge.mercurius.StatsMod");
        loadedMercuriusInstance = loadedMercurius.newInstance();
    }
    catch (Exception e1)
    {
        e1.printStackTrace();
    }

    invokeEvent("preInit", e);
}
项目:MercuriusUpdater    文件:MercuriusUpdaterMod.java   
@EventHandler
public void preInit(FMLPreInitializationEvent e)
{
    if (Loader.isModLoaded("mercurius"))
    {
        LogHelper.info("Normal Mercurius found, disabeling stub");
        return;
    }

    File librariesDir = Utils.findMaven(MinecraftForge.class, e.getSide() == Side.CLIENT);
    if (librariesDir == null)
        return;

    File libFile = Utils.updateMercurius(librariesDir, ForgeVersion.mcVersion);
    if (libFile == null)
    {
        LogHelper.fatal("Mercurius Updating failed");
        return;
    }


    try
    {
        ClassLoader cl = addClassPath(MercuriusUpdaterMod.class.getClassLoader(), libFile);
        if (cl == null)
        {
            LogHelper.fatal("Could not add Mercurius to class path! ClassLoaders:");
            cl = MercuriusUpdaterMod.class.getClassLoader();
            while (cl != null)
            {
                LogHelper.fatal("  " + cl.getClass().getName());
                cl = cl.getParent();
            }
            return;
        }
        loadedMercurius = cl.loadClass("net.minecraftforge.mercurius.StatsMod");
        loadedMercuriusInstance = loadedMercurius.newInstance();
    }
    catch (Exception e1)
    {
        e1.printStackTrace();
    }

    invokeEvent("preInit", e);
}
项目:Toms-Mod    文件:CoreInit.java   
@EventHandler
public static void PostLoad(FMLPostInitializationEvent PostEvent) {
    log.info("Start Post Initialization");
    long tM = System.currentTimeMillis();
    proxy.postInit();
    TomsModAPIMain.init();
    log.info("Setting Max Stack Size of Minecarts to " + Config.minecartMaxStackSize + ".");
    Items.MINECART.setMaxStackSize(Config.minecartMaxStackSize);
    Items.CHEST_MINECART.setMaxStackSize(Config.minecartMaxStackSize);
    Items.TNT_MINECART.setMaxStackSize(Config.minecartMaxStackSize);
    Items.FURNACE_MINECART.setMaxStackSize(Config.minecartMaxStackSize);
    Items.HOPPER_MINECART.setMaxStackSize(Config.minecartMaxStackSize);
    versionCheckResult = ForgeVersion.getResult(mc);
    Logger vcLog = LogManager.getLogger(Configs.ModName + "] [Version Checker");
    if (versionCheckResult.status == Status.OUTDATED) {
        vcLog.warn("****************************************");
        vcLog.warn("* Tom's Mod is OUTDATED!!");
        vcLog.warn("* Current version: " + Configs.version);
        vcLog.warn("* Online version: " + versionCheckResult.target.toString());
        vcLog.warn("****************************************");
    } else if (versionCheckResult.status == Status.AHEAD) {
        vcLog.warn("??? status == AHEAD ???");
        vcLog.warn("?? Current version: " + Configs.version);
    } else if (versionCheckResult.status == Status.PENDING || versionCheckResult.status == Status.FAILED) {
        vcLog.warn("Tom's Mod version checking failed.");
    } else {
        vcLog.info("Tom's Mod is up to date");
    }
    String[] tools = new String[]{"!_axe", "!_pickaxe", "!_shovel", "!_sword", "!_hoe"};
    List<String> toNerf = new ArrayList<>();
    if (Config.nerfedTools != null && Config.nerfedTools.length > 0)
        Stream.of(Config.nerfedTools).map(ResourceLocation::new).filter(Item.REGISTRY::containsKey).map(ResourceLocation::toString).forEach(toNerf::add);
    if (Config.disableWoodenTools) {
        log.info("Nerfing wooden tools");
        Stream.of(tools).map(t -> t.replace("!", "wooden")).forEach(toNerf::add);
    }
    if (Config.disableStoneTools) {
        log.info("Nerfing stone tools");
        Stream.of(tools).map(t -> t.replace("!", "stone")).forEach(toNerf::add);
    }
    if (Config.disableIronTools) {
        log.info("Nerfing iron tools");
        Stream.of(tools).map(t -> t.replace("!", "iron")).forEach(toNerf::add);
    }
    if (Config.disableGoldTools) {
        log.info("Nerfing gold tools");
        Stream.of(tools).map(t -> t.replace("!", "gold")).forEach(toNerf::add);
    }
    if (Config.disableDiamondTools) {
        log.info("Nerfing diamond tools");
        Stream.of(tools).map(t -> t.replace("!", "diamond")).forEach(toNerf::add);
    }
    if (Config.enableHardModeStarting) {
        log.info("Overwriting Wood Harvest Levels");
        hackedWood = new HackedWoodMaterial();
        List<ItemStack> list = new ArrayList<>(OreDictionary.getOres("logWood"));
        list.addAll(OreDictionary.getOres("plankWood"));
        list.addAll(OreDictionary.getOres("slabWood"));
        list.addAll(OreDictionary.getOres("stairWood"));
        for (ItemStack stack : list) {
            Block block = Block.getBlockFromItem(stack.getItem());
            if (block != Blocks.AIR) {
                block.setHarvestLevel("axe", 0);
                TomsModUtils.trySetFinalField(Block.class, Material.class, block, hackedWood, log, "Failed to set Material value for " + block.getUnlocalizedName());
            }
        }
    }
    toNerf.stream().map(ResourceLocation::new).map(Item.REGISTRY::getObject).filter(i -> i != null).forEach(CoreInit::nerfTool);
    Config.initFluids();
    Config.printWarnings();
    long time = System.currentTimeMillis() - tM;
    log.info("Post Initialization took in " + time + " milliseconds");
}
项目:JustEnoughButtons    文件:ClientProxy.java   
private static void versionCheck() {
    final NBTTagCompound compound = new NBTTagCompound();
    compound.setString("curseProjectName", "just-enough-buttons");
    compound.setString("curseFilenameParser", "justenoughbuttons-" + ForgeVersion.mcVersion + "-[].jar");
    FMLInterModComms.sendRuntimeMessage(JEIButtons.MODID, "VersionChecker", "addCurseCheck", compound);
}
项目:Minecraft-Flux    文件:MCFluxReport.java   
private static Map<String, Object> addCustomInfo() {
    Map<String, Object> cm = new HashMap<>();
    cm.put("Forge", ForgeVersion.getVersion());
    cm.put("Mods", Loader.instance().getIndexedModList().keySet().toArray());
    return cm;
}
项目:ARKCraft    文件:ARKCraft.java   
public static void updateCheckResult()
{
    CheckResult r = ForgeVersion.getResult(modContainer);
    if (r != null && r.status != Status.PENDING) versionCheckResult = r;
}