本文整理汇总了Java中net.minecraftforge.common.ForgeVersion类的典型用法代码示例。如果您正苦于以下问题:Java ForgeVersion类的具体用法?Java ForgeVersion怎么用?Java ForgeVersion使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ForgeVersion类属于net.minecraftforge.common包,在下文中一共展示了ForgeVersion类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: computeBranding
import net.minecraftforge.common.ForgeVersion; //导入依赖的package包/类
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());
}
}
示例2: initGui
import net.minecraftforge.common.ForgeVersion; //导入依赖的package包/类
/**
* 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;
}
}
示例3: confDirectoryGuess
import net.minecraftforge.common.ForgeVersion; //导入依赖的package包/类
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;
}
}
示例4: getUpdateUrl
import net.minecraftforge.common.ForgeVersion; //导入依赖的package包/类
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;
}
示例5: updateCheck
import net.minecraftforge.common.ForgeVersion; //导入依赖的package包/类
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;
}
});
}
示例6: CoreLib
import net.minecraftforge.common.ForgeVersion; //导入依赖的package包/类
/**
* 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;
}
示例7: firstRender
import net.minecraftforge.common.ForgeVersion; //导入依赖的package包/类
@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);
}
}
}
}
}
示例8: drawScreen
import net.minecraftforge.common.ForgeVersion; //导入依赖的package包/类
@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());
}
示例9: setupPlayerKicker
import net.minecraftforge.common.ForgeVersion; //导入依赖的package包/类
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)
{
}
}
}
示例10: getToastResourceLocation
import net.minecraftforge.common.ForgeVersion; //导入依赖的package包/类
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;
}
示例11: getBufferProxy
import net.minecraftforge.common.ForgeVersion; //导入依赖的package包/类
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();
}
示例12: getWrapper
import net.minecraftforge.common.ForgeVersion; //导入依赖的package包/类
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;
}
示例13: getMinecraftVersion
import net.minecraftforge.common.ForgeVersion; //导入依赖的package包/类
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";
}
}
示例14: build
import net.minecraftforge.common.ForgeVersion; //导入依赖的package包/类
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;
}
示例15: drawSlot
import net.minecraftforge.common.ForgeVersion; //导入依赖的package包/类
@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();
}
}
}