mirror of
https://github.com/xoo0524tw/OpenArcadeGames.git
synced 2026-12-06 02:46:01 +02:00
Consolidate engine and games into common module and unify platform APIs
This commit is contained in:
1 parent
76ac0e3acd
commit
fbed884ad9
1353 files changed
+44571
-59600
No files matched your search
+26
-26
@@ -16,57 +16,57 @@ public final class SharedEngineOperations {
|
||||
private SharedEngineOperations() {
|
||||
}
|
||||
|
||||
public static void sleepQuietly(long var0) {
|
||||
public static void sleepQuietly(long longVal) {
|
||||
try {
|
||||
Thread.sleep(var0);
|
||||
} catch (InterruptedException var3) {
|
||||
Thread.sleep(longVal);
|
||||
} catch (InterruptedException ex) {
|
||||
}
|
||||
}
|
||||
|
||||
public static void closeQuietly(Closeable var0) {
|
||||
public static void closeQuietly(Closeable closeable) {
|
||||
try {
|
||||
var0.close();
|
||||
} catch (IOException var2) {
|
||||
closeable.close();
|
||||
} catch (IOException ex) {
|
||||
}
|
||||
}
|
||||
|
||||
public static <T> T orElse(T var0, T var1) {
|
||||
return (T) (var0 == null ? var1 : var0);
|
||||
public static <T> T orElse(T obj, T obj2) {
|
||||
return (T) (obj == null ? obj2 : obj);
|
||||
}
|
||||
|
||||
public static void swap(Object[] var0, int var1, int var2) {
|
||||
Object var3 = var0[var1];
|
||||
var0[var1] = var0[var2];
|
||||
var0[var2] = var3;
|
||||
public static void swap(Object[] objs, int index, int index2) {
|
||||
Object obj = objs[index];
|
||||
objs[index] = objs[index2];
|
||||
objs[index2] = obj;
|
||||
}
|
||||
|
||||
public static float snapYaw(float var0) {
|
||||
if ((!(var0 > 135.0F) || !(var0 <= 180.0F)) && !(var0 < -135.0F)) {
|
||||
if (var0 >= -135.0F && var0 <= -45.0F) {
|
||||
public static float snapYaw(float floatVal) {
|
||||
if ((!(floatVal > 135.0F) || !(floatVal <= 180.0F)) && !(floatVal < -135.0F)) {
|
||||
if (floatVal >= -135.0F && floatVal <= -45.0F) {
|
||||
return -90.0F;
|
||||
} else {
|
||||
return var0 < 135.0F && var0 >= 45.0F ? 90.0F : 0.0F;
|
||||
return floatVal < 135.0F && floatVal >= 45.0F ? 90.0F : 0.0F;
|
||||
}
|
||||
} else {
|
||||
return 180.0F;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isLeftClick(Action var0) {
|
||||
return var0 == Action.LEFT_CLICK_AIR || var0 == Action.LEFT_CLICK_BLOCK;
|
||||
public static boolean isLeftClick(Action action) {
|
||||
return action == Action.LEFT_CLICK_AIR || action == Action.LEFT_CLICK_BLOCK;
|
||||
}
|
||||
|
||||
public static boolean isRightClick(Action var0) {
|
||||
return var0 == Action.RIGHT_CLICK_AIR || var0 == Action.RIGHT_CLICK_BLOCK;
|
||||
public static boolean isRightClick(Action action) {
|
||||
return action == Action.RIGHT_CLICK_AIR || action == Action.RIGHT_CLICK_BLOCK;
|
||||
}
|
||||
|
||||
public static InputStream openStream(String var0, String var1, String var2, int var3) {
|
||||
public static InputStream openStream(String text, String text2, String text3, int index) {
|
||||
try {
|
||||
URLConnection var4 = new URI(var0, var1, var2, null).toURL().openConnection();
|
||||
var4.setConnectTimeout(1000);
|
||||
var4.setReadTimeout(var3);
|
||||
return var4.getInputStream();
|
||||
} catch (URISyntaxException | IOException var5) {
|
||||
URLConnection uRLConnection = new URI(text, text2, text3, null).toURL().openConnection();
|
||||
uRLConnection.setConnectTimeout(1000);
|
||||
uRLConnection.setReadTimeout(index);
|
||||
return uRLConnection.getInputStream();
|
||||
} catch (URISyntaxException | IOException ex) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user