本文整理汇总了Java中net.minecraft.util.EnumOS类的典型用法代码示例。如果您正苦于以下问题:Java EnumOS类的具体用法?Java EnumOS怎么用?Java EnumOS使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
EnumOS类属于net.minecraft.util包,在下文中一共展示了EnumOS类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isWindows
import net.minecraft.util.EnumOS; //导入依赖的package包/类
public static boolean isWindows() {
return Minecraft.getOs() == EnumOS.WINDOWS;
}
示例2: isMac
import net.minecraft.util.EnumOS; //导入依赖的package包/类
public static boolean isMac() {
return Minecraft.getOs() == EnumOS.MACOS;
}
示例3: func_73875_a
import net.minecraft.util.EnumOS; //导入依赖的package包/类
protected void func_73875_a(GuiButton p_73875_1_) {
if(p_73875_1_.field_73742_g) {
if(p_73875_1_.field_73741_f == 5) {
File var2 = GuiScreenTemporaryResourcePackSelectSelectionList.func_110510_a(this.field_110346_c).func_110612_e();
String var3 = var2.getAbsolutePath();
if(Util.func_110647_a() == EnumOS.MACOS) {
try {
this.field_73882_e.func_98033_al().func_98233_a(var3);
Runtime.getRuntime().exec(new String[]{"/usr/bin/open", var3});
return;
} catch (IOException var9) {
var9.printStackTrace();
}
} else if(Util.func_110647_a() == EnumOS.WINDOWS) {
String var4 = String.format("cmd.exe /C start \"Open file\" \"%s\"", new Object[]{var3});
try {
Runtime.getRuntime().exec(var4);
return;
} catch (IOException var8) {
var8.printStackTrace();
}
}
boolean var10 = false;
try {
Class var5 = Class.forName("java.awt.Desktop");
Object var6 = var5.getMethod("getDesktop", new Class[0]).invoke((Object)null, new Object[0]);
var5.getMethod("browse", new Class[]{URI.class}).invoke(var6, new Object[]{var2.toURI()});
} catch (Throwable var7) {
var7.printStackTrace();
var10 = true;
}
if(var10) {
this.field_73882_e.func_98033_al().func_98233_a("Opening via system class!");
Sys.openURL("file://" + var3);
}
} else if(p_73875_1_.field_73741_f == 6) {
this.field_73882_e.func_71373_a(this.field_110347_a);
} else {
this.field_110346_c.func_77219_a(p_73875_1_);
}
}
}
示例4: func_110647_a
import net.minecraft.util.EnumOS; //导入依赖的package包/类
public static EnumOS func_110647_a() {
String var0 = System.getProperty("os.name").toLowerCase();
return var0.contains("win")?EnumOS.WINDOWS:(var0.contains("mac")?EnumOS.MACOS:(var0.contains("solaris")?EnumOS.SOLARIS:(var0.contains("sunos")?EnumOS.SOLARIS:(var0.contains("linux")?EnumOS.LINUX:(var0.contains("unix")?EnumOS.LINUX:EnumOS.UNKNOWN)))));
}
示例5: addOS2
import net.minecraft.util.EnumOS; //导入依赖的package包/类
public static EnumOS addOS2(String name)
{
return addEnum(EnumOS.class, name);
}
示例6: actionPerformed
import net.minecraft.util.EnumOS; //导入依赖的package包/类
/**
* Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e).
*/
protected void actionPerformed(GuiButton par1GuiButton)
{
if (par1GuiButton.enabled)
{
if (par1GuiButton.id == 5)
{
File file1 = GuiScreenTemporaryResourcePackSelectSelectionList.func_110510_a(this.field_110346_c).getDirResourcepacks();
String s = file1.getAbsolutePath();
if (Util.getOSType() == EnumOS.MACOS)
{
try
{
this.mc.getLogAgent().logInfo(s);
Runtime.getRuntime().exec(new String[] {"/usr/bin/open", s});
return;
}
catch (IOException ioexception)
{
ioexception.printStackTrace();
}
}
else if (Util.getOSType() == EnumOS.WINDOWS)
{
String s1 = String.format("cmd.exe /C start \"Open file\" \"%s\"", new Object[] {s});
try
{
Runtime.getRuntime().exec(s1);
return;
}
catch (IOException ioexception1)
{
ioexception1.printStackTrace();
}
}
boolean flag = false;
try
{
Class oclass = Class.forName("java.awt.Desktop");
Object object = oclass.getMethod("getDesktop", new Class[0]).invoke((Object)null, new Object[0]);
oclass.getMethod("browse", new Class[] {URI.class}).invoke(object, new Object[] {file1.toURI()});
}
catch (Throwable throwable)
{
throwable.printStackTrace();
flag = true;
}
if (flag)
{
this.mc.getLogAgent().logInfo("Opening via system class!");
Sys.openURL("file://" + s);
}
}
else if (par1GuiButton.id == 6)
{
this.mc.displayGuiScreen(this.field_110347_a);
}
else
{
this.field_110346_c.actionPerformed(par1GuiButton);
}
}
}
示例7: updateDisplayMode
import net.minecraft.util.EnumOS; //导入依赖的package包/类
private void updateDisplayMode() throws LWJGLException
{
HashSet hashset = new HashSet();
Collections.addAll(hashset, Display.getAvailableDisplayModes());
DisplayMode displaymode = Display.getDesktopDisplayMode();
if (!hashset.contains(displaymode) && Util.getOSType() == EnumOS.MACOS)
{
Iterator iterator = macDisplayModes.iterator();
while (iterator.hasNext())
{
DisplayMode displaymode1 = (DisplayMode)iterator.next();
boolean flag = true;
Iterator iterator1 = hashset.iterator();
DisplayMode displaymode2;
while (iterator1.hasNext())
{
displaymode2 = (DisplayMode)iterator1.next();
if (displaymode2.getBitsPerPixel() == 32 && displaymode2.getWidth() == displaymode1.getWidth() && displaymode2.getHeight() == displaymode1.getHeight())
{
flag = false;
break;
}
}
if (!flag)
{
iterator1 = hashset.iterator();
while (iterator1.hasNext())
{
displaymode2 = (DisplayMode)iterator1.next();
if (displaymode2.getBitsPerPixel() == 32 && displaymode2.getWidth() == displaymode1.getWidth() / 2 && displaymode2.getHeight() == displaymode1.getHeight() / 2)
{
displaymode = displaymode2;
break;
}
}
}
}
}
Display.setDisplayMode(displaymode);
this.displayWidth = displaymode.getWidth();
this.displayHeight = displaymode.getHeight();
}