diff --git a/.classpath b/.classpath
index ab0a016..c20445f 100644
--- a/.classpath
+++ b/.classpath
@@ -3,22 +3,22 @@
-
+
-
+
-
-
+
+
-
+
-
+
diff --git a/build.gradle b/build.gradle
index 13014da..5bfda51 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,27 +1,19 @@
+import org.teavm.gradle.api.OptimizationLevel
-buildscript {
- repositories {
- mavenCentral()
- }
-
- dependencies {
- classpath 'io.github.zebalu:teavm-gradle-plugin:1.0.0'
- }
+plugins {
+ id "java"
+ id "eclipse"
+ id "org.teavm" version "0.10.2"
}
-apply plugin: 'java'
-apply plugin: 'eclipse'
-apply plugin: 'io.github.zebalu.teavm-gradle-plugin'
-
-sourceCompatibility = 1.8
-targetCompatibility = 1.8
-
sourceSets {
main {
java {
- srcDir 'src/main/java'
- srcDir 'src/teavm/java'
- srcDir 'sp-server/src/ipc/java'
+ srcDirs(
+ "src/main/java",
+ "src/teavm/java",
+ "sp-server/src/ipc/java"
+ )
}
}
}
@@ -31,54 +23,24 @@ repositories {
}
dependencies {
- implementation 'org.teavm:teavm-platform:0.6.1'
- implementation 'org.teavm:teavm-classlib:0.6.1'
+ teavm(teavm.libs.jso)
+ teavm(teavm.libs.jsoApis)
}
-teavm {
-
- compileScopes = null;
- minifying = true;
- maxTopLevelNames = 10000;
- properties = null;
- debugInformationGenerated = false;
- sourceMapsGenerated = true;
- sourceFilesCopied = false;
- incremental = false;
- transformers = null;
-
- /** Where to save the result */
- targetDirectory = file("javascript");
-
- /** The directory to monitor to decide if compile is up-to-date or not */
- sourceDirectory = file("src");
-
- /** How to name the result file. */
- targetFileName = "classes.js";
-
- /** Which class holds your public static void main(Strin[] args) method */
- mainClass = 'net.lax1dude.eaglercraft.Client';
-
- /** This will be the name of your main method after compilation. */
- entryPointName = 'main';
-
- classesToPreserve = null;
- stopOnErrors = false;
- optimizationLevel = "ADVANCED"; //org.teavm.vm.TeaVMOptimizationLevel.SIMPLE;
- fastGlobalAnalysis = false;
- targetType = "JAVASCRIPT"; //org.teavm.tooling.TeaVMTargetType.JAVASCRIPT;
- cacheDirectory = null;
- wasmVersion = "V_0x1"; //org.teavm.backend.wasm.render.WasmBinaryVersion.V_0x1;
- minHeapSize = 4;
- maxHeapSize = 128;
- outOfProcess = false;
- processMemory = 512;
- longjmpSupported = true;
- heapDump = false;
-
- /** Add name of configurations here where to look for jarfiles. */
- includeJarsFrom = [];
-
- /** By default teavmc taskd epends on javaCompile task, unless this varaibale is true. */
- skipJavaCompile = false;
+def folder = "javascript"
+def name = "classes.js"
+
+teavm.js {
+ obfuscated = true
+ sourceMap = true
+ targetFileName = "../" + name
+ optimization = OptimizationLevel.AGGRESSIVE
+ outOfProcess = false
+ fastGlobalAnalysis = false
+ processMemory = 512
+ entryPointName = "main"
+ mainClass = "net.lax1dude.eaglercraft.Client"
+ outputDir = file(folder)
+ properties = [ "java.util.TimeZone.autodetect": "true" ]
+ debugInformation = false
}
diff --git a/gradle.properties b/gradle.properties
new file mode 100644
index 0000000..a36eb1c
--- /dev/null
+++ b/gradle.properties
@@ -0,0 +1 @@
+org.gradle.jvmargs=-Xmx2G -Xms2G
\ No newline at end of file
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
index cc4fdc2..7f93135 100644
Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 6ce793f..e6aba25 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,5 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-6.0-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-all.zip
+networkTimeout=10000
+validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
diff --git a/lwjgl-rundir/_eagstorage.g.dat b/lwjgl-rundir/_eagstorage.g.dat
index c0328e6..1b5da55 100644
Binary files a/lwjgl-rundir/_eagstorage.g.dat and b/lwjgl-rundir/_eagstorage.g.dat differ
diff --git a/settings.gradle b/settings.gradle
index a333cf4..6a411dd 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -7,4 +7,4 @@
* in the user manual at https://docs.gradle.org/6.0/userguide/multi_project_builds.html
*/
-rootProject.name = 'eaglercraft-1.5.2-service-pack-1'
+rootProject.name = 'eaglercraft-1.5.2-service-pack-2'
diff --git a/sp-server/.classpath b/sp-server/.classpath
index 98a1daf..1619373 100644
--- a/sp-server/.classpath
+++ b/sp-server/.classpath
@@ -3,16 +3,16 @@
-
+
-
+
-
+
diff --git a/sp-server/.project b/sp-server/.project
index 1ce8e25..66b372c 100644
--- a/sp-server/.project
+++ b/sp-server/.project
@@ -1,6 +1,6 @@
- eaglercraft-sp-server
+ eaglercraft-sp-server-service-pack-2
Project sp-server created by Buildship.
diff --git a/sp-server/build.gradle b/sp-server/build.gradle
index 5f81193..61cb48d 100644
--- a/sp-server/build.gradle
+++ b/sp-server/build.gradle
@@ -1,48 +1,18 @@
+import org.teavm.gradle.api.OptimizationLevel
-apply plugin: "java"
-apply plugin: "eclipse"
-apply plugin: "io.github.zebalu.teavm-gradle-plugin"
-
-sourceCompatibility = 1.8
-targetCompatibility = 1.8
+plugins {
+ id "java"
+ id "eclipse"
+ id "org.teavm" version "0.10.2"
+}
sourceSets {
main {
java {
- srcDir "src/main/java"
- srcDir "src/ipc/java"
- }
- }
-}
-
-repositories {
- flatDir {
- dirs "deps"
- }
-}
-
-buildscript {
- repositories {
- mavenCentral()
- }
-
- dependencies {
- classpath 'io.github.zebalu:teavm-gradle-plugin:1.0.0'
- }
-}
-
-apply plugin: 'java'
-apply plugin: 'eclipse'
-apply plugin: 'io.github.zebalu.teavm-gradle-plugin'
-
-sourceCompatibility = 1.8
-targetCompatibility = 1.8
-
-sourceSets {
- main {
- java {
- srcDir "src/main/java"
- srcDir "src/ipc/java"
+ srcDirs(
+ "src/main/java",
+ "src/ipc/java"
+ )
}
}
}
@@ -52,54 +22,24 @@ repositories {
}
dependencies {
- implementation 'org.teavm:teavm-platform:0.6.1'
- implementation 'org.teavm:teavm-classlib:0.6.1'
+ teavm(teavm.libs.jso)
+ teavm(teavm.libs.jsoApis)
}
-teavm {
-
- compileScopes = null;
- minifying = true;
- maxTopLevelNames = 10000;
- properties = null;
- debugInformationGenerated = false;
- sourceMapsGenerated = true;
- sourceFilesCopied = false;
- incremental = false;
- transformers = null;
-
- /** Where to save the result */
- targetDirectory = file("../javascript");
-
- /** The directory to monitor to decide if compile is up-to-date or not */
- sourceDirectory = file("src");
-
- /** How to name the result file. */
- targetFileName = "classes_server.js";
-
- /** Which class holds your public static void main(Strin[] args) method */
- mainClass = "net.lax1dude.eaglercraft.sp.IntegratedServer";
-
- /** This will be the name of your main method after compilation. */
- entryPointName = "main";
-
- classesToPreserve = null;
- stopOnErrors = false;
- optimizationLevel = "ADVANCED"; //org.teavm.vm.TeaVMOptimizationLevel.SIMPLE;
- fastGlobalAnalysis = false;
- targetType = "JAVASCRIPT"; //org.teavm.tooling.TeaVMTargetType.JAVASCRIPT;
- cacheDirectory = null;
- wasmVersion = "V_0x1"; //org.teavm.backend.wasm.render.WasmBinaryVersion.V_0x1;
- minHeapSize = 4;
- maxHeapSize = 128;
- outOfProcess = false;
- processMemory = 512;
- longjmpSupported = true;
- heapDump = false;
-
- /** Add name of configurations here where to look for jarfiles. */
- includeJarsFrom = [];
-
- /** By default teavmc taskd epends on javaCompile task, unless this varaibale is true. */
- skipJavaCompile = false;
+def folder = "../javascript"
+def name = "classes_server.js"
+
+teavm.js {
+ obfuscated = true
+ sourceMap = true
+ targetFileName = "../" + name
+ optimization = OptimizationLevel.AGGRESSIVE
+ outOfProcess = false
+ fastGlobalAnalysis = false
+ processMemory = 512
+ entryPointName = "main"
+ mainClass = "net.lax1dude.eaglercraft.sp.IntegratedServer"
+ outputDir = file(folder)
+ properties = [ "java.util.TimeZone.autodetect": "true" ]
+ debugInformation = false
}
diff --git a/sp-server/gradle.properties b/sp-server/gradle.properties
new file mode 100644
index 0000000..a36eb1c
--- /dev/null
+++ b/sp-server/gradle.properties
@@ -0,0 +1 @@
+org.gradle.jvmargs=-Xmx2G -Xms2G
\ No newline at end of file
diff --git a/sp-server/gradle/wrapper/gradle-wrapper.jar b/sp-server/gradle/wrapper/gradle-wrapper.jar
index 7454180..7f93135 100644
Binary files a/sp-server/gradle/wrapper/gradle-wrapper.jar and b/sp-server/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/sp-server/gradle/wrapper/gradle-wrapper.properties b/sp-server/gradle/wrapper/gradle-wrapper.properties
index 69a9715..e6aba25 100644
--- a/sp-server/gradle/wrapper/gradle-wrapper.properties
+++ b/sp-server/gradle/wrapper/gradle-wrapper.properties
@@ -1,5 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-7.1-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-all.zip
+networkTimeout=10000
+validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
diff --git a/sp-server/settings.gradle b/sp-server/settings.gradle
index 14ddd4c..8990fe8 100644
--- a/sp-server/settings.gradle
+++ b/sp-server/settings.gradle
@@ -7,6 +7,6 @@
* in the user manual at https://docs.gradle.org/6.0/userguide/multi_project_builds.html
*/
-rootProject.name = 'eaglercraft-sp-server'
+rootProject.name = 'eaglercraft-sp-server-service-pack-2'
// you eagler
\ No newline at end of file
diff --git a/sp-server/src/ipc/java/net/lax1dude/eaglercraft/sp/ipc/IPCPacket14StringList.java b/sp-server/src/ipc/java/net/lax1dude/eaglercraft/sp/ipc/IPCPacket14StringList.java
index 1bd76d2..f8992fe 100644
--- a/sp-server/src/ipc/java/net/lax1dude/eaglercraft/sp/ipc/IPCPacket14StringList.java
+++ b/sp-server/src/ipc/java/net/lax1dude/eaglercraft/sp/ipc/IPCPacket14StringList.java
@@ -19,11 +19,11 @@ public class IPCPacket14StringList implements IPCPacketBase {
public final List stringList;
public IPCPacket14StringList() {
- stringList = new ArrayList();
+ stringList = new ArrayList<>();
}
public IPCPacket14StringList(int opcode, String[] list) {
- stringList = new ArrayList();
+ stringList = new ArrayList<>();
for(String s : list) {
s = s.trim();
if(s.length() > 0) {
@@ -34,7 +34,7 @@ public class IPCPacket14StringList implements IPCPacketBase {
}
public IPCPacket14StringList(int opcode, List list) {
- stringList = new ArrayList();
+ stringList = new ArrayList<>();
for(String s : list) {
s = s.trim();
if(s.length() > 0) {
diff --git a/sp-server/src/ipc/java/net/lax1dude/eaglercraft/sp/ipc/IPCPacket15ThrowException.java b/sp-server/src/ipc/java/net/lax1dude/eaglercraft/sp/ipc/IPCPacket15ThrowException.java
index 056588e..ff4dad3 100644
--- a/sp-server/src/ipc/java/net/lax1dude/eaglercraft/sp/ipc/IPCPacket15ThrowException.java
+++ b/sp-server/src/ipc/java/net/lax1dude/eaglercraft/sp/ipc/IPCPacket15ThrowException.java
@@ -15,11 +15,11 @@ public class IPCPacket15ThrowException implements IPCPacketBase {
public final List stackTrace;
public IPCPacket15ThrowException() {
- stackTrace = new ArrayList();
+ stackTrace = new ArrayList<>();
}
public IPCPacket15ThrowException(String errorMessage, String[] list) {
- stackTrace = new ArrayList(Arrays.asList(list));
+ stackTrace = new ArrayList<>(Arrays.asList(list));
this.errorMessage = errorMessage;
}
diff --git a/sp-server/src/ipc/java/net/lax1dude/eaglercraft/sp/ipc/IPCPacket16NBTList.java b/sp-server/src/ipc/java/net/lax1dude/eaglercraft/sp/ipc/IPCPacket16NBTList.java
index 82d7923..b248479 100644
--- a/sp-server/src/ipc/java/net/lax1dude/eaglercraft/sp/ipc/IPCPacket16NBTList.java
+++ b/sp-server/src/ipc/java/net/lax1dude/eaglercraft/sp/ipc/IPCPacket16NBTList.java
@@ -25,8 +25,8 @@ public class IPCPacket16NBTList implements IPCPacketBase {
public final List nbtTagList;
public IPCPacket16NBTList() {
- tagList = new LinkedList();
- nbtTagList = new LinkedList();
+ tagList = new LinkedList<>();
+ nbtTagList = new LinkedList<>();
}
public IPCPacket16NBTList(int opcode, NBTTagCompound[] list) {
@@ -34,7 +34,7 @@ public class IPCPacket16NBTList implements IPCPacketBase {
}
public IPCPacket16NBTList(int opcode, List list) {
- tagList = new LinkedList();
+ tagList = new LinkedList<>();
nbtTagList = list;
for(int i = 0, size = list.size(); i < size; ++i) {
NBTTagCompound tag = list.get(i);
diff --git a/sp-server/src/ipc/java/net/lax1dude/eaglercraft/sp/ipc/IPCPacket17ConfigureLAN.java b/sp-server/src/ipc/java/net/lax1dude/eaglercraft/sp/ipc/IPCPacket17ConfigureLAN.java
index d1c4a5c..1d3f1bd 100644
--- a/sp-server/src/ipc/java/net/lax1dude/eaglercraft/sp/ipc/IPCPacket17ConfigureLAN.java
+++ b/sp-server/src/ipc/java/net/lax1dude/eaglercraft/sp/ipc/IPCPacket17ConfigureLAN.java
@@ -15,7 +15,7 @@ public class IPCPacket17ConfigureLAN implements IPCPacketBase {
public final List iceServers;
public IPCPacket17ConfigureLAN() {
- iceServers = new ArrayList();
+ iceServers = new ArrayList<>();
}
public IPCPacket17ConfigureLAN(int gamemode, boolean cheats, List iceServers) {
diff --git a/sp-server/src/ipc/java/net/lax1dude/eaglercraft/sp/ipc/IPCPacketManager.java b/sp-server/src/ipc/java/net/lax1dude/eaglercraft/sp/ipc/IPCPacketManager.java
index d7b9ab2..5e8f3d2 100644
--- a/sp-server/src/ipc/java/net/lax1dude/eaglercraft/sp/ipc/IPCPacketManager.java
+++ b/sp-server/src/ipc/java/net/lax1dude/eaglercraft/sp/ipc/IPCPacketManager.java
@@ -8,7 +8,7 @@ import java.util.function.Supplier;
public class IPCPacketManager {
- public static final HashMap> mappings = new HashMap();
+ public static final HashMap> mappings = new HashMap<>();
public static final IPCInputStream IPC_INPUT_STREAM = new IPCInputStream();
public static final IPCOutputStream IPC_OUTPUT_STREAM = new IPCOutputStream();
diff --git a/sp-server/src/main/java/net/lax1dude/eaglercraft/sp/EAGMinecraftServer.java b/sp-server/src/main/java/net/lax1dude/eaglercraft/sp/EAGMinecraftServer.java
index 8b22bd5..681133d 100644
--- a/sp-server/src/main/java/net/lax1dude/eaglercraft/sp/EAGMinecraftServer.java
+++ b/sp-server/src/main/java/net/lax1dude/eaglercraft/sp/EAGMinecraftServer.java
@@ -37,11 +37,11 @@ public class EAGMinecraftServer extends MinecraftServer {
public void mainLoop() {
if(paused && this.playersOnline.size() <= 1) {
- lastTick = System.currentTimeMillis();
+ lastTick = SysUtil.steadyTimeMillis();
return;
}
- long ctm = System.currentTimeMillis();
+ long ctm = SysUtil.steadyTimeMillis();
long delta = ctm - lastTick;
if (delta > 2000L && ctm - this.timeOfLastWarning >= 15000L) {
@@ -57,19 +57,15 @@ public class EAGMinecraftServer extends MinecraftServer {
if (this.worldServers[0].areAllPlayersAsleep()) {
this.tick();
- lastTick = System.currentTimeMillis();
+ lastTick = SysUtil.steadyTimeMillis();
} else {
boolean mustYield = false;
while (delta >= 50L) {
if(mustYield) {
- try {
- Thread.sleep(1l); // allow some async
- }catch(InterruptedException e) {
- System.err.println("you eagler");
- }
+ SysUtil.sleep(1); // allow some async
}
delta -= 50L;
- lastTick = System.currentTimeMillis();
+ lastTick = SysUtil.steadyTimeMillis();
this.tick();
mustYield = true;
}
@@ -80,7 +76,7 @@ public class EAGMinecraftServer extends MinecraftServer {
public void setPaused(boolean p) {
paused = p;
if(!p) {
- lastTick = System.currentTimeMillis();
+ lastTick = SysUtil.steadyTimeMillis();
}
}
@@ -93,7 +89,7 @@ public class EAGMinecraftServer extends MinecraftServer {
SkinsPlugin.reset();
VoiceChatPlugin.reset();
this.loadAllWorlds(folderName, 0l, newWorldSettings);
- this.lastTick = System.currentTimeMillis();
+ this.lastTick = SysUtil.steadyTimeMillis();
return true;
}
diff --git a/sp-server/src/main/java/net/lax1dude/eaglercraft/sp/ExpiringSet.java b/sp-server/src/main/java/net/lax1dude/eaglercraft/sp/ExpiringSet.java
index 2620031..64ed0cf 100644
--- a/sp-server/src/main/java/net/lax1dude/eaglercraft/sp/ExpiringSet.java
+++ b/sp-server/src/main/java/net/lax1dude/eaglercraft/sp/ExpiringSet.java
@@ -29,7 +29,7 @@ public class ExpiringSet extends HashSet {
public void checkForExpirations() {
Iterator iterator = this.timestamps.keySet().iterator();
- long now = System.currentTimeMillis();
+ long now = SysUtil.steadyTimeMillis();
while (iterator.hasNext()) {
T element = iterator.next();
if (super.contains(element)) {
@@ -50,7 +50,7 @@ public class ExpiringSet extends HashSet {
checkForExpirations();
boolean success = super.add(o);
if (success)
- timestamps.put(o, System.currentTimeMillis());
+ timestamps.put(o, SysUtil.steadyTimeMillis());
return success;
}
diff --git a/sp-server/src/main/java/net/lax1dude/eaglercraft/sp/IDBObjectStorePatched.java b/sp-server/src/main/java/net/lax1dude/eaglercraft/sp/IDBObjectStorePatched.java
deleted file mode 100644
index 4ad338a..0000000
--- a/sp-server/src/main/java/net/lax1dude/eaglercraft/sp/IDBObjectStorePatched.java
+++ /dev/null
@@ -1,79 +0,0 @@
-package net.lax1dude.eaglercraft.sp;
-
-import org.teavm.jso.JSBody;
-import org.teavm.jso.JSObject;
-import org.teavm.jso.JSProperty;
-import org.teavm.jso.core.JSString;
-import org.teavm.jso.indexeddb.IDBCountRequest;
-import org.teavm.jso.indexeddb.IDBCursorRequest;
-import org.teavm.jso.indexeddb.IDBCursorSource;
-import org.teavm.jso.indexeddb.IDBDatabase;
-import org.teavm.jso.indexeddb.IDBGetRequest;
-import org.teavm.jso.indexeddb.IDBIndex;
-import org.teavm.jso.indexeddb.IDBKeyRange;
-import org.teavm.jso.indexeddb.IDBObjectStoreParameters;
-import org.teavm.jso.indexeddb.IDBRequest;
-import org.teavm.jso.indexeddb.IDBTransaction;
-
-public abstract class IDBObjectStorePatched implements JSObject, IDBCursorSource {
-
- @JSBody(params = { "db", "name", "optionalParameters" }, script = "return db.createObjectStore(name, optionalParameters);")
- public static native IDBObjectStorePatched createObjectStorePatch(IDBDatabase db, String name, IDBObjectStoreParameters optionalParameters);
-
- @JSBody(params = { "tx", "name" }, script = "return tx.objectStore(name);")
- public static native IDBObjectStorePatched objectStorePatch(IDBTransaction tx, String name);
-
- @JSProperty
- public abstract String getName();
-
- @JSProperty("keyPath")
- abstract JSObject getKeyPathImpl();
-
- public final String[] getKeyPath() {
- JSObject result = getKeyPathImpl();
- if (JSString.isInstance(result)) {
- return new String[] { result.cast().stringValue() };
- } else {
- return unwrapStringArray(result);
- }
- }
-
- @JSBody(params = { "obj" }, script = "return this;")
- private static native String[] unwrapStringArray(JSObject obj);
-
- @JSProperty
- public abstract String[] getIndexNames();
-
- @JSProperty
- public abstract boolean isAutoIncrement();
-
- public abstract IDBRequest put(JSObject value, JSObject key);
-
- public abstract IDBRequest put(JSObject value);
-
- public abstract IDBRequest add(JSObject value, JSObject key);
-
- public abstract IDBRequest add(JSObject value);
-
- public abstract IDBRequest delete(JSObject key);
-
- public abstract IDBGetRequest get(JSObject key);
-
- public abstract IDBRequest clear();
-
- public abstract IDBCursorRequest openCursor();
-
- public abstract IDBCursorRequest openCursor(IDBKeyRange range);
-
- public abstract IDBIndex createIndex(String name, String key);
-
- public abstract IDBIndex createIndex(String name, String[] keys);
-
- public abstract IDBIndex index(String name);
-
- public abstract void deleteIndex(String name);
-
- public abstract IDBCountRequest count();
-
- public abstract IDBCountRequest count(JSObject key);
-}
diff --git a/sp-server/src/main/java/net/lax1dude/eaglercraft/sp/IntegratedServer.java b/sp-server/src/main/java/net/lax1dude/eaglercraft/sp/IntegratedServer.java
index f4b2598..a493094 100644
--- a/sp-server/src/main/java/net/lax1dude/eaglercraft/sp/IntegratedServer.java
+++ b/sp-server/src/main/java/net/lax1dude/eaglercraft/sp/IntegratedServer.java
@@ -11,6 +11,7 @@ import java.util.List;
import java.util.Map;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
+import java.util.zip.ZipOutputStream;
import org.teavm.jso.JSBody;
import org.teavm.jso.JSFunctor;
@@ -32,7 +33,7 @@ import net.minecraft.src.WorldType;
public class IntegratedServer {
- private static final LinkedList messageQueue = new LinkedList();
+ private static final LinkedList messageQueue = new LinkedList<>();
protected static class PKT {
protected final String channel;
@@ -70,7 +71,7 @@ public class IntegratedServer {
return;
}
- Uint8Array a = Uint8Array.create(buf);
+ Uint8Array a = new Uint8Array(buf);
byte[] pkt = new byte[a.getLength()];
for(int i = 0; i < pkt.length; ++i) {
pkt[i] = (byte) a.get(i);
@@ -107,7 +108,7 @@ public class IntegratedServer {
String str = t.toString();
System.err.println("Exception was raised to client: " + str);
t.printStackTrace();
- List arr = new LinkedList();
+ List arr = new LinkedList<>();
for(StackTraceElement e : t.getStackTrace()) {
String st = e.toString();
arr.add(st);
@@ -220,7 +221,7 @@ public class IntegratedServer {
}
String[] worldsTxt = SYS.VFS.getFile("worlds.txt").getAllLines();
if(worldsTxt != null) {
- LinkedList newWorlds = new LinkedList();
+ LinkedList newWorlds = new LinkedList<>();
for(String str : worldsTxt) {
if(!str.equalsIgnoreCase(pkt.worldName)) {
newWorlds.add(str);
@@ -240,7 +241,7 @@ public class IntegratedServer {
break;
}else {
String[] worldsTxt = SYS.VFS.getFile("worlds.txt").getAllLines();
- LinkedList newWorlds = new LinkedList();
+ LinkedList newWorlds = new LinkedList<>();
if(worldsTxt != null) {
for(String str : worldsTxt) {
if(pkt.copy || !str.equalsIgnoreCase(pkt.worldOldName)) {
@@ -586,7 +587,6 @@ public class IntegratedServer {
}
break;
case IPCPacket0EListWorlds.ID: {
- IPCPacket0EListWorlds pkt = (IPCPacket0EListWorlds)packet;
if(isServerStopped()) {
String[] worlds = SYS.VFS.getFile("worlds.txt").getAllLines();
if(worlds == null || (worlds.length == 1 && worlds[0].trim().length() <= 0)) {
@@ -596,8 +596,8 @@ public class IntegratedServer {
sendIPCPacket(new IPCPacket16NBTList(IPCPacket16NBTList.WORLD_LIST, new LinkedList()));
break;
}
- LinkedList updatedList = new LinkedList();
- LinkedList sendListNBT = new LinkedList();
+ LinkedList updatedList = new LinkedList<>();
+ LinkedList sendListNBT = new LinkedList<>();
boolean rewrite = false;
for(String w : worlds) {
byte[] dat = (new VFile("worlds", w, "level.dat")).getAllBytes();
@@ -683,13 +683,13 @@ public class IntegratedServer {
continue;
}
}
- long watchDog = System.currentTimeMillis();
+ long watchDog = SysUtil.steadyTimeMillis();
itr = cur.iterator();
int overflow = 0;
while(itr.hasNext()) {
PKT msg = itr.next();
if(!msg.channel.equals("IPC")) {
- if(System.currentTimeMillis() - watchDog > 500l) {
+ if(SysUtil.steadyTimeMillis() - watchDog > 500l) {
++overflow;
continue;
}
@@ -720,16 +720,16 @@ public class IntegratedServer {
return;
}
- ArrayBuffer arb = ArrayBuffer.create(serialized.length);
- Uint8Array ar = Uint8Array.create(arb);
+ ArrayBuffer arb = new ArrayBuffer(serialized.length);
+ Uint8Array ar = new Uint8Array(arb);
ar.set(serialized);
sendWorkerPacket("IPC", arb);
}
public static void sendPlayerPacket(String channel, byte[] buf) {
//System.out.println("[Server][SEND][" + channel + "]: " + buf.length);
- ArrayBuffer arb = ArrayBuffer.create(buf.length);
- Uint8Array ar = Uint8Array.create(arb);
+ ArrayBuffer arb = new ArrayBuffer(buf.length);
+ Uint8Array ar = new Uint8Array(arb);
ar.set(buf);
sendWorkerPacket("NET|" + channel, arb);
}
@@ -767,11 +767,7 @@ public class IntegratedServer {
mainLoop();
- try {
- Thread.sleep(1l); // allow some async to occur
- }catch(InterruptedException e) {
- System.err.println("you eagler");
- }
+ SysUtil.sleep(1); // allow some async to occur
}
// yee
diff --git a/sp-server/src/main/java/net/lax1dude/eaglercraft/sp/MCAConverter.java b/sp-server/src/main/java/net/lax1dude/eaglercraft/sp/MCAConverter.java
index 1931116..98680af 100644
--- a/sp-server/src/main/java/net/lax1dude/eaglercraft/sp/MCAConverter.java
+++ b/sp-server/src/main/java/net/lax1dude/eaglercraft/sp/MCAConverter.java
@@ -84,7 +84,7 @@ public class MCAConverter {
byte[] readBuffer = new byte[16000];
try {
- int timestamp = (int) System.currentTimeMillis();
+ int timestamp = (int) (System.currentTimeMillis() / 1000);
int maxX = Integer.MIN_VALUE;
int maxZ = Integer.MIN_VALUE;
diff --git a/sp-server/src/main/java/net/lax1dude/eaglercraft/sp/SkinsPlugin.java b/sp-server/src/main/java/net/lax1dude/eaglercraft/sp/SkinsPlugin.java
index 9ebf9f4..b211308 100644
--- a/sp-server/src/main/java/net/lax1dude/eaglercraft/sp/SkinsPlugin.java
+++ b/sp-server/src/main/java/net/lax1dude/eaglercraft/sp/SkinsPlugin.java
@@ -10,9 +10,9 @@ import net.minecraft.src.Packet250CustomPayload;
public class SkinsPlugin {
- private static final HashMap skinCollection = new HashMap();
- private static final HashMap capeCollection = new HashMap();
- private static final HashMap lastSkinLayerUpdate = new HashMap();
+ private static final HashMap skinCollection = new HashMap<>();
+ private static final HashMap capeCollection = new HashMap<>();
+ private static final HashMap lastSkinLayerUpdate = new HashMap<>();
private static final int[] SKIN_DATA_SIZE = new int[] { 64*32*4, 64*64*4, -9, -9, 1, 64*64*4, -9 }; // 128 pixel skins crash clients
private static final int[] CAPE_DATA_SIZE = new int[] { 32*32*4, -9, 1 };
@@ -60,7 +60,7 @@ public class SkinsPlugin {
return true;
}
if("EAG|SkinLayers".equals(payload.channel)) {
- long millis = System.currentTimeMillis();
+ long millis = SysUtil.steadyTimeMillis();
Long lsu = lastSkinLayerUpdate.get(user);
if(lsu != null && millis - lsu < 700L) { // DoS protection
return true;
diff --git a/sp-server/src/main/java/net/lax1dude/eaglercraft/sp/SysUtil.java b/sp-server/src/main/java/net/lax1dude/eaglercraft/sp/SysUtil.java
new file mode 100644
index 0000000..daaf099
--- /dev/null
+++ b/sp-server/src/main/java/net/lax1dude/eaglercraft/sp/SysUtil.java
@@ -0,0 +1,48 @@
+package net.lax1dude.eaglercraft.sp;
+
+import org.teavm.interop.Async;
+import org.teavm.interop.AsyncCallback;
+import org.teavm.jso.JSBody;
+import org.teavm.jso.JSObject;
+import org.teavm.platform.Platform;
+import org.teavm.platform.PlatformRunnable;
+
+public class SysUtil {
+
+ private static final JSObject steadyTimeFunc = getSteadyTimeFunc();
+
+ @JSBody(params = { }, script = "return ((typeof performance !== \"undefined\") && (typeof performance.now === \"function\"))"
+ + "? performance.now.bind(performance)"
+ + ": (function(epochStart){ return function() { return Date.now() - epochStart; }; })(Date.now());")
+ private static native JSObject getSteadyTimeFunc();
+
+ @JSBody(params = { "steadyTimeFunc" }, script = "return steadyTimeFunc();")
+ private static native double steadyTimeMillis0(JSObject steadyTimeFunc);
+
+ public static long steadyTimeMillis() {
+ return (long)steadyTimeMillis0(steadyTimeFunc);
+ }
+
+ public static long nanoTime() {
+ return (long)(steadyTimeMillis0(steadyTimeFunc) * 1000000.0);
+ }
+
+ @Async
+ public static native void sleep(int millis);
+
+ private static void sleep(int millis, final AsyncCallback callback) {
+ Platform.schedule(new DumbSleepHandler(callback), millis);
+ }
+
+ private static class DumbSleepHandler implements PlatformRunnable {
+ private final AsyncCallback callback;
+ private DumbSleepHandler(AsyncCallback callback) {
+ this.callback = callback;
+ }
+ @Override
+ public void run() {
+ callback.complete(null);
+ }
+ }
+
+}
diff --git a/sp-server/src/main/java/net/lax1dude/eaglercraft/sp/VFSSaveHandler.java b/sp-server/src/main/java/net/lax1dude/eaglercraft/sp/VFSSaveHandler.java
index 09a46aa..a4c8927 100644
--- a/sp-server/src/main/java/net/lax1dude/eaglercraft/sp/VFSSaveHandler.java
+++ b/sp-server/src/main/java/net/lax1dude/eaglercraft/sp/VFSSaveHandler.java
@@ -17,7 +17,7 @@ public class VFSSaveHandler implements ISaveHandler, IPlayerFileData {
public final VFile worldDirectory;
- private final HashMap chunkLoaders = new HashMap();
+ private final HashMap chunkLoaders = new HashMap<>();
public VFSSaveHandler(VFile worldDirectory) {
this.worldDirectory = worldDirectory;
diff --git a/sp-server/src/main/java/net/lax1dude/eaglercraft/sp/VFile.java b/sp-server/src/main/java/net/lax1dude/eaglercraft/sp/VFile.java
index 5aaf2e9..dac9815 100644
--- a/sp-server/src/main/java/net/lax1dude/eaglercraft/sp/VFile.java
+++ b/sp-server/src/main/java/net/lax1dude/eaglercraft/sp/VFile.java
@@ -35,7 +35,7 @@ public class VFile {
protected String path;
public static String createPath(Object... p) {
- ArrayList r = new ArrayList();
+ ArrayList r = new ArrayList<>();
for(int i = 0; i < p.length; ++i) {
if(p[i] == null) {
continue;
diff --git a/sp-server/src/main/java/net/lax1dude/eaglercraft/sp/VIteratorFile.java b/sp-server/src/main/java/net/lax1dude/eaglercraft/sp/VIteratorFile.java
index 9a03ef7..5ba3d8b 100644
--- a/sp-server/src/main/java/net/lax1dude/eaglercraft/sp/VIteratorFile.java
+++ b/sp-server/src/main/java/net/lax1dude/eaglercraft/sp/VIteratorFile.java
@@ -182,7 +182,7 @@ public class VIteratorFile extends VFile {
throw new ArrayIndexOutOfBoundsException("Value of the fucking value of the entry is missing");
}
- Uint8Array a = Uint8Array.create(arr);
+ Uint8Array a = new Uint8Array(arr);
if(a.getLength() < fileOffset + length) {
throw new ArrayIndexOutOfBoundsException("file '" + path + "' size was "+a.getLength()+" but user tried to read index "+(fileOffset + length - 1));
@@ -213,7 +213,7 @@ public class VIteratorFile extends VFile {
return null;
}
- Uint8Array a = Uint8Array.create(arr);
+ Uint8Array a = new Uint8Array(arr);
int ii = a.getByteLength();
byte[] array = new byte[ii];
@@ -252,8 +252,8 @@ public class VIteratorFile extends VFile {
private static native JSObject writeRow(String name, ArrayBuffer data);
public boolean setAllBytes(byte[] bytes) {
- ArrayBuffer a = ArrayBuffer.create(bytes.length);
- Uint8Array ar = Uint8Array.create(a);
+ ArrayBuffer a = new ArrayBuffer(bytes.length);
+ Uint8Array ar = new Uint8Array(a);
ar.set(bytes);
JSObject obj = writeRow(path, a);
BooleanResult r = AsyncHandlers.awaitRequest(cur.update(obj));
diff --git a/sp-server/src/main/java/net/lax1dude/eaglercraft/sp/VirtualFilesystem.java b/sp-server/src/main/java/net/lax1dude/eaglercraft/sp/VirtualFilesystem.java
index fe102ac..729b4b3 100644
--- a/sp-server/src/main/java/net/lax1dude/eaglercraft/sp/VirtualFilesystem.java
+++ b/sp-server/src/main/java/net/lax1dude/eaglercraft/sp/VirtualFilesystem.java
@@ -63,7 +63,7 @@ public class VirtualFilesystem {
protected VFSFile(VirtualFilesystem vfs, String filePath, boolean cacheEnabled) {
this.virtualFilesystem = vfs;
this.filePath = filePath;
- this.cacheHit = System.currentTimeMillis();
+ this.cacheHit = SysUtil.steadyTimeMillis();
if(cacheEnabled) {
setCacheEnabled();
}
@@ -82,7 +82,7 @@ public class VirtualFilesystem {
}
public int getSize() {
- cacheHit = System.currentTimeMillis();
+ cacheHit = SysUtil.steadyTimeMillis();
if(fileSize < 0) {
if(cacheEnabled) {
byte[] b = getAllBytes(false);
@@ -117,7 +117,7 @@ public class VirtualFilesystem {
}else if(hasBeenAccessed && !exists) {
throw new ArrayIndexOutOfBoundsException("file '" + filePath + "' does not exist");
}
- cacheHit = System.currentTimeMillis();
+ cacheHit = SysUtil.steadyTimeMillis();
if(cacheEnabled && cache != null) {
System.arraycopy(cache, fileOffset, array, offset, length);
}else {
@@ -129,7 +129,7 @@ public class VirtualFilesystem {
exists = false;
throw new ArrayIndexOutOfBoundsException("file '" + filePath + "' does not exist");
}
- Uint8Array a = Uint8Array.create(aa);
+ Uint8Array a = new Uint8Array(aa);
this.fileSize = a.getByteLength();
if(cacheEnabled) {
cache = new byte[fileSize];
@@ -148,7 +148,7 @@ public class VirtualFilesystem {
public void setCacheEnabled() {
if(!cacheEnabled && !hasBeenDeleted && !(hasBeenAccessed && !exists)) {
- cacheHit = System.currentTimeMillis();
+ cacheHit = SysUtil.steadyTimeMillis();
cache = getAllBytes(false);
cacheEnabled = true;
}
@@ -170,7 +170,7 @@ public class VirtualFilesystem {
if(hasBeenDeleted || (hasBeenAccessed && !exists)) {
return null;
}
- cacheHit = System.currentTimeMillis();
+ cacheHit = SysUtil.steadyTimeMillis();
if(cacheEnabled && cache != null) {
byte[] b = cache;
if(copy) {
@@ -187,7 +187,7 @@ public class VirtualFilesystem {
exists = false;
return null;
}
- Uint8Array a = Uint8Array.create(b);
+ Uint8Array a = new Uint8Array(b);
this.fileSize = a.getByteLength();
byte[] array = new byte[fileSize];
for(int i = 0; i < a.getByteLength(); ++i) {
@@ -217,7 +217,7 @@ public class VirtualFilesystem {
if(hasBeenDeleted || bytes == null) {
return false;
}
- cacheHit = System.currentTimeMillis();
+ cacheHit = SysUtil.steadyTimeMillis();
this.fileSize = bytes.length;
if(cacheEnabled) {
byte[] copz = bytes;
@@ -228,8 +228,8 @@ public class VirtualFilesystem {
cache = copz;
return sync();
}else {
- ArrayBuffer a = ArrayBuffer.create(bytes.length);
- Uint8Array ar = Uint8Array.create(a);
+ ArrayBuffer a = new ArrayBuffer(bytes.length);
+ Uint8Array ar = new Uint8Array(a);
ar.set(bytes);
boolean s = AsyncHandlers.writeWholeFile(virtualFilesystem.indexeddb, filePath, a).bool;
hasBeenAccessed = true;
@@ -240,9 +240,9 @@ public class VirtualFilesystem {
public boolean sync() {
if(cacheEnabled && cache != null && !hasBeenDeleted) {
- cacheHit = System.currentTimeMillis();
- ArrayBuffer a = ArrayBuffer.create(cache.length);
- Uint8Array ar = Uint8Array.create(a);
+ cacheHit = SysUtil.steadyTimeMillis();
+ ArrayBuffer a = new ArrayBuffer(cache.length);
+ Uint8Array ar = new Uint8Array(a);
ar.set(cache);
boolean tryWrite = AsyncHandlers.writeWholeFile(virtualFilesystem.indexeddb, filePath, a).bool;
hasBeenAccessed = true;
@@ -254,7 +254,7 @@ public class VirtualFilesystem {
public boolean delete() {
if(!hasBeenDeleted && !(hasBeenAccessed && !exists)) {
- cacheHit = System.currentTimeMillis();
+ cacheHit = SysUtil.steadyTimeMillis();
if(!AsyncHandlers.deleteFile(virtualFilesystem.indexeddb, filePath).bool) {
hasBeenAccessed = true;
return false;
@@ -270,7 +270,7 @@ public class VirtualFilesystem {
public boolean rename(String newName, boolean copy) {
if(!hasBeenDeleted && !(hasBeenAccessed && !exists)) {
- cacheHit = System.currentTimeMillis();
+ cacheHit = SysUtil.steadyTimeMillis();
ArrayBuffer arr = AsyncHandlers.readWholeFile(virtualFilesystem.indexeddb, filePath);
hasBeenAccessed = true;
if(arr != null) {
@@ -298,7 +298,7 @@ public class VirtualFilesystem {
if(hasBeenDeleted) {
return false;
}
- cacheHit = System.currentTimeMillis();
+ cacheHit = SysUtil.steadyTimeMillis();
if(hasBeenAccessed) {
return exists;
}
@@ -309,7 +309,7 @@ public class VirtualFilesystem {
}
- private final HashMap fileMap = new HashMap();
+ private final HashMap fileMap = new HashMap<>();
public final String database;
private final IDBDatabase indexeddb;
@@ -395,7 +395,7 @@ public class VirtualFilesystem {
}
public List listFiles(String prefix) {
- final ArrayList list = new ArrayList();
+ final ArrayList list = new ArrayList<>();
AsyncHandlers.iterateFiles(indexeddb, this, prefix, false, (v) -> {
list.add(v.getPath());
});
@@ -425,7 +425,7 @@ public class VirtualFilesystem {
}
public void flushCache(long age) {
- long curr = System.currentTimeMillis();
+ long curr = SysUtil.steadyTimeMillis();
Iterator files = fileMap.values().iterator();
while(files.hasNext()) {
if(curr - files.next().cacheHit > age) {
@@ -487,7 +487,7 @@ public class VirtualFilesystem {
f.setOnUpgradeNeeded(new EventListener() {
@Override
public void handleEvent(IDBVersionChangeEvent evt) {
- IDBObjectStorePatched.createObjectStorePatch(f.getResult(), "filesystem", IDBObjectStoreParameters.create().keyPath("path"));
+ f.getResult().createObjectStore("filesystem", IDBObjectStoreParameters.create().keyPath("path"));
}
});
}
@@ -497,7 +497,7 @@ public class VirtualFilesystem {
private static void deleteFile(IDBDatabase db, String name, final AsyncCallback cb) {
IDBTransaction tx = db.transaction("filesystem", "readwrite");
- final IDBRequest r = IDBObjectStorePatched.objectStorePatch(tx, "filesystem").delete(makeTheFuckingKeyWork(name));
+ final IDBRequest r = tx.objectStore("filesystem").delete(makeTheFuckingKeyWork(name));
r.setOnSuccess(new EventHandler() {
@Override
@@ -524,7 +524,7 @@ public class VirtualFilesystem {
private static void readWholeFile(IDBDatabase db, String name, final AsyncCallback cb) {
IDBTransaction tx = db.transaction("filesystem", "readonly");
- final IDBGetRequest r = IDBObjectStorePatched.objectStorePatch(tx, "filesystem").get(makeTheFuckingKeyWork(name));
+ final IDBGetRequest r = tx.objectStore("filesystem").get(makeTheFuckingKeyWork(name));
r.setOnSuccess(new EventHandler() {
@Override
public void handleEvent() {
@@ -551,7 +551,7 @@ public class VirtualFilesystem {
private static void iterateFiles(IDBDatabase db, final VirtualFilesystem vfs, final String prefix, boolean rw, final VFSIterator itr, final AsyncCallback cb) {
IDBTransaction tx = db.transaction("filesystem", rw ? "readwrite" : "readonly");
- final IDBCursorRequest r = IDBObjectStorePatched.objectStorePatch(tx, "filesystem").openCursor();
+ final IDBCursorRequest r = tx.objectStore("filesystem").openCursor();
final int[] res = new int[1];
r.setOnSuccess(new EventHandler() {
@Override
@@ -589,7 +589,7 @@ public class VirtualFilesystem {
private static void deleteFiles(IDBDatabase db, final String prefix, final AsyncCallback cb) {
IDBTransaction tx = db.transaction("filesystem", "readwrite");
- final IDBCursorRequest r = IDBObjectStorePatched.objectStorePatch(tx, "filesystem").openCursor();
+ final IDBCursorRequest r = tx.objectStore("filesystem").openCursor();
final int[] res = new int[1];
r.setOnSuccess(new EventHandler() {
@Override
@@ -622,7 +622,7 @@ public class VirtualFilesystem {
private static void fileExists(IDBDatabase db, String name, final AsyncCallback cb) {
IDBTransaction tx = db.transaction("filesystem", "readonly");
- final IDBCountRequest r = IDBObjectStorePatched.objectStorePatch(tx, "filesystem").count(makeTheFuckingKeyWork(name));
+ final IDBCountRequest r = tx.objectStore("filesystem").count(makeTheFuckingKeyWork(name));
r.setOnSuccess(new EventHandler() {
@Override
public void handleEvent() {
@@ -645,7 +645,7 @@ public class VirtualFilesystem {
private static void writeWholeFile(IDBDatabase db, String name, ArrayBuffer data, final AsyncCallback cb) {
IDBTransaction tx = db.transaction("filesystem", "readwrite");
- final IDBRequest r = IDBObjectStorePatched.objectStorePatch(tx, "filesystem").put(writeRow(name, data));
+ final IDBRequest r = tx.objectStore("filesystem").put(writeRow(name, data));
r.setOnSuccess(new EventHandler() {
@Override
diff --git a/sp-server/src/main/java/net/lax1dude/eaglercraft/sp/VoiceChatPlugin.java b/sp-server/src/main/java/net/lax1dude/eaglercraft/sp/VoiceChatPlugin.java
index a7a0ba5..a786875 100644
--- a/sp-server/src/main/java/net/lax1dude/eaglercraft/sp/VoiceChatPlugin.java
+++ b/sp-server/src/main/java/net/lax1dude/eaglercraft/sp/VoiceChatPlugin.java
@@ -26,7 +26,7 @@ public class VoiceChatPlugin {
private static final Map> voiceRequests = new HashMap<>();
private static final Set voicePairs = new HashSet<>();
- private static final List iceServers = new ArrayList();
+ private static final List iceServers = new ArrayList<>();
private static final int VOICE_SIGNAL_ALLOWED = 0;
private static final int VOICE_SIGNAL_REQUEST = 0;
diff --git a/sp-server/src/main/java/net/lax1dude/eaglercraft/sp/WorkerListenThread.java b/sp-server/src/main/java/net/lax1dude/eaglercraft/sp/WorkerListenThread.java
index 3368ff7..ea49888 100644
--- a/sp-server/src/main/java/net/lax1dude/eaglercraft/sp/WorkerListenThread.java
+++ b/sp-server/src/main/java/net/lax1dude/eaglercraft/sp/WorkerListenThread.java
@@ -8,7 +8,6 @@ import java.util.List;
import net.minecraft.server.MinecraftServer;
import net.minecraft.src.NetHandler;
-import net.minecraft.src.NetServerHandler;
public class WorkerListenThread {
/** Reference to the MinecraftServer object. */
@@ -82,7 +81,7 @@ public class WorkerListenThread {
deleteDeadConnections();
- List conns = new ArrayList(this.connections);
+ List conns = new ArrayList<>(this.connections);
for (NetHandler var2 : conns) {
var2.handlePackets();
}
diff --git a/sp-server/src/main/java/net/lax1dude/eaglercraft/sp/WorkerNetworkManager.java b/sp-server/src/main/java/net/lax1dude/eaglercraft/sp/WorkerNetworkManager.java
index e4cee94..a85f6dd 100644
--- a/sp-server/src/main/java/net/lax1dude/eaglercraft/sp/WorkerNetworkManager.java
+++ b/sp-server/src/main/java/net/lax1dude/eaglercraft/sp/WorkerNetworkManager.java
@@ -6,8 +6,6 @@ import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.LinkedList;
-import java.util.UnknownFormatConversionException;
-
import net.lax1dude.eaglercraft.sp.ipc.IPCPacket0CPlayerChannel;
import net.minecraft.server.MinecraftServer;
import net.minecraft.src.INetworkManager;
@@ -15,7 +13,6 @@ import net.minecraft.src.NetHandler;
import net.minecraft.src.NetLoginHandler;
import net.minecraft.src.NetServerHandler;
import net.minecraft.src.Packet;
-import net.minecraft.src.Packet204ClientInfo;
public class WorkerNetworkManager implements INetworkManager {
@@ -25,7 +22,7 @@ public class WorkerNetworkManager implements INetworkManager {
private boolean isAlive;
private WorkerListenThread listenThread;
- private LinkedList frags = new LinkedList();
+ private LinkedList frags = new LinkedList<>();
public WorkerNetworkManager(String ipcChannel, MinecraftServer srv, WorkerListenThread th) {
this.ipcChannel = ipcChannel;
diff --git a/sp-server/src/main/java/net/lax1dude/eaglercraft/sp/ZipOutputStream.java b/sp-server/src/main/java/net/lax1dude/eaglercraft/sp/ZipOutputStream.java
deleted file mode 100644
index 3672b5f..0000000
--- a/sp-server/src/main/java/net/lax1dude/eaglercraft/sp/ZipOutputStream.java
+++ /dev/null
@@ -1,327 +0,0 @@
-package net.lax1dude.eaglercraft.sp;
-
-import static java.util.zip.Deflater.BEST_COMPRESSION;
-import static java.util.zip.Deflater.DEFAULT_COMPRESSION;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipException;
-
-import com.jcraft.jzlib.Deflater;
-import com.jcraft.jzlib.DeflaterOutputStream;
-
-public class ZipOutputStream extends DeflaterOutputStream {
- long LOCSIG = 0x4034b50;
- long EXTSIG = 0x8074b50;
- long CENSIG = 0x2014b50;
- long ENDSIG = 0x6054b50;
-
- int LOCHDR = 30;
- int EXTHDR = 16;
-
- public static final int DEFLATED = 8;
- public static final int STORED = 0;
-
- static final int ZIPDataDescriptorFlag = 8;
- static final int ZIPLocalHeaderVersionNeeded = 20;
- private String comment;
- private final List entries = new ArrayList<>();
- private int compressMethod = DEFLATED;
- private int compressLevel = -1;
- private ByteArrayOutputStream cDir = new ByteArrayOutputStream();
- private ZipEntry currentEntry;
- private final CRC32 crc = new CRC32();
- private int offset;
- private int curOffset;
- private int nameLength;
- private byte[] nameBytes;
-
- public ZipOutputStream(OutputStream p1) throws IOException {
- super(p1, new Deflater(-1, true));
- }
-
- @Override
- public void close() throws IOException {
- if (out != null) {
- finish();
- out.close();
- out = null;
- }
- }
-
- public void closeEntry() throws IOException {
- if (cDir == null) {
- throw new IOException();
- }
- if (currentEntry == null) {
- return;
- }
- if (currentEntry.getMethod() == DEFLATED) {
- super.finish();
- }
-
- // Verify values for STORED types
- if (currentEntry.getMethod() == STORED) {
- if (crc.getValue() != currentEntry.getCrc()) {
- throw new ZipException();
- }
- if (currentEntry.getSize() != crc.tbytes) {
- throw new ZipException();
- }
- }
- curOffset = LOCHDR;
-
- // Write the DataDescriptor
- if (currentEntry.getMethod() != STORED) {
- curOffset += EXTHDR;
- writeLong(out, EXTSIG);
- currentEntry.setCrc(crc.getValue());
- writeLong(out, currentEntry.getCrc());
- currentEntry.setCompressedSize(deflater.getTotalOut());
- writeLong(out, currentEntry.getCompressedSize());
- currentEntry.setSize(deflater.getTotalIn());
- writeLong(out, currentEntry.getSize());
- }
- // Update the CentralDirectory
- writeLong(cDir, CENSIG);
- writeShort(cDir, ZIPLocalHeaderVersionNeeded); // Version created
- writeShort(cDir, ZIPLocalHeaderVersionNeeded); // Version to extract
- writeShort(cDir, currentEntry.getMethod() == STORED ? 0 : ZIPDataDescriptorFlag);
- writeShort(cDir, currentEntry.getMethod());
- writeShort(cDir, (int) currentEntry.getTime());
- writeShort(cDir, 0);
- writeLong(cDir, crc.getValue());
- if (currentEntry.getMethod() == DEFLATED) {
- curOffset += writeLong(cDir, deflater.getTotalOut());
- writeLong(cDir, deflater.getTotalIn());
- } else {
- curOffset += writeLong(cDir, crc.tbytes);
- writeLong(cDir, crc.tbytes);
- }
- curOffset += writeShort(cDir, nameLength);
- if (currentEntry.getExtra() != null) {
- curOffset += writeShort(cDir, currentEntry.getExtra().length);
- } else {
- writeShort(cDir, 0);
- }
- String c = currentEntry.getComment();
- writeShort(cDir, c != null ? c.length() : 0);
- writeShort(cDir, 0); // Disk Start
- writeShort(cDir, 0); // Internal File Attributes
- writeLong(cDir, 0); // External File Attributes
- writeLong(cDir, offset);
- cDir.write(nameBytes);
- nameBytes = null;
- if (currentEntry.getExtra() != null) {
- cDir.write(currentEntry.getExtra());
- }
- offset += curOffset;
- if (c != null) {
- cDir.write(c.getBytes());
- }
- currentEntry = null;
- crc.reset();
- deflater.end();
- deflater.init(-1, true);
- }
-
- @Override
- public void finish() throws IOException {
- if (out == null) {
- throw new IOException();
- }
- if (cDir == null) {
- return;
- }
- if (entries.size() == 0) {
- throw new ZipException();
- }
- if (currentEntry != null) {
- closeEntry();
- }
- int cdirSize = cDir.size();
- // Write Central Dir End
- writeLong(cDir, ENDSIG);
- writeShort(cDir, 0); // Disk Number
- writeShort(cDir, 0); // Start Disk
- writeShort(cDir, entries.size()); // Number of entries
- writeShort(cDir, entries.size()); // Number of entries
- writeLong(cDir, cdirSize); // Size of central dir
- writeLong(cDir, offset); // Offset of central dir
- if (comment != null) {
- writeShort(cDir, comment.length());
- cDir.write(comment.getBytes());
- } else {
- writeShort(cDir, 0);
- }
- // Write the central dir
- out.write(cDir.toByteArray());
- cDir = null;
-
- }
-
- public void putNextEntry(ZipEntry ze) throws IOException {
- if (currentEntry != null) {
- closeEntry();
- }
- if (ze.getMethod() == STORED || (compressMethod == STORED && ze.getMethod() == -1)) {
- if (ze.getCrc() == -1) {
- throw new ZipException("Crc mismatch");
- }
- if (ze.getSize() == -1 && ze.getCompressedSize() == -1) {
- throw new ZipException("Size mismatch");
- }
- if (ze.getSize() != ze.getCompressedSize() && ze.getCompressedSize() != -1 && ze.getSize() != -1) {
- throw new ZipException("Size mismatch");
- }
- }
- if (cDir == null) {
- throw new IOException("Stream is closed");
- }
- if (entries.contains(ze.getName())) {
- throw new ZipException("Entry already exists: " + ze.getName());
- }
- nameLength = utf8Count(ze.getName());
- if (nameLength > 0xffff) {
- throw new IllegalArgumentException("Name too long: " + ze.getName());
- }
-
- deflater.params(compressLevel, 0);
- currentEntry = ze;
- entries.add(currentEntry.getName());
- if (currentEntry.getMethod() == -1) {
- currentEntry.setMethod(compressMethod);
- }
- writeLong(out, LOCSIG); // Entry header
- writeShort(out, ZIPLocalHeaderVersionNeeded); // Extraction version
- writeShort(out, currentEntry.getMethod() == STORED ? 0 : ZIPDataDescriptorFlag);
- writeShort(out, currentEntry.getMethod());
- if (currentEntry.getTime() == -1) {
- currentEntry.setTime(System.currentTimeMillis());
- }
- writeShort(out, (int) currentEntry.getTime());
- writeShort(out, 0);
-
- if (currentEntry.getMethod() == STORED) {
- if (currentEntry.getSize() == -1) {
- currentEntry.setSize(currentEntry.getCompressedSize());
- } else if (currentEntry.getCompressedSize() == -1) {
- currentEntry.setCompressedSize(currentEntry.getSize());
- }
- writeLong(out, currentEntry.getCrc());
- writeLong(out, currentEntry.getSize());
- writeLong(out, currentEntry.getSize());
- } else {
- writeLong(out, 0);
- writeLong(out, 0);
- writeLong(out, 0);
- }
- writeShort(out, nameLength);
- writeShort(out, currentEntry.getExtra() != null ? currentEntry.getExtra().length : 0);
- nameBytes = toUTF8Bytes(currentEntry.getName(), nameLength);
- out.write(nameBytes);
- if (currentEntry.getExtra() != null) {
- out.write(currentEntry.getExtra());
- }
- }
-
- public void setComment(String comment) {
- if (comment.length() > 0xFFFF) {
- throw new IllegalArgumentException();
- }
- this.comment = comment;
- }
-
- public void setLevel(int level) {
- if (level < DEFAULT_COMPRESSION || level > BEST_COMPRESSION) {
- throw new IllegalArgumentException();
- }
- compressLevel = level;
- }
-
- public void setMethod(int method) {
- if (method != STORED && method != DEFLATED) {
- throw new IllegalArgumentException();
- }
- compressMethod = method;
-
- }
-
- private long writeLong(OutputStream os, long i) throws IOException {
- // Write out the long value as an unsigned int
- os.write((int) (i & 0xFF));
- os.write((int) (i >> 8) & 0xFF);
- os.write((int) (i >> 16) & 0xFF);
- os.write((int) (i >> 24) & 0xFF);
- return i;
- }
-
- private int writeShort(OutputStream os, int i) throws IOException {
- os.write(i & 0xFF);
- os.write((i >> 8) & 0xFF);
- return i;
-
- }
-
- /**
- * Writes data for the current entry to the underlying stream.
- *
- * @exception IOException If an error occurs writing to the stream
- */
- @Override
- public void write(byte[] buffer, int off, int nbytes) throws IOException {
- // avoid int overflow, check null buf
- if ((off < 0 || (nbytes < 0) || off > buffer.length) || (buffer.length - off < nbytes)) {
- throw new IndexOutOfBoundsException();
- }
-
- if (currentEntry == null) {
- throw new ZipException("No active entry");
- }
-
- if (currentEntry.getMethod() == STORED) {
- out.write(buffer, off, nbytes);
- } else {
- super.write(buffer, off, nbytes);
- }
- crc.update(buffer, off, nbytes);
- }
-
- static int utf8Count(String value) {
- int total = 0;
- for (int i = value.length(); --i >= 0;) {
- char ch = value.charAt(i);
- if (ch < 0x80) {
- total++;
- } else if (ch < 0x800) {
- total += 2;
- } else {
- total += 3;
- }
- }
- return total;
- }
-
- static byte[] toUTF8Bytes(String value, int length) {
- byte[] result = new byte[length];
- int pos = result.length;
- for (int i = value.length(); --i >= 0;) {
- char ch = value.charAt(i);
- if (ch < 0x80) {
- result[--pos] = (byte) ch;
- } else if (ch < 0x800) {
- result[--pos] = (byte) (0x80 | (ch & 0x3f));
- result[--pos] = (byte) (0xc0 | (ch >> 6));
- } else {
- result[--pos] = (byte) (0x80 | (ch & 0x3f));
- result[--pos] = (byte) (0x80 | ((ch >> 6) & 0x3f));
- result[--pos] = (byte) (0xe0 | (ch >> 12));
- }
- }
- return result;
- }
-}
diff --git a/sp-server/src/main/java/net/minecraft/server/MinecraftServer.java b/sp-server/src/main/java/net/minecraft/server/MinecraftServer.java
index 0d63416..bc21910 100644
--- a/sp-server/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/sp-server/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -8,6 +8,7 @@ import java.util.List;
import net.lax1dude.eaglercraft.sp.IntegratedServer;
import net.lax1dude.eaglercraft.sp.SYS;
+import net.lax1dude.eaglercraft.sp.SysUtil;
import net.lax1dude.eaglercraft.sp.VFSSaveHandler;
import net.lax1dude.eaglercraft.sp.VFile;
import net.lax1dude.eaglercraft.sp.WorkerListenThread;
@@ -355,10 +356,10 @@ public abstract class MinecraftServer implements ICommandSender, Runnable {
public void run() {
try {
if (this.startServer()) {
- long var1 = System.currentTimeMillis();
+ long var1 = SysUtil.steadyTimeMillis();
for (long var50 = 0L; this.serverRunning; this.serverIsRunning = true) {
- long var5 = System.currentTimeMillis();
+ long var5 = SysUtil.steadyTimeMillis();
long var7 = var5 - var1;
if (var7 > 2000L && var1 - this.timeOfLastWarning >= 15000L) {
@@ -386,7 +387,7 @@ public abstract class MinecraftServer implements ICommandSender, Runnable {
}
}
- Thread.sleep(1L);
+ SysUtil.sleep(1);
}
} else {
throw new RuntimeException("Server did not init correctly");
@@ -456,7 +457,7 @@ public abstract class MinecraftServer implements ICommandSender, Runnable {
this.theProfiler.endSection();
++tpsCounter;
- long millis = System.currentTimeMillis();
+ long millis = SysUtil.steadyTimeMillis();
long elapsed = millis - tpsTimer;
if(elapsed >= 1000l) {
tpsTimer = millis;
diff --git a/sp-server/src/main/java/net/minecraft/src/BiomeCache.java b/sp-server/src/main/java/net/minecraft/src/BiomeCache.java
index 2b1493c..e2a8060 100644
--- a/sp-server/src/main/java/net/minecraft/src/BiomeCache.java
+++ b/sp-server/src/main/java/net/minecraft/src/BiomeCache.java
@@ -3,6 +3,8 @@ package net.minecraft.src;
import java.util.ArrayList;
import java.util.List;
+import net.lax1dude.eaglercraft.sp.SysUtil;
+
public class BiomeCache {
/** Reference to the WorldChunkManager */
private final WorldChunkManager chunkManager;
@@ -38,7 +40,7 @@ public class BiomeCache {
this.cache.add(var5);
}
- var5.lastAccessTime = System.currentTimeMillis();
+ var5.lastAccessTime = SysUtil.steadyTimeMillis();
return var5;
}
@@ -54,7 +56,7 @@ public class BiomeCache {
* least 30 seconds.
*/
public void cleanupCache() {
- long var1 = System.currentTimeMillis();
+ long var1 = SysUtil.steadyTimeMillis();
long var3 = var1 - this.lastCleanupTime;
if (var3 > 7500L || var3 < 0L) {
diff --git a/sp-server/src/main/java/net/minecraft/src/ChunkProviderServer.java b/sp-server/src/main/java/net/minecraft/src/ChunkProviderServer.java
index 3f26403..f9b54c3 100644
--- a/sp-server/src/main/java/net/minecraft/src/ChunkProviderServer.java
+++ b/sp-server/src/main/java/net/minecraft/src/ChunkProviderServer.java
@@ -7,6 +7,8 @@ import java.util.Iterator;
import java.util.List;
import java.util.Set;
+import net.lax1dude.eaglercraft.sp.SysUtil;
+
public class ChunkProviderServer implements IChunkProvider {
private Set droppedChunksSet = new HashSet();
@@ -227,7 +229,7 @@ public class ChunkProviderServer implements IChunkProvider {
public boolean unloadQueuedChunks() {
if (!this.worldObj.levelSaving) {
- long millis = System.currentTimeMillis();
+ long millis = SysUtil.steadyTimeMillis();
if(millis - fixTheFuckingMemoryLeak > 10000l) { // FUCK OFF SUCK MY FUCKING COCK
fixTheFuckingMemoryLeak = millis;
this.id2ChunkMap.iterate((l,o) -> {
diff --git a/sp-server/src/main/java/net/minecraft/src/CommandDebug.java b/sp-server/src/main/java/net/minecraft/src/CommandDebug.java
index 6012822..d57ec58 100644
--- a/sp-server/src/main/java/net/minecraft/src/CommandDebug.java
+++ b/sp-server/src/main/java/net/minecraft/src/CommandDebug.java
@@ -2,6 +2,7 @@ package net.minecraft.src;
import java.util.List;
+import net.lax1dude.eaglercraft.sp.SysUtil;
import net.minecraft.server.MinecraftServer;
public class CommandDebug extends CommandBase {
@@ -27,7 +28,7 @@ public class CommandDebug extends CommandBase {
if (par2ArrayOfStr[0].equals("start")) {
notifyAdmins(par1ICommandSender, "commands.debug.start", new Object[0]);
MinecraftServer.getServer().enableProfiling();
- this.startTime = System.currentTimeMillis();
+ this.startTime = SysUtil.steadyTimeMillis();
this.startTicks = MinecraftServer.getServer().getTickCounter();
return;
}
@@ -37,7 +38,7 @@ public class CommandDebug extends CommandBase {
throw new CommandException("commands.debug.notStarted", new Object[0]);
}
- long var3 = System.currentTimeMillis();
+ long var3 = SysUtil.steadyTimeMillis();
int var5 = MinecraftServer.getServer().getTickCounter();
long var6 = var3 - this.startTime;
int var8 = var5 - this.startTicks;
diff --git a/sp-server/src/main/java/net/minecraft/src/ConvertingProgressUpdate.java b/sp-server/src/main/java/net/minecraft/src/ConvertingProgressUpdate.java
index 4ffd3f8..ada3d1d 100644
--- a/sp-server/src/main/java/net/minecraft/src/ConvertingProgressUpdate.java
+++ b/sp-server/src/main/java/net/minecraft/src/ConvertingProgressUpdate.java
@@ -1,5 +1,6 @@
package net.minecraft.src;
+import net.lax1dude.eaglercraft.sp.SysUtil;
import net.minecraft.server.MinecraftServer;
public class ConvertingProgressUpdate implements IProgressUpdate {
@@ -10,7 +11,7 @@ public class ConvertingProgressUpdate implements IProgressUpdate {
public ConvertingProgressUpdate(MinecraftServer par1) {
this.mcServer = par1;
- this.field_96245_b = System.currentTimeMillis();
+ this.field_96245_b = SysUtil.steadyTimeMillis();
}
/**
@@ -24,8 +25,9 @@ public class ConvertingProgressUpdate implements IProgressUpdate {
* loadProgress
*/
public void setLoadingProgress(int par1) {
- if (System.currentTimeMillis() - this.field_96245_b >= 1000L) {
- this.field_96245_b = System.currentTimeMillis();
+ long l = SysUtil.steadyTimeMillis();
+ if (l - this.field_96245_b >= 1000L) {
+ this.field_96245_b = l;
this.mcServer.getLogAgent().func_98233_a("Converting... " + par1 + "%");
}
}
diff --git a/sp-server/src/main/java/net/minecraft/src/EntityAgeable.java b/sp-server/src/main/java/net/minecraft/src/EntityAgeable.java
index 1b130d1..cb6ea86 100644
--- a/sp-server/src/main/java/net/minecraft/src/EntityAgeable.java
+++ b/sp-server/src/main/java/net/minecraft/src/EntityAgeable.java
@@ -49,7 +49,7 @@ public abstract class EntityAgeable extends EntityCreature {
protected void entityInit() {
super.entityInit();
- this.dataWatcher.addObject(12, new Integer(0));
+ this.dataWatcher.addObject(12, Integer.valueOf(0));
}
/**
diff --git a/sp-server/src/main/java/net/minecraft/src/EntityBat.java b/sp-server/src/main/java/net/minecraft/src/EntityBat.java
index 2a80260..0062f8f 100644
--- a/sp-server/src/main/java/net/minecraft/src/EntityBat.java
+++ b/sp-server/src/main/java/net/minecraft/src/EntityBat.java
@@ -15,7 +15,7 @@ public class EntityBat extends EntityAmbientCreature {
protected void entityInit() {
super.entityInit();
- this.dataWatcher.addObject(16, new Byte((byte) 0));
+ this.dataWatcher.addObject(16, Byte.valueOf((byte) 0));
}
/**
diff --git a/sp-server/src/main/java/net/minecraft/src/EntityBlaze.java b/sp-server/src/main/java/net/minecraft/src/EntityBlaze.java
index a6554b0..e821e78 100644
--- a/sp-server/src/main/java/net/minecraft/src/EntityBlaze.java
+++ b/sp-server/src/main/java/net/minecraft/src/EntityBlaze.java
@@ -21,7 +21,7 @@ public class EntityBlaze extends EntityMob {
protected void entityInit() {
super.entityInit();
- this.dataWatcher.addObject(16, new Byte((byte) 0));
+ this.dataWatcher.addObject(16, Byte.valueOf((byte) 0));
}
/**
diff --git a/sp-server/src/main/java/net/minecraft/src/EntityBoat.java b/sp-server/src/main/java/net/minecraft/src/EntityBoat.java
index 9dabeee..0172a1b 100644
--- a/sp-server/src/main/java/net/minecraft/src/EntityBoat.java
+++ b/sp-server/src/main/java/net/minecraft/src/EntityBoat.java
@@ -30,9 +30,9 @@ public class EntityBoat extends Entity {
}
protected void entityInit() {
- this.dataWatcher.addObject(17, new Integer(0));
- this.dataWatcher.addObject(18, new Integer(1));
- this.dataWatcher.addObject(19, new Integer(0));
+ this.dataWatcher.addObject(17, Integer.valueOf(0));
+ this.dataWatcher.addObject(18, Integer.valueOf(1));
+ this.dataWatcher.addObject(19, Integer.valueOf(0));
}
/**
diff --git a/sp-server/src/main/java/net/minecraft/src/EntityDragon.java b/sp-server/src/main/java/net/minecraft/src/EntityDragon.java
index 25b5f05..9e1d28e 100644
--- a/sp-server/src/main/java/net/minecraft/src/EntityDragon.java
+++ b/sp-server/src/main/java/net/minecraft/src/EntityDragon.java
@@ -82,7 +82,7 @@ public class EntityDragon extends EntityLiving implements IEntityMultiPart {
protected void entityInit() {
super.entityInit();
- this.dataWatcher.addObject(16, new Integer(this.getMaxHealth()));
+ this.dataWatcher.addObject(16, Integer.valueOf(this.getMaxHealth()));
}
/**
diff --git a/sp-server/src/main/java/net/minecraft/src/EntityEnderman.java b/sp-server/src/main/java/net/minecraft/src/EntityEnderman.java
index b2e705f..c78d98c 100644
--- a/sp-server/src/main/java/net/minecraft/src/EntityEnderman.java
+++ b/sp-server/src/main/java/net/minecraft/src/EntityEnderman.java
@@ -25,9 +25,9 @@ public class EntityEnderman extends EntityMob {
protected void entityInit() {
super.entityInit();
- this.dataWatcher.addObject(16, new Byte((byte) 0));
- this.dataWatcher.addObject(17, new Byte((byte) 0));
- this.dataWatcher.addObject(18, new Byte((byte) 0));
+ this.dataWatcher.addObject(16, Byte.valueOf((byte) 0));
+ this.dataWatcher.addObject(17, Byte.valueOf((byte) 0));
+ this.dataWatcher.addObject(18, Byte.valueOf((byte) 0));
}
/**
diff --git a/sp-server/src/main/java/net/minecraft/src/EntityMinecart.java b/sp-server/src/main/java/net/minecraft/src/EntityMinecart.java
index 6128e20..b69a856 100644
--- a/sp-server/src/main/java/net/minecraft/src/EntityMinecart.java
+++ b/sp-server/src/main/java/net/minecraft/src/EntityMinecart.java
@@ -70,11 +70,11 @@ public abstract class EntityMinecart extends Entity {
}
protected void entityInit() {
- this.dataWatcher.addObject(17, new Integer(0));
- this.dataWatcher.addObject(18, new Integer(1));
- this.dataWatcher.addObject(19, new Integer(0));
- this.dataWatcher.addObject(20, new Integer(0));
- this.dataWatcher.addObject(21, new Integer(6));
+ this.dataWatcher.addObject(17, Integer.valueOf(0));
+ this.dataWatcher.addObject(18, Integer.valueOf(1));
+ this.dataWatcher.addObject(19, Integer.valueOf(0));
+ this.dataWatcher.addObject(20, Integer.valueOf(0));
+ this.dataWatcher.addObject(21, Integer.valueOf(6));
this.dataWatcher.addObject(22, Byte.valueOf((byte) 0));
}
diff --git a/sp-server/src/main/java/net/minecraft/src/EntityMinecartFurnace.java b/sp-server/src/main/java/net/minecraft/src/EntityMinecartFurnace.java
index 486ad03..db8d4e1 100644
--- a/sp-server/src/main/java/net/minecraft/src/EntityMinecartFurnace.java
+++ b/sp-server/src/main/java/net/minecraft/src/EntityMinecartFurnace.java
@@ -19,7 +19,7 @@ public class EntityMinecartFurnace extends EntityMinecart {
protected void entityInit() {
super.entityInit();
- this.dataWatcher.addObject(16, new Byte((byte) 0));
+ this.dataWatcher.addObject(16, Byte.valueOf((byte) 0));
}
/**
diff --git a/sp-server/src/main/java/net/minecraft/src/EntitySheep.java b/sp-server/src/main/java/net/minecraft/src/EntitySheep.java
index 7877881..2cdd677 100644
--- a/sp-server/src/main/java/net/minecraft/src/EntitySheep.java
+++ b/sp-server/src/main/java/net/minecraft/src/EntitySheep.java
@@ -74,7 +74,7 @@ public class EntitySheep extends EntityAnimal {
protected void entityInit() {
super.entityInit();
- this.dataWatcher.addObject(16, new Byte((byte) 0));
+ this.dataWatcher.addObject(16, Byte.valueOf((byte) 0));
}
/**
diff --git a/sp-server/src/main/java/net/minecraft/src/EntitySkeleton.java b/sp-server/src/main/java/net/minecraft/src/EntitySkeleton.java
index d1453e4..509d884 100644
--- a/sp-server/src/main/java/net/minecraft/src/EntitySkeleton.java
+++ b/sp-server/src/main/java/net/minecraft/src/EntitySkeleton.java
@@ -27,7 +27,7 @@ public class EntitySkeleton extends EntityMob implements IRangedAttackMob {
protected void entityInit() {
super.entityInit();
- this.dataWatcher.addObject(13, new Byte((byte) 0));
+ this.dataWatcher.addObject(13, Byte.valueOf((byte) 0));
}
/**
diff --git a/sp-server/src/main/java/net/minecraft/src/EntitySlime.java b/sp-server/src/main/java/net/minecraft/src/EntitySlime.java
index 5eb2c3a..7b381ad 100644
--- a/sp-server/src/main/java/net/minecraft/src/EntitySlime.java
+++ b/sp-server/src/main/java/net/minecraft/src/EntitySlime.java
@@ -21,11 +21,11 @@ public class EntitySlime extends EntityLiving implements IMob {
protected void entityInit() {
super.entityInit();
- this.dataWatcher.addObject(16, new Byte((byte) 1));
+ this.dataWatcher.addObject(16, Byte.valueOf((byte) 1));
}
protected void setSlimeSize(int par1) {
- this.dataWatcher.updateObject(16, new Byte((byte) par1));
+ this.dataWatcher.updateObject(16, Byte.valueOf((byte) par1));
this.setSize(0.6F * (float) par1, 0.6F * (float) par1);
this.setPosition(this.posX, this.posY, this.posZ);
this.setEntityHealth(this.getMaxHealth());
diff --git a/sp-server/src/main/java/net/minecraft/src/EntitySpider.java b/sp-server/src/main/java/net/minecraft/src/EntitySpider.java
index bd61884..78b6cd6 100644
--- a/sp-server/src/main/java/net/minecraft/src/EntitySpider.java
+++ b/sp-server/src/main/java/net/minecraft/src/EntitySpider.java
@@ -10,7 +10,7 @@ public class EntitySpider extends EntityMob {
protected void entityInit() {
super.entityInit();
- this.dataWatcher.addObject(16, new Byte((byte) 0));
+ this.dataWatcher.addObject(16, Byte.valueOf((byte) 0));
}
/**
diff --git a/sp-server/src/main/java/net/minecraft/src/EntityWither.java b/sp-server/src/main/java/net/minecraft/src/EntityWither.java
index 9679983..a9ab794 100644
--- a/sp-server/src/main/java/net/minecraft/src/EntityWither.java
+++ b/sp-server/src/main/java/net/minecraft/src/EntityWither.java
@@ -35,11 +35,11 @@ public class EntityWither extends EntityMob implements IRangedAttackMob {
protected void entityInit() {
super.entityInit();
- this.dataWatcher.addObject(16, new Integer(100));
- this.dataWatcher.addObject(17, new Integer(0));
- this.dataWatcher.addObject(18, new Integer(0));
- this.dataWatcher.addObject(19, new Integer(0));
- this.dataWatcher.addObject(20, new Integer(0));
+ this.dataWatcher.addObject(16, Integer.valueOf(100));
+ this.dataWatcher.addObject(17, Integer.valueOf(0));
+ this.dataWatcher.addObject(18, Integer.valueOf(0));
+ this.dataWatcher.addObject(19, Integer.valueOf(0));
+ this.dataWatcher.addObject(20, Integer.valueOf(0));
}
/**
diff --git a/sp-server/src/main/java/net/minecraft/src/EntityWolf.java b/sp-server/src/main/java/net/minecraft/src/EntityWolf.java
index 5b2b433..02094e2 100644
--- a/sp-server/src/main/java/net/minecraft/src/EntityWolf.java
+++ b/sp-server/src/main/java/net/minecraft/src/EntityWolf.java
@@ -67,9 +67,9 @@ public class EntityWolf extends EntityTameable {
protected void entityInit() {
super.entityInit();
- this.dataWatcher.addObject(18, new Integer(this.getHealth()));
- this.dataWatcher.addObject(19, new Byte((byte) 0));
- this.dataWatcher.addObject(20, new Byte((byte) BlockCloth.getBlockFromDye(1)));
+ this.dataWatcher.addObject(18, Integer.valueOf(this.getHealth()));
+ this.dataWatcher.addObject(19, Byte.valueOf((byte) 0));
+ this.dataWatcher.addObject(20, Byte.valueOf((byte) BlockCloth.getBlockFromDye(1)));
}
/**
diff --git a/sp-server/src/main/java/net/minecraft/src/Packet.java b/sp-server/src/main/java/net/minecraft/src/Packet.java
index d1d8dbe..5acefce 100644
--- a/sp-server/src/main/java/net/minecraft/src/Packet.java
+++ b/sp-server/src/main/java/net/minecraft/src/Packet.java
@@ -10,6 +10,8 @@ import java.util.HashSet;
import java.util.Map;
import java.util.Set;
+import net.lax1dude.eaglercraft.sp.SysUtil;
+
public abstract class Packet {
/** Maps packet id to packet class */
public static IntHashMap packetIdToClassMap = new IntHashMap();
@@ -25,7 +27,7 @@ public abstract class Packet {
public ILogAgent field_98193_m;
/** the system time in milliseconds when this packet was created. */
- public final long creationTimeMillis = System.currentTimeMillis();
+ public final long creationTimeMillis = SysUtil.steadyTimeMillis();
public static long receivedID;
public static long receivedSize;
diff --git a/sp-server/src/main/java/net/minecraft/src/WorldServer.java b/sp-server/src/main/java/net/minecraft/src/WorldServer.java
index fd8ce36..07d6ecc 100644
--- a/sp-server/src/main/java/net/minecraft/src/WorldServer.java
+++ b/sp-server/src/main/java/net/minecraft/src/WorldServer.java
@@ -8,6 +8,7 @@ import java.util.Set;
import java.util.TreeSet;
import net.lax1dude.eaglercraft.sp.EaglercraftRandom;
+import net.lax1dude.eaglercraft.sp.SysUtil;
import net.minecraft.server.MinecraftServer;
public class WorldServer extends World {
@@ -166,7 +167,7 @@ public class WorldServer extends World {
_lu += Chunk.totalBlockLightUpdates;
Chunk.totalBlockLightUpdates = 0;
- long millis = System.currentTimeMillis();
+ long millis = SysUtil.steadyTimeMillis();
if(millis - rwgtuluTimer >= 1000l) {
rwgtuluTimer = millis;
r = _r; _r = 0;
diff --git a/src/lwjgl/java/net/lax1dude/eaglercraft/adapter/EaglerAdapterImpl2.java b/src/lwjgl/java/net/lax1dude/eaglercraft/adapter/EaglerAdapterImpl2.java
index 1ef324e..0ae329a 100644
--- a/src/lwjgl/java/net/lax1dude/eaglercraft/adapter/EaglerAdapterImpl2.java
+++ b/src/lwjgl/java/net/lax1dude/eaglercraft/adapter/EaglerAdapterImpl2.java
@@ -1622,7 +1622,7 @@ public class EaglerAdapterImpl2 {
this.alive = true;
synchronized(queryResponses) {
if(pingTimer == -1) {
- pingTimer = System.currentTimeMillis() - pingStart;
+ pingTimer = steadyTimeMillis() - pingStart;
}
if(arg0.equalsIgnoreCase("BLOCKED")) {
synchronized(socketSync) {
@@ -1672,7 +1672,7 @@ public class EaglerAdapterImpl2 {
@Override
public void onOpen(ServerHandshake arg0) {
send("Accept: " + type);
- pingStart = System.currentTimeMillis();
+ pingStart = steadyTimeMillis();
}
@Override
@@ -1995,5 +1995,20 @@ public class EaglerAdapterImpl2 {
public static final byte[] downloadURL(String url) {
return null;
}
-
+
+ public static final long steadyTimeMillis() {
+ return System.nanoTime() / 1000000l;
+ }
+
+ public static final long nanoTime() {
+ return System.nanoTime();
+ }
+
+ public static final void sleep(int millis) {
+ try {
+ Thread.sleep(millis);
+ }catch(InterruptedException ex) {
+ }
+ }
+
}
diff --git a/src/lwjgl/java/paulscode/sound/CommandThread.java b/src/lwjgl/java/paulscode/sound/CommandThread.java
index 982e6fa..f0c81af 100644
--- a/src/lwjgl/java/paulscode/sound/CommandThread.java
+++ b/src/lwjgl/java/paulscode/sound/CommandThread.java
@@ -1,5 +1,7 @@
package paulscode.sound;
+import net.lax1dude.eaglercraft.EaglerAdapter;
+
/**
* The CommandThread class is designed to move all command processing into a
* single thread to be run in the background and avoid conflicts between
@@ -99,7 +101,7 @@ public class CommandThread extends SimpleThread
@Override
public void run()
{
- long previousTime = System.currentTimeMillis();
+ long previousTime = EaglerAdapter.steadyTimeMillis();
long currentTime = previousTime;
if( soundSystem == null )
@@ -121,7 +123,7 @@ public class CommandThread extends SimpleThread
soundSystem.CommandQueue( null );
// Remove temporary sources every ten seconds:
- currentTime = System.currentTimeMillis();
+ currentTime = EaglerAdapter.steadyTimeMillis();
if( (!dying()) && ((currentTime - previousTime) > 10000) )
{
previousTime = currentTime;
diff --git a/src/lwjgl/java/paulscode/sound/MidiChannel.java b/src/lwjgl/java/paulscode/sound/MidiChannel.java
index aedf033..a607421 100644
--- a/src/lwjgl/java/paulscode/sound/MidiChannel.java
+++ b/src/lwjgl/java/paulscode/sound/MidiChannel.java
@@ -17,6 +17,8 @@ import javax.sound.midi.Sequencer;
import javax.sound.midi.ShortMessage;
import javax.sound.midi.Synthesizer;
+import net.lax1dude.eaglercraft.EaglerAdapter;
+
/**
* The MidiChannel class provides an interface for playing MIDI files, using
* the JavaSound API. For more information about the JavaSound API, visit
@@ -422,7 +424,7 @@ public class MidiChannel implements MetaEventListener
fadeOutMilis = milis;
fadeInMilis = 0;
fadeOutGain = 1.0f;
- lastFadeCheck = System.currentTimeMillis();
+ lastFadeCheck = EaglerAdapter.steadyTimeMillis();
synchronized( sequenceQueueLock )
{
@@ -474,7 +476,7 @@ public class MidiChannel implements MetaEventListener
fadeOutMilis = milisOut;
fadeInMilis = milisIn;
fadeOutGain = 1.0f;
- lastFadeCheck = System.currentTimeMillis();
+ lastFadeCheck = EaglerAdapter.steadyTimeMillis();
synchronized( sequenceQueueLock )
{
@@ -503,7 +505,7 @@ public class MidiChannel implements MetaEventListener
if( fadeOutGain == -1.0f && fadeInGain == 1.0f )
return false;
- long currentTime = System.currentTimeMillis();
+ long currentTime = EaglerAdapter.steadyTimeMillis();
long milisPast = currentTime - lastFadeCheck;
lastFadeCheck = currentTime;
diff --git a/src/lwjgl/java/paulscode/sound/Source.java b/src/lwjgl/java/paulscode/sound/Source.java
index 00c0a0a..5bc6cb0 100644
--- a/src/lwjgl/java/paulscode/sound/Source.java
+++ b/src/lwjgl/java/paulscode/sound/Source.java
@@ -5,6 +5,8 @@ import java.util.LinkedList;
import java.util.ListIterator;
import javax.sound.sampled.AudioFormat;
+import net.lax1dude.eaglercraft.EaglerAdapter;
+
/**
* The Source class is used to store information about a source.
* Source objects are stored in a map in the Library class. The
@@ -476,7 +478,7 @@ public class Source
fadeOutMilis = milis;
fadeInMilis = 0;
fadeOutGain = 1.0f;
- lastFadeCheck = System.currentTimeMillis();
+ lastFadeCheck = EaglerAdapter.steadyTimeMillis();
synchronized( soundSequenceLock )
{
@@ -529,7 +531,7 @@ public class Source
fadeInMilis = milisIn;
fadeOutGain = 1.0f;
- lastFadeCheck = System.currentTimeMillis();
+ lastFadeCheck = EaglerAdapter.steadyTimeMillis();
synchronized( soundSequenceLock )
{
@@ -555,7 +557,7 @@ public class Source
if( fadeOutGain == -1.0f && fadeInGain == 1.0f )
return false;
- long currentTime = System.currentTimeMillis();
+ long currentTime = EaglerAdapter.steadyTimeMillis();
long milisPast = currentTime - lastFadeCheck;
lastFadeCheck = currentTime;
diff --git a/src/main/java/net/lax1dude/eaglercraft/AssetRepository.java b/src/main/java/net/lax1dude/eaglercraft/AssetRepository.java
index 03810a7..cabf774 100644
--- a/src/main/java/net/lax1dude/eaglercraft/AssetRepository.java
+++ b/src/main/java/net/lax1dude/eaglercraft/AssetRepository.java
@@ -10,14 +10,13 @@ import java.util.HashMap;
import com.jcraft.jzlib.CRC32;
import com.jcraft.jzlib.GZIPInputStream;
import com.jcraft.jzlib.InflaterInputStream;
-import org.json.JSONArray;
import org.json.JSONObject;
public class AssetRepository {
- private static final HashMap filePool = new HashMap();
- private static final HashMap filePoolTemp = new HashMap();
- public static final HashMap fileNameOverrides = new HashMap();
+ private static final HashMap filePool = new HashMap<>();
+ private static final HashMap filePoolTemp = new HashMap<>();
+ public static final HashMap fileNameOverrides = new HashMap<>();
public static final void loadOverrides(JSONObject json) {
JSONObject overrides = json.optJSONObject("assetOverrides", null);
diff --git a/src/main/java/net/lax1dude/eaglercraft/DefaultSkinRenderer.java b/src/main/java/net/lax1dude/eaglercraft/DefaultSkinRenderer.java
index ee2fdde..0342a04 100644
--- a/src/main/java/net/lax1dude/eaglercraft/DefaultSkinRenderer.java
+++ b/src/main/java/net/lax1dude/eaglercraft/DefaultSkinRenderer.java
@@ -104,20 +104,21 @@ public class DefaultSkinRenderer {
false, true
};
- private static final HashMap skinCookies = new HashMap();
- private static final HashMap skinGLUnits = new HashMap();
- private static final HashMap capeGLUnits = new HashMap();
- private static final HashMap skinGLTimeout = new HashMap();
+ private static final HashMap skinCookies = new HashMap<>();
+ private static final HashMap skinGLUnits = new HashMap<>();
+ private static final HashMap capeGLUnits = new HashMap<>();
+ private static final HashMap skinGLTimeout = new HashMap<>();
private static long lastClean = 0l;
public static void deleteOldSkins() {
- if(System.currentTimeMillis() - lastClean > 60000l) {
- lastClean = System.currentTimeMillis();
+ long now = EaglerAdapter.steadyTimeMillis();
+ if(now - lastClean > 60000l) {
+ lastClean = now;
Iterator> itr = skinGLTimeout.entrySet().iterator();
while(itr.hasNext()) {
Entry ee = itr.next();
- if(System.currentTimeMillis() - ee.getValue() > 80000l) {
+ if(now - ee.getValue() > 80000l) {
itr.remove();
if(skinGLUnits.containsKey(ee.getKey())) {
Minecraft.getMinecraft().renderEngine.deleteTexture(skinGLUnits.remove(ee.getKey()));
@@ -167,7 +168,7 @@ public class DefaultSkinRenderer {
skinGLUnits.put(pp, Minecraft.getMinecraft().renderEngine.setupTextureRaw(skinToLoad, w, h));
}
}
- skinGLTimeout.put(pp, System.currentTimeMillis());
+ skinGLTimeout.put(pp, EaglerAdapter.steadyTimeMillis());
Integer i = skinGLUnits.get(pp);
if(i != null && i.intValue() > 0) {
Minecraft.getMinecraft().renderEngine.bindTexture(i.intValue());
@@ -257,7 +258,7 @@ public class DefaultSkinRenderer {
capeGLUnits.put(pp, Minecraft.getMinecraft().renderEngine.setupTextureRaw(dataToLoad, w, h));
}
}
- skinGLTimeout.put(pp, System.currentTimeMillis());
+ skinGLTimeout.put(pp, EaglerAdapter.steadyTimeMillis());
Integer i = capeGLUnits.get(pp);
if(i != null && i.intValue() > 0) {
EaglerAdapter.glMatrixMode(EaglerAdapter.GL_TEXTURE);
@@ -586,32 +587,32 @@ public class DefaultSkinRenderer {
if(isNew) {
if((id < 0 && EaglerProfile.skins.get(id2).slim) || (id >= 0 && isAlexSkin(id))) {
newSkinRendererSlim.blockTransparentSkin = true;
- newSkinRendererSlim.render(null, 0.0f, 0.0f, (float)(System.currentTimeMillis() % 100000) / 50f, ((x - mx) * 0.06f), ((y - my) * -0.1f), 0.0625F);
+ newSkinRendererSlim.render(null, 0.0f, 0.0f, (float)(EaglerAdapter.steadyTimeMillis() % 100000) / 50f, ((x - mx) * 0.06f), ((y - my) * -0.1f), 0.0625F);
newSkinRendererSlim.blockTransparentSkin = false;
}else {
newSkinRenderer.blockTransparentSkin = true;
- newSkinRenderer.render(null, 0.0f, 0.0f, (float)(System.currentTimeMillis() % 100000) / 50f, ((x - mx) * 0.06f), ((y - my) * -0.1f), 0.0625F);
+ newSkinRenderer.render(null, 0.0f, 0.0f, (float)(EaglerAdapter.steadyTimeMillis() % 100000) / 50f, ((x - mx) * 0.06f), ((y - my) * -0.1f), 0.0625F);
newSkinRenderer.blockTransparentSkin = false;
}
}else {
oldSkinRenderer.blockTransparentSkin = true;
- oldSkinRenderer.render(null, 0.0f, 0.0f, (float)(System.currentTimeMillis() % 100000) / 50f, ((x - mx) * 0.06f), ((y - my) * -0.1f), 0.0625F);
+ oldSkinRenderer.render(null, 0.0f, 0.0f, (float)(EaglerAdapter.steadyTimeMillis() % 100000) / 50f, ((x - mx) * 0.06f), ((y - my) * -0.1f), 0.0625F);
oldSkinRenderer.blockTransparentSkin = false;
}
gonnaShowCape = capeMode;
}else if(isZombieModel(id)) {
if(zombieRenderer == null) zombieRenderer = new ModelZombie(0.0F, true);
zombieRenderer.isChild = false;
- zombieRenderer.render(null, 0.0f, 0.0f, (float)(System.currentTimeMillis() % 100000) / 50f, ((x - mx) * 0.06f), ((y - my) * -0.1f), 0.0625F);
+ zombieRenderer.render(null, 0.0f, 0.0f, (float)(EaglerAdapter.steadyTimeMillis() % 100000) / 50f, ((x - mx) * 0.06f), ((y - my) * -0.1f), 0.0625F);
gonnaShowCape = capeMode;
}else if(id == 32) {
if(villagerRenderer == null) villagerRenderer = new ModelVillager(0.0F);
villagerRenderer.isChild = false;
- villagerRenderer.render(null, 0.0f, 0.0f, (float)(System.currentTimeMillis() % 100000) / 50f, ((x - mx) * 0.06f), ((y - my) * -0.1f), 0.0625F);
+ villagerRenderer.render(null, 0.0f, 0.0f, (float)(EaglerAdapter.steadyTimeMillis() % 100000) / 50f, ((x - mx) * 0.06f), ((y - my) * -0.1f), 0.0625F);
}else if(id == 19) {
if(endermanRenderer == null) endermanRenderer = new ModelEnderman();
endermanRenderer.isChild = false;
- endermanRenderer.render(null, 0.0f, 0.0f, (float)(System.currentTimeMillis() % 100000) / 50f, ((x - mx) * 0.06f), ((y - my) * -0.1f), 0.0625F);
+ endermanRenderer.render(null, 0.0f, 0.0f, (float)(EaglerAdapter.steadyTimeMillis() % 100000) / 50f, ((x - mx) * 0.06f), ((y - my) * -0.1f), 0.0625F);
EaglerAdapter.glColor4f(1.4f, 1.4f, 1.4f, 1.0f);
//EaglerAdapter.glEnable(EaglerAdapter.GL_BLEND);
//EaglerAdapter.glDisable(EaglerAdapter.GL_ALPHA_TEST);
@@ -620,7 +621,7 @@ public class DefaultSkinRenderer {
EaglerAdapter.glEnable(EaglerAdapter.GL_TEXTURE_2D);
EaglerAdapter.glDisable(EaglerAdapter.GL_DEPTH_TEST);
RenderEnderman.tex_eyes.bindTexture();
- endermanRenderer.render(null, 0.0f, 0.0f, (float)(System.currentTimeMillis() % 100000) / 50f, ((x - mx) * 0.06f), ((y - my) * -0.1f), 0.0625F);
+ endermanRenderer.render(null, 0.0f, 0.0f, (float)(EaglerAdapter.steadyTimeMillis() % 100000) / 50f, ((x - mx) * 0.06f), ((y - my) * -0.1f), 0.0625F);
EaglerAdapter.glBlendFunc(EaglerAdapter.GL_SRC_ALPHA, EaglerAdapter.GL_ONE_MINUS_SRC_ALPHA);
EaglerAdapter.glEnable(EaglerAdapter.GL_ALPHA_TEST);
EaglerAdapter.glEnable(EaglerAdapter.GL_DEPTH_TEST);
@@ -629,12 +630,12 @@ public class DefaultSkinRenderer {
}else if(id == 20) {
if(skeletonRenderer == null) skeletonRenderer = new ModelSkeleton(0.0F);
skeletonRenderer.isChild = false;
- skeletonRenderer.render(null, 0.0f, 0.0f, (float)(System.currentTimeMillis() % 100000) / 50f, ((x - mx) * 0.06f), ((y - my) * -0.1f), 0.0625F);
+ skeletonRenderer.render(null, 0.0f, 0.0f, (float)(EaglerAdapter.steadyTimeMillis() % 100000) / 50f, ((x - mx) * 0.06f), ((y - my) * -0.1f), 0.0625F);
}else if(id == 21) {
if(blazeRenderer == null) blazeRenderer = new ModelBlaze();
blazeRenderer.isChild = false;
EaglerAdapter.glColor4f(1.5f, 1.5f, 1.5f, 1.0f);
- blazeRenderer.render(null, 0.0f, 0.0f, (float)(System.currentTimeMillis() % 100000) / 50f, ((x - mx) * 0.06f), ((y - my) * -0.1f), 0.0625F);
+ blazeRenderer.render(null, 0.0f, 0.0f, (float)(EaglerAdapter.steadyTimeMillis() % 100000) / 50f, ((x - mx) * 0.06f), ((y - my) * -0.1f), 0.0625F);
}
if(gonnaShowCape && !(EaglerProfile.presetCapeId >= 0 && defaultVanillaCapes[EaglerProfile.presetCapeId] == null)) {
EaglerAdapter.glPushMatrix();
@@ -706,7 +707,7 @@ public class DefaultSkinRenderer {
EaglerAdapter.glTranslatef(0.0F, -1.0F, 0.0F);
bp.isChild = false;
- bp.render(null, 0.0f, 0.0f, (float)(System.currentTimeMillis() % 100000) / 50f, ((x - mx) * 0.06f), ((y - my) * -0.1f), 0.0625F);
+ bp.render(null, 0.0f, 0.0f, (float)(EaglerAdapter.steadyTimeMillis() % 100000) / 50f, ((x - mx) * 0.06f), ((y - my) * -0.1f), 0.0625F);
EaglerAdapter.glPopMatrix();
EaglerAdapter.glDisable(EaglerAdapter.GL_RESCALE_NORMAL);
diff --git a/src/main/java/net/lax1dude/eaglercraft/EaglerProfile.java b/src/main/java/net/lax1dude/eaglercraft/EaglerProfile.java
index 4985a05..4379a3c 100644
--- a/src/main/java/net/lax1dude/eaglercraft/EaglerProfile.java
+++ b/src/main/java/net/lax1dude/eaglercraft/EaglerProfile.java
@@ -44,8 +44,8 @@ public class EaglerProfile {
public static final int[] SKIN_DATA_SIZE = new int[] { 64*32*4, 64*64*4, -9, -9, 1, 64*64*4, -9 };
public static final int[] CAPE_DATA_SIZE = new int[] { 32*32*4, -9, 1 };
- public static ArrayList skins = new ArrayList();
- public static ArrayList capes = new ArrayList();
+ public static ArrayList skins = new ArrayList<>();
+ public static ArrayList capes = new ArrayList<>();
public static final EaglercraftRandom rand;
diff --git a/src/main/java/net/lax1dude/eaglercraft/EarlyLoadScreen.java b/src/main/java/net/lax1dude/eaglercraft/EarlyLoadScreen.java
index 90c60bf..96389a3 100644
--- a/src/main/java/net/lax1dude/eaglercraft/EarlyLoadScreen.java
+++ b/src/main/java/net/lax1dude/eaglercraft/EarlyLoadScreen.java
@@ -67,11 +67,7 @@ public class EarlyLoadScreen {
_wglDeleteShader(vert);
_wglDeleteShader(frag);
- try {
- Thread.sleep(50l);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
+ sleep(50);
_wglUseProgram(program);
_wglUniform1i(_wglGetUniformLocation(program, "tex"), 0);
@@ -128,11 +124,7 @@ public class EarlyLoadScreen {
upload.flip();
_wglTexImage2D(_wGL_TEXTURE_2D, 0, _wGL_RGBA, 128, 128, 0, _wGL_RGBA, _wGL_UNSIGNED_BYTE, upload);
- try {
- Thread.sleep(50l);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
+ sleep(50);
_wglUseProgram(program);
diff --git a/src/main/java/net/lax1dude/eaglercraft/ExpiringSet.java b/src/main/java/net/lax1dude/eaglercraft/ExpiringSet.java
index 9047df7..5d7e485 100644
--- a/src/main/java/net/lax1dude/eaglercraft/ExpiringSet.java
+++ b/src/main/java/net/lax1dude/eaglercraft/ExpiringSet.java
@@ -29,7 +29,7 @@ public class ExpiringSet extends HashSet {
public void checkForExpirations() {
Iterator iterator = this.timestamps.keySet().iterator();
- long now = System.currentTimeMillis();
+ long now = EaglerAdapter.steadyTimeMillis();
while (iterator.hasNext()) {
T element = iterator.next();
if (super.contains(element)) {
@@ -48,7 +48,7 @@ public class ExpiringSet extends HashSet {
public boolean add(T o) {
checkForExpirations();
boolean success = super.add(o);
- if (success) timestamps.put(o, System.currentTimeMillis());
+ if (success) timestamps.put(o, EaglerAdapter.steadyTimeMillis());
return success;
}
diff --git a/src/main/java/net/lax1dude/eaglercraft/GuiScreenAddRelay.java b/src/main/java/net/lax1dude/eaglercraft/GuiScreenAddRelay.java
index 6550ac6..1bdc206 100644
--- a/src/main/java/net/lax1dude/eaglercraft/GuiScreenAddRelay.java
+++ b/src/main/java/net/lax1dude/eaglercraft/GuiScreenAddRelay.java
@@ -3,7 +3,6 @@ package net.lax1dude.eaglercraft;
import net.minecraft.src.GuiButton;
import net.minecraft.src.GuiScreen;
import net.minecraft.src.GuiTextField;
-import net.minecraft.src.ServerData;
import net.minecraft.src.StringTranslate;
public class GuiScreenAddRelay extends GuiScreen {
diff --git a/src/main/java/net/lax1dude/eaglercraft/GuiScreenNameWorldImport.java b/src/main/java/net/lax1dude/eaglercraft/GuiScreenNameWorldImport.java
index 9292c3d..7aded44 100644
--- a/src/main/java/net/lax1dude/eaglercraft/GuiScreenNameWorldImport.java
+++ b/src/main/java/net/lax1dude/eaglercraft/GuiScreenNameWorldImport.java
@@ -114,7 +114,7 @@ public class GuiScreenNameWorldImport extends GuiScreen {
this.theGuiTextField.drawTextBox();
}else {
definetlyTimeToImport = true;
- long dots = (System.currentTimeMillis() / 500l) % 4l;
+ long dots = (EaglerAdapter.steadyTimeMillis() / 500l) % 4l;
String str = "Reading: '" + oldName + "'";
this.drawString(fontRenderer, str + (dots > 0 ? "." : "") + (dots > 1 ? "." : "") + (dots > 2 ? "." : ""), (this.width - this.fontRenderer.getStringWidth(str)) / 2, this.height / 3 + 10, 0xFFFFFF);
}
diff --git a/src/main/java/net/lax1dude/eaglercraft/GuiScreenRelay.java b/src/main/java/net/lax1dude/eaglercraft/GuiScreenRelay.java
index 6e2991a..a78f492 100644
--- a/src/main/java/net/lax1dude/eaglercraft/GuiScreenRelay.java
+++ b/src/main/java/net/lax1dude/eaglercraft/GuiScreenRelay.java
@@ -78,7 +78,7 @@ public class GuiScreenRelay extends GuiScreen {
selected = 0;
}
} else if(btn.id == 4) {
- long millis = System.currentTimeMillis();
+ long millis = EaglerAdapter.steadyTimeMillis();
if(millis - lastRefresh > 700l) {
lastRefresh = millis;
slots.relayManager.ping();
@@ -86,7 +86,7 @@ public class GuiScreenRelay extends GuiScreen {
lastRefresh += 60l;
} else if(btn.id == 5) {
slots.relayManager.loadDefaults();
- long millis = System.currentTimeMillis();
+ long millis = EaglerAdapter.steadyTimeMillis();
if(millis - lastRefresh > 700l) {
lastRefresh = millis;
slots.relayManager.ping();
diff --git a/src/main/java/net/lax1dude/eaglercraft/GuiScreenSingleplayerConnecting.java b/src/main/java/net/lax1dude/eaglercraft/GuiScreenSingleplayerConnecting.java
index 9ab32c7..92284b9 100644
--- a/src/main/java/net/lax1dude/eaglercraft/GuiScreenSingleplayerConnecting.java
+++ b/src/main/java/net/lax1dude/eaglercraft/GuiScreenSingleplayerConnecting.java
@@ -26,7 +26,7 @@ public class GuiScreenSingleplayerConnecting extends GuiScreen {
}
public void initGui() {
- if(startStartTime == 0) this.startStartTime = System.currentTimeMillis();
+ if(startStartTime == 0) this.startStartTime = EaglerAdapter.steadyTimeMillis();
this.buttonList.add(killTask = new GuiButton(0, this.width / 2 - 100, this.height / 3 + 50, "Kill Task"));
killTask.enabled = false;
}
@@ -36,7 +36,7 @@ public class GuiScreenSingleplayerConnecting extends GuiScreen {
float f = 2.0f;
int top = this.height / 3;
- long millis = System.currentTimeMillis();
+ long millis = EaglerAdapter.steadyTimeMillis();
long dots = (millis / 500l) % 4l;
this.drawString(fontRenderer, message + (dots > 0 ? "." : "") + (dots > 1 ? "." : "") + (dots > 2 ? "." : ""), (this.width - this.fontRenderer.getStringWidth(message)) / 2, top + 10, 0xFFFFFF);
@@ -68,7 +68,7 @@ public class GuiScreenSingleplayerConnecting extends GuiScreen {
}
}
- long millis = System.currentTimeMillis();
+ long millis = EaglerAdapter.steadyTimeMillis();
if(millis - startStartTime > 6000l) {
killTask.enabled = true;
}
diff --git a/src/main/java/net/lax1dude/eaglercraft/GuiScreenSingleplayerLoading.java b/src/main/java/net/lax1dude/eaglercraft/GuiScreenSingleplayerLoading.java
index 41d1e6e..e3fdaa9 100644
--- a/src/main/java/net/lax1dude/eaglercraft/GuiScreenSingleplayerLoading.java
+++ b/src/main/java/net/lax1dude/eaglercraft/GuiScreenSingleplayerLoading.java
@@ -64,7 +64,7 @@ public class GuiScreenSingleplayerLoading extends GuiScreen {
}
public void initGui() {
- if(startStartTime == 0) this.startStartTime = System.currentTimeMillis();
+ if(startStartTime == 0) this.startStartTime = EaglerAdapter.steadyTimeMillis();
areYouSure = 0;
this.buttonList.add(killTask = new GuiButton(0, this.width / 2 - 100, this.height / 3 + 50, StringTranslate.getInstance().translateKey("gui.killTask")));
killTask.enabled = false;
@@ -79,7 +79,7 @@ public class GuiScreenSingleplayerLoading extends GuiScreen {
float f = 2.0f;
int top = this.height / 3;
- long millis = System.currentTimeMillis();
+ long millis = EaglerAdapter.steadyTimeMillis();
String str = StringTranslate.getInstance().translateKey(currentStatus);
@@ -105,7 +105,7 @@ public class GuiScreenSingleplayerLoading extends GuiScreen {
}
public void updateScreen() {
- long millis = System.currentTimeMillis();
+ long millis = EaglerAdapter.steadyTimeMillis();
if(millis - startStartTime > 6000l) {
killTask.enabled = true;
}
diff --git a/src/main/java/net/lax1dude/eaglercraft/GuiSlotRelay.java b/src/main/java/net/lax1dude/eaglercraft/GuiSlotRelay.java
index 8bc8f46..59b4741 100644
--- a/src/main/java/net/lax1dude/eaglercraft/GuiSlotRelay.java
+++ b/src/main/java/net/lax1dude/eaglercraft/GuiSlotRelay.java
@@ -3,7 +3,6 @@ package net.lax1dude.eaglercraft;
import net.lax1dude.eaglercraft.RelayQuery.VersionMismatch;
import net.lax1dude.eaglercraft.adapter.Tessellator;
import net.minecraft.client.Minecraft;
-import net.minecraft.src.Gui;
import net.minecraft.src.GuiSlot;
class GuiSlotRelay extends GuiSlot {
diff --git a/src/main/java/net/lax1dude/eaglercraft/GuiVoiceMenu.java b/src/main/java/net/lax1dude/eaglercraft/GuiVoiceMenu.java
index 30acbac..ba48fce 100644
--- a/src/main/java/net/lax1dude/eaglercraft/GuiVoiceMenu.java
+++ b/src/main/java/net/lax1dude/eaglercraft/GuiVoiceMenu.java
@@ -340,7 +340,7 @@ public class GuiVoiceMenu extends GuiScreen {
}
}else if(status == Voice.VoiceStatus.CONNECTING) {
- float fadeTimer = MathHelper.sin((float)((System.currentTimeMillis() % 700l) * 0.0014d) * 3.14159f) * 0.35f + 0.3f;
+ float fadeTimer = MathHelper.sin((float)((EaglerAdapter.steadyTimeMillis() % 700l) * 0.0014d) * 3.14159f) * 0.35f + 0.3f;
txt = ts.translateKey("voice.connecting");
EaglerAdapter.glEnable(EaglerAdapter.GL_BLEND);
EaglerAdapter.glBlendFunc(EaglerAdapter.GL_SRC_ALPHA, EaglerAdapter.GL_ONE_MINUS_SRC_ALPHA);
diff --git a/src/main/java/net/lax1dude/eaglercraft/GuiVoiceOverlay.java b/src/main/java/net/lax1dude/eaglercraft/GuiVoiceOverlay.java
index 1404bd8..8c72223 100644
--- a/src/main/java/net/lax1dude/eaglercraft/GuiVoiceOverlay.java
+++ b/src/main/java/net/lax1dude/eaglercraft/GuiVoiceOverlay.java
@@ -57,7 +57,7 @@ public class GuiVoiceOverlay extends Gui {
voiceGuiIcons.bindTexture();
if((mc.currentScreen == null || !mc.currentScreen.blockHotKeys()) && EaglerAdapter.isKeyDown(mc.gameSettings.voicePTTKey)) {
- long millis = System.currentTimeMillis();
+ long millis = EaglerAdapter.steadyTimeMillis();
if(pttTimer == 0l) {
pttTimer = millis;
}
@@ -93,7 +93,7 @@ public class GuiVoiceOverlay extends Gui {
Set speakers = EaglerAdapter.getVoiceSpeaking();
Set muted = EaglerAdapter.getVoiceMuted();
- List listenerList = new ArrayList();
+ List listenerList = new ArrayList<>();
listenerList.addAll(listeners);
listenerList.removeAll(muted);
@@ -169,7 +169,7 @@ public class GuiVoiceOverlay extends Gui {
Set speakers = EaglerAdapter.getVoiceSpeaking();
Set muted = EaglerAdapter.getVoiceMuted();
- List listenerList = new ArrayList();
+ List listenerList = new ArrayList<>();
listenerList.addAll(speakers);
listenerList.removeAll(muted);
diff --git a/src/main/java/net/lax1dude/eaglercraft/IntegratedServer.java b/src/main/java/net/lax1dude/eaglercraft/IntegratedServer.java
index 86f5e25..332b968 100644
--- a/src/main/java/net/lax1dude/eaglercraft/IntegratedServer.java
+++ b/src/main/java/net/lax1dude/eaglercraft/IntegratedServer.java
@@ -27,7 +27,7 @@ public class IntegratedServer {
private static String[] loadLocale = null;
private static String[] loadStats = null;
private static boolean isPaused = false;
- private static List integratedServerTPS = new LinkedList();
+ private static List integratedServerTPS = new LinkedList<>();
public static final int preferredRelayVersion = 1;
@@ -187,9 +187,9 @@ public class IntegratedServer {
private static String worldStatusString = "";
private static float worldStatusProgress = 0.0f;
- private static final LinkedList exceptions = new LinkedList();
+ private static final LinkedList exceptions = new LinkedList<>();
- public static final LinkedList worlds = new LinkedList();
+ public static final LinkedList worlds = new LinkedList<>();
public static int statusState() {
return statusState;
@@ -408,7 +408,7 @@ public class IntegratedServer {
}
}
- private static final HashMap openConnections = new HashMap();
+ private static final HashMap openConnections = new HashMap<>();
public static final boolean doesChannelExist(String channel) {
return openConnections.containsKey(channel);
diff --git a/src/main/java/net/lax1dude/eaglercraft/IntegratedServerLAN.java b/src/main/java/net/lax1dude/eaglercraft/IntegratedServerLAN.java
index 3cc0464..625d92d 100644
--- a/src/main/java/net/lax1dude/eaglercraft/IntegratedServerLAN.java
+++ b/src/main/java/net/lax1dude/eaglercraft/IntegratedServerLAN.java
@@ -12,7 +12,7 @@ import net.lax1dude.eaglercraft.sp.relay.pkt.*;
public class IntegratedServerLAN {
- public static final List currentICEServers = new ArrayList();
+ public static final List currentICEServers = new ArrayList<>();
private static RelayServerSocket lanRelaySocket = null;
@@ -32,7 +32,7 @@ public class IntegratedServerLAN {
String code = hs.connectionCode;
System.out.println("Relay [" + sock.getURI() + "] connected as 'server', code: " + code);
progressCallback.accept("Opened '" + code + "' on " + sock.getURI());
- long millis = System.currentTimeMillis();
+ long millis = EaglerAdapter.steadyTimeMillis();
do {
if(sock.isClosed()) {
System.out.println("Relay [" + sock.getURI() + "] connection lost");
@@ -58,11 +58,8 @@ public class IntegratedServerLAN {
return null;
}
}
- try {
- Thread.sleep(50l);
- } catch (InterruptedException e) {
- }
- }while(System.currentTimeMillis() - millis < 1000l);
+ EaglerAdapter.sleep(50);
+ }while(EaglerAdapter.steadyTimeMillis() - millis < 1000l);
System.out.println("Relay [" + sock.getURI() + "] relay provide ICE servers timeout");
closeLAN();
return null;
@@ -107,7 +104,7 @@ public class IntegratedServerLAN {
return lanRelaySocket != null;
}
- private static final Map clients = new HashMap();
+ private static final Map clients = new HashMap<>();
public static void updateLANServer() {
if(lanRelaySocket != null) {
@@ -195,7 +192,7 @@ public class IntegratedServerLAN {
protected void handleICECandidates(String candidates) {
if(state == SENT_DESCRIPTION) {
EaglerAdapter.serverLANPeerICECandidates(clientId, candidates);
- long millis = System.currentTimeMillis();
+ long millis = EaglerAdapter.steadyTimeMillis();
do {
LANPeerEvent evt;
if((evt = EaglerAdapter.serverLANGetEvent(clientId)) != null) {
@@ -211,11 +208,8 @@ public class IntegratedServerLAN {
disconnect();
return;
}
- try {
- Thread.sleep(20l);
- } catch (InterruptedException e) {
- }
- }while(System.currentTimeMillis() - millis < 5000l);
+ EaglerAdapter.sleep(20);
+ }while(EaglerAdapter.steadyTimeMillis() - millis < 5000l);
System.err.println("Getting server ICE candidates for '" + clientId + "' timed out!");
disconnect();
}else {
@@ -226,7 +220,7 @@ public class IntegratedServerLAN {
protected void handleDescription(String description) {
if(state == PRE) {
EaglerAdapter.serverLANPeerDescription(clientId, description);
- long millis = System.currentTimeMillis();
+ long millis = EaglerAdapter.steadyTimeMillis();
do {
LANPeerEvent evt;
if((evt = EaglerAdapter.serverLANGetEvent(clientId)) != null) {
@@ -242,11 +236,8 @@ public class IntegratedServerLAN {
disconnect();
return;
}
- try {
- Thread.sleep(20l);
- } catch (InterruptedException e) {
- }
- }while(System.currentTimeMillis() - millis < 5000l);
+ EaglerAdapter.sleep(20);
+ }while(EaglerAdapter.steadyTimeMillis() - millis < 5000l);
System.err.println("Getting server description for '" + clientId + "' timed out!");
disconnect();
}else {
@@ -256,7 +247,7 @@ public class IntegratedServerLAN {
protected void handleSuccess() {
if(state == SENT_ICE_CANDIDATE) {
- long millis = System.currentTimeMillis();
+ long millis = EaglerAdapter.steadyTimeMillis();
do {
LANPeerEvent evt;
while((evt = EaglerAdapter.serverLANGetEvent(clientId)) != null && evt instanceof LANPeerEvent.LANPeerICECandidateEvent) {
@@ -276,11 +267,8 @@ public class IntegratedServerLAN {
disconnect();
return;
}
- try {
- Thread.sleep(20l);
- } catch (InterruptedException e) {
- }
- }while(System.currentTimeMillis() - millis < 5000l);
+ EaglerAdapter.sleep(20);
+ }while(EaglerAdapter.steadyTimeMillis() - millis < 5000l);
System.err.println("Getting server description for '" + clientId + "' timed out!");
disconnect();
}else {
diff --git a/src/main/java/net/lax1dude/eaglercraft/LANClientNetworkManager.java b/src/main/java/net/lax1dude/eaglercraft/LANClientNetworkManager.java
index 69809c9..5843ac5 100644
--- a/src/main/java/net/lax1dude/eaglercraft/LANClientNetworkManager.java
+++ b/src/main/java/net/lax1dude/eaglercraft/LANClientNetworkManager.java
@@ -67,7 +67,7 @@ public class LANClientNetworkManager implements INetworkManager {
// print servers
System.out.println("Relay [" + displayRelay + "|" + displayCode + "] provided ICE servers:");
- List servers = new ArrayList();
+ List servers = new ArrayList<>();
for(net.lax1dude.eaglercraft.sp.relay.pkt.ICEServerSet.RelayServer srv : ipkt.servers) {
System.out.println("Relay [" + displayRelay + "|" + displayCode + "] " + srv.type.name()
+ ": " + srv.address);
@@ -78,7 +78,7 @@ public class LANClientNetworkManager implements INetworkManager {
EaglerAdapter.clientLANSetICEServersAndConnect(servers.toArray(new String[servers.size()]));
// await result
- long lm = System.currentTimeMillis();
+ long lm = EaglerAdapter.steadyTimeMillis();
do {
String c = EaglerAdapter.clientLANAwaitDescription();
if(c != null) {
@@ -90,11 +90,8 @@ public class LANClientNetworkManager implements INetworkManager {
connectState = SENT_DESCRIPTION;
continue mainLoop;
}
- try {
- Thread.sleep(20l);
- } catch (InterruptedException e) {
- }
- }while(System.currentTimeMillis() - lm < 5000l);
+ EaglerAdapter.sleep(20);
+ }while(EaglerAdapter.steadyTimeMillis() - lm < 5000l);
// no description was sent
sock.close();
@@ -119,7 +116,7 @@ public class LANClientNetworkManager implements INetworkManager {
EaglerAdapter.clientLANSetICECandidate(ipkt.candidate);
// await result
- long lm = System.currentTimeMillis();
+ long lm = EaglerAdapter.steadyTimeMillis();
do {
if(EaglerAdapter.clientLANAwaitChannel()) {
System.out.println("Relay [" + displayRelay + "|" + displayCode + "] client opened data channel");
@@ -130,11 +127,8 @@ public class LANClientNetworkManager implements INetworkManager {
return new LANClientNetworkManager(displayCode, displayRelay);
}
- try {
- Thread.sleep(20l);
- } catch (InterruptedException e) {
- }
- }while(System.currentTimeMillis() - lm < 5000l);
+ EaglerAdapter.sleep(20);
+ }while(EaglerAdapter.steadyTimeMillis() - lm < 5000l);
// no channel was opened
sock.writePacket(new IPacket06ClientFailure(ipkt.peerId));
@@ -160,7 +154,7 @@ public class LANClientNetworkManager implements INetworkManager {
EaglerAdapter.clientLANSetDescription(ipkt.description);
// await result
- long lm = System.currentTimeMillis();
+ long lm = EaglerAdapter.steadyTimeMillis();
do {
String c = EaglerAdapter.clientLANAwaitICECandidate();
if(c != null) {
@@ -172,11 +166,8 @@ public class LANClientNetworkManager implements INetworkManager {
connectState = SENT_ICE_CANDIDATE;
continue mainLoop;
}
- try {
- Thread.sleep(20l);
- } catch (InterruptedException e) {
- }
- }while(System.currentTimeMillis() - lm < 5000l);
+ EaglerAdapter.sleep(20);
+ }while(EaglerAdapter.steadyTimeMillis() - lm < 5000l);
// no ice candidates were sent
sock.close();
@@ -212,10 +203,7 @@ public class LANClientNetworkManager implements INetworkManager {
return null;
}
}
- try {
- Thread.sleep(20l);
- } catch (InterruptedException e) {
- }
+ EaglerAdapter.sleep(20);
}
return null;
}
diff --git a/src/main/java/net/lax1dude/eaglercraft/LANServerList.java b/src/main/java/net/lax1dude/eaglercraft/LANServerList.java
index f61d80a..458d5e9 100644
--- a/src/main/java/net/lax1dude/eaglercraft/LANServerList.java
+++ b/src/main/java/net/lax1dude/eaglercraft/LANServerList.java
@@ -13,15 +13,15 @@ import net.lax1dude.eaglercraft.sp.relay.pkt.IPacket07LocalWorlds.LocalWorld;
public class LANServerList {
- private final List lanServersList = new LinkedList();
- private final Map lanServersQueryList = new LinkedHashMap();
- private final Set deadURIs = new HashSet();
+ private final List lanServersList = new LinkedList<>();
+ private final Map lanServersQueryList = new LinkedHashMap<>();
+ private final Set deadURIs = new HashSet<>();
private long lastRefresh = 0l;
private int refreshCounter = 0;
public void update() {
- long millis = System.currentTimeMillis();
+ long millis = EaglerAdapter.steadyTimeMillis();
if(millis - lastRefresh > 10000l) {
if(++refreshCounter < 10) {
refresh();
@@ -91,7 +91,7 @@ public class LANServerList {
}
private void refresh() {
- lastRefresh = System.currentTimeMillis();
+ lastRefresh = EaglerAdapter.steadyTimeMillis();
for(int i = 0, l = IntegratedServer.relayManager.count(); i < l; ++i) {
RelayServer srv = IntegratedServer.relayManager.get(i);
if(!lanServersQueryList.containsKey(srv.address) && !deadURIs.contains(srv.address)) {
diff --git a/src/main/java/net/lax1dude/eaglercraft/RelayManager.java b/src/main/java/net/lax1dude/eaglercraft/RelayManager.java
index 7289e39..4365770 100644
--- a/src/main/java/net/lax1dude/eaglercraft/RelayManager.java
+++ b/src/main/java/net/lax1dude/eaglercraft/RelayManager.java
@@ -15,7 +15,7 @@ import net.minecraft.src.NBTTagList;
public class RelayManager {
- private final List relays = new ArrayList();
+ private final List relays = new ArrayList<>();
private long lastPingThrough = 0l;
public void load(NBTTagList relayConfig) {
@@ -94,7 +94,7 @@ public class RelayManager {
}
public void ping() {
- lastPingThrough = System.currentTimeMillis();
+ lastPingThrough = EaglerAdapter.steadyTimeMillis();
for(int i = 0, l = relays.size(); i < l; ++i) {
relays.get(i).ping();
}
@@ -211,16 +211,10 @@ public class RelayManager {
return null;
}
}
- try {
- Thread.sleep(20l);
- } catch (InterruptedException e) {
- }
+ EaglerAdapter.sleep(20);
}
}
- try {
- Thread.sleep(20l);
- } catch (InterruptedException e) {
- }
+ EaglerAdapter.sleep(20);
}
System.err.println("Relay [" + relay.address + "] connection failed!");
Throwable t;
@@ -230,12 +224,12 @@ public class RelayManager {
return null;
}
- private final List brokenServers = new LinkedList();
+ private final List brokenServers = new LinkedList<>();
public RelayServerSocket getWorkingRelay(Consumer progressCallback, int type, String code) {
brokenServers.clear();
if(relays.size() > 0) {
- long millis = System.currentTimeMillis();
+ long millis = EaglerAdapter.steadyTimeMillis();
if(millis - lastPingThrough < 10000l) {
RelayServer relay = getPrimary();
if(relay.getPing() > 0l && relay.getPingCompatible().isCompatible()) {
diff --git a/src/main/java/net/lax1dude/eaglercraft/RelayServer.java b/src/main/java/net/lax1dude/eaglercraft/RelayServer.java
index f8181e4..27c9b50 100644
--- a/src/main/java/net/lax1dude/eaglercraft/RelayServer.java
+++ b/src/main/java/net/lax1dude/eaglercraft/RelayServer.java
@@ -63,10 +63,7 @@ public class RelayServer {
public void pingBlocking() {
ping();
while(getPing() < 0l) {
- try {
- Thread.sleep(250l);
- }catch(InterruptedException ex) {
- }
+ EaglerAdapter.sleep(250);
update();
}
}
@@ -97,7 +94,7 @@ public class RelayServer {
queriedCompatible = query.getCompatible();
workingPing = ping;
}
- lastPing = System.currentTimeMillis();
+ lastPing = EaglerAdapter.steadyTimeMillis();
query = null;
}
}
diff --git a/src/main/java/net/lax1dude/eaglercraft/ServerQuery.java b/src/main/java/net/lax1dude/eaglercraft/ServerQuery.java
index ee6c931..9ebf702 100644
--- a/src/main/java/net/lax1dude/eaglercraft/ServerQuery.java
+++ b/src/main/java/net/lax1dude/eaglercraft/ServerQuery.java
@@ -29,7 +29,7 @@ public interface ServerQuery {
this.serverBrand = "Unknown";
this.serverName = "Unknown";
this.serverTime = 0l;
- this.clientTime = System.currentTimeMillis();
+ this.clientTime = EaglerAdapter.steadyTimeMillis();
this.serverCracked = false;
this.rateLimitStatus = this.responseType.equals("locked") ? RateLimit.LOCKED : RateLimit.BLOCKED;
this.rateLimitIsTCP = false;
@@ -39,7 +39,7 @@ public interface ServerQuery {
this.serverBrand = obj.getString("brand");
this.serverName = obj.getString("name");
this.serverTime = obj.getLong("time");
- this.clientTime = System.currentTimeMillis();
+ this.clientTime = EaglerAdapter.steadyTimeMillis();
this.serverCracked = obj.optBoolean("cracked", false);
this.rateLimitStatus = null;
this.rateLimitIsTCP = false;
@@ -53,7 +53,7 @@ public interface ServerQuery {
this.serverBrand = "Unknown";
this.serverName = "Unknown";
this.serverTime = 0l;
- this.clientTime = System.currentTimeMillis();
+ this.clientTime = EaglerAdapter.steadyTimeMillis();
this.serverCracked = false;
this.rateLimitStatus = lockedNotBlocked ? RateLimit.LOCKED : RateLimit.BLOCKED;
this.rateLimitIsTCP = true;
@@ -90,12 +90,9 @@ public interface ServerQuery {
// java.util.concurrent classes for semaphore-like behavior
public default boolean awaitResponseAvailable(long timeout) {
- long start = System.currentTimeMillis();
- while(isQueryOpen() && responseAvailable() <= 0 && (timeout <= 0l || System.currentTimeMillis() - start < timeout)) {
- try {
- Thread.sleep(0l, 250000);
- } catch (InterruptedException e) {
- }
+ long start = EaglerAdapter.steadyTimeMillis();
+ while(isQueryOpen() && responseAvailable() <= 0 && (timeout <= 0l || EaglerAdapter.steadyTimeMillis() - start < timeout)) {
+ EaglerAdapter.sleep(10);
}
return responseAvailable() > 0;
}
@@ -105,12 +102,9 @@ public interface ServerQuery {
}
public default boolean awaitResponseBinaryAvailable(long timeout) {
- long start = System.currentTimeMillis();
- while(isQueryOpen() && responseBinaryAvailable() <= 0 && (timeout <= 0l || System.currentTimeMillis() - start < timeout)) {
- try {
- Thread.sleep(0l, 250000);
- } catch (InterruptedException e) {
- }
+ long start = EaglerAdapter.steadyTimeMillis();
+ while(isQueryOpen() && responseBinaryAvailable() <= 0 && (timeout <= 0l || EaglerAdapter.steadyTimeMillis() - start < timeout)) {
+ EaglerAdapter.sleep(10);
}
return responseBinaryAvailable() > 0;
}
diff --git a/src/main/java/net/lax1dude/eaglercraft/TextureLocation.java b/src/main/java/net/lax1dude/eaglercraft/TextureLocation.java
index 7c87d82..7a4adbc 100644
--- a/src/main/java/net/lax1dude/eaglercraft/TextureLocation.java
+++ b/src/main/java/net/lax1dude/eaglercraft/TextureLocation.java
@@ -33,6 +33,6 @@ public class TextureLocation {
r.bindTexture(glObject);
}
- private static final ArrayList locations = new ArrayList();
+ private static final ArrayList locations = new ArrayList<>();
}
diff --git a/src/main/java/net/lax1dude/eaglercraft/TextureTerrainMap.java b/src/main/java/net/lax1dude/eaglercraft/TextureTerrainMap.java
index 0111aad..829ee78 100644
--- a/src/main/java/net/lax1dude/eaglercraft/TextureTerrainMap.java
+++ b/src/main/java/net/lax1dude/eaglercraft/TextureTerrainMap.java
@@ -263,7 +263,7 @@ public class TextureTerrainMap implements IconRegister {
this.height = size;
this.basePath = par3Str;
this.missingImage = new TerrainIconV2(nextSlot[1]++, 1, this, null);
- this.iconList = new ArrayList();
+ this.iconList = new ArrayList<>();
this.texture = EaglerAdapter.glGenTextures();
this.copyFramebuffer = EaglerAdapter._wglCreateFramebuffer();
EaglerAdapter.glBindTexture(EaglerAdapter.GL_TEXTURE_2D, texture);
diff --git a/src/main/java/net/lax1dude/eaglercraft/WebsocketNetworkManager.java b/src/main/java/net/lax1dude/eaglercraft/WebsocketNetworkManager.java
index 06ee3cc..674285f 100644
--- a/src/main/java/net/lax1dude/eaglercraft/WebsocketNetworkManager.java
+++ b/src/main/java/net/lax1dude/eaglercraft/WebsocketNetworkManager.java
@@ -65,7 +65,7 @@ public class WebsocketNetworkManager implements INetworkManager {
}
private ByteBuffer oldChunkBuffer = null;
- private LinkedList readChunks = new LinkedList();
+ private LinkedList readChunks = new LinkedList<>();
public void processReadPackets() {
readChunks.clear();
diff --git a/src/main/java/net/lax1dude/eaglercraft/glemu/EaglerAdapterGL30.java b/src/main/java/net/lax1dude/eaglercraft/glemu/EaglerAdapterGL30.java
index 26c0bdc..0e830a4 100644
--- a/src/main/java/net/lax1dude/eaglercraft/glemu/EaglerAdapterGL30.java
+++ b/src/main/java/net/lax1dude/eaglercraft/glemu/EaglerAdapterGL30.java
@@ -133,7 +133,7 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
public static final boolean isWebGL = _wisWebGL();
- static final GLObjectMap texObjects = new GLObjectMap(256);
+ static final GLObjectMap texObjects = new GLObjectMap<>(256);
static boolean enableTexture2D = false;
static boolean enableTexture2D_1 = false;
@@ -302,8 +302,8 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
}
}
- private static final HashMap displayLists = new HashMap();
- private static final HashMap displayListsInitialized = new HashMap();
+ private static final HashMap displayLists = new HashMap<>();
+ private static final HashMap displayListsInitialized = new HashMap<>();
public static final int getDisplayListCount() {
return displayListsInitialized.size();
@@ -1318,7 +1318,7 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
}
- private static final GLObjectMap queryObjs = new GLObjectMap(256);
+ private static final GLObjectMap queryObjs = new GLObjectMap<>(256);
public static final int glCreateQuery() {
return queryObjs.register(_wglCreateQuery());
@@ -1593,8 +1593,8 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
private static int lastBandwidth = 0;
public static final int getBitsPerSecond() {
- if (System.currentTimeMillis() - lastBandwidthReset > 1000) {
- lastBandwidthReset = System.currentTimeMillis();
+ if (steadyTimeMillis() - lastBandwidthReset > 1000) {
+ lastBandwidthReset = steadyTimeMillis();
lastBandwidth = bytesUploaded * 8;
bytesUploaded = 0;
}
diff --git a/src/main/java/net/lax1dude/eaglercraft/glemu/EffectPipeline.java b/src/main/java/net/lax1dude/eaglercraft/glemu/EffectPipeline.java
index 20afd81..3f90ff9 100644
--- a/src/main/java/net/lax1dude/eaglercraft/glemu/EffectPipeline.java
+++ b/src/main/java/net/lax1dude/eaglercraft/glemu/EffectPipeline.java
@@ -6,13 +6,11 @@ import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.IntBuffer;
-import net.lax1dude.eaglercraft.EaglerAdapter;
import net.lax1dude.eaglercraft.EaglercraftRandom;
import net.lax1dude.eaglercraft.adapter.Tessellator;
import net.minecraft.client.Minecraft;
import net.minecraft.src.EntityLiving;
import net.minecraft.src.GLAllocation;
-import net.minecraft.src.Gui;
import net.minecraft.src.MathHelper;
public class EffectPipeline {
@@ -124,7 +122,7 @@ public class EffectPipeline {
_wglViewport(0, 0, NOISE_WIDTH, NOISE_HEIGHT);
_wglUseProgram(noiseProgram);
- long l = System.currentTimeMillis();
+ long l = steadyTimeMillis();
if(timer > 0l && l - timer < 20000l) {
counter += (float)((l - timer) * 0.0007) * intensity;
if(counter > 10000.0f) {
diff --git a/src/main/java/net/lax1dude/eaglercraft/glemu/FixedFunctionShader.java b/src/main/java/net/lax1dude/eaglercraft/glemu/FixedFunctionShader.java
index 7e348e1..4e0f5be 100644
--- a/src/main/java/net/lax1dude/eaglercraft/glemu/FixedFunctionShader.java
+++ b/src/main/java/net/lax1dude/eaglercraft/glemu/FixedFunctionShader.java
@@ -14,7 +14,7 @@ import net.lax1dude.eaglercraft.glemu.vector.Vector4f;
public class FixedFunctionShader {
private static final FixedFunctionShader[] instances = new FixedFunctionShader[4096]; //lol
- private static final List instanceList = new ArrayList();
+ private static final List instanceList = new ArrayList<>();
public static void refreshCoreGL() {
for(int i = 0; i < instances.length; ++i) {
diff --git a/src/main/java/net/lax1dude/eaglercraft/glemu/GameOverlayFramebuffer.java b/src/main/java/net/lax1dude/eaglercraft/glemu/GameOverlayFramebuffer.java
index 74ceaad..e8b8624 100644
--- a/src/main/java/net/lax1dude/eaglercraft/glemu/GameOverlayFramebuffer.java
+++ b/src/main/java/net/lax1dude/eaglercraft/glemu/GameOverlayFramebuffer.java
@@ -45,11 +45,11 @@ public class GameOverlayFramebuffer {
public void endRender() {
_wglBindFramebuffer(_wGL_FRAMEBUFFER, null);
- age = System.currentTimeMillis();
+ age = steadyTimeMillis();
}
public long getAge() {
- return age == -1l ? -1l : (System.currentTimeMillis() - age);
+ return age == -1l ? -1l : (steadyTimeMillis() - age);
}
public void bindTexture() {
diff --git a/src/main/java/net/lax1dude/eaglercraft/sp/relay/pkt/IPacket.java b/src/main/java/net/lax1dude/eaglercraft/sp/relay/pkt/IPacket.java
index de9e628..d58e45c 100644
--- a/src/main/java/net/lax1dude/eaglercraft/sp/relay/pkt/IPacket.java
+++ b/src/main/java/net/lax1dude/eaglercraft/sp/relay/pkt/IPacket.java
@@ -11,8 +11,8 @@ import java.util.Map;
public class IPacket {
- private static final Map> definedPacketClasses = new HashMap();
- private static final Map,Integer> definedPacketIds = new HashMap();
+ private static final Map> definedPacketClasses = new HashMap<>();
+ private static final Map,Integer> definedPacketIds = new HashMap<>();
private static void register(int id, Class extends IPacket> clazz) {
definedPacketClasses.put(id, clazz);
diff --git a/src/main/java/net/lax1dude/eaglercraft/sp/relay/pkt/IPacket01ICEServers.java b/src/main/java/net/lax1dude/eaglercraft/sp/relay/pkt/IPacket01ICEServers.java
index 50875d8..c96cf53 100644
--- a/src/main/java/net/lax1dude/eaglercraft/sp/relay/pkt/IPacket01ICEServers.java
+++ b/src/main/java/net/lax1dude/eaglercraft/sp/relay/pkt/IPacket01ICEServers.java
@@ -10,7 +10,7 @@ public class IPacket01ICEServers extends IPacket {
public final Collection servers;
public IPacket01ICEServers() {
- servers = new ArrayList();
+ servers = new ArrayList<>();
}
public void read(DataInputStream input) throws IOException {
diff --git a/src/main/java/net/lax1dude/eaglercraft/sp/relay/pkt/IPacket07LocalWorlds.java b/src/main/java/net/lax1dude/eaglercraft/sp/relay/pkt/IPacket07LocalWorlds.java
index 25f0e4a..769c188 100644
--- a/src/main/java/net/lax1dude/eaglercraft/sp/relay/pkt/IPacket07LocalWorlds.java
+++ b/src/main/java/net/lax1dude/eaglercraft/sp/relay/pkt/IPacket07LocalWorlds.java
@@ -22,7 +22,7 @@ public class IPacket07LocalWorlds extends IPacket {
public final List worldsList;
public IPacket07LocalWorlds() {
- this.worldsList = new ArrayList();
+ this.worldsList = new ArrayList<>();
}
public void read(DataInputStream input) throws IOException {
diff --git a/src/main/java/net/minecraft/client/Minecraft.java b/src/main/java/net/minecraft/client/Minecraft.java
index 9603def..74c1d6e 100644
--- a/src/main/java/net/minecraft/client/Minecraft.java
+++ b/src/main/java/net/minecraft/client/Minecraft.java
@@ -379,7 +379,7 @@ public class Minecraft implements Runnable {
EaglerAdapter.glDisable(EaglerAdapter.GL_FOG);
EaglerAdapter.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
- long t1 = System.currentTimeMillis();
+ long t1 = EaglerAdapter.steadyTimeMillis();
for(int i = 0; i < 20; i++) {
this.displayWidth = EaglerAdapter.getCanvasWidth();
this.displayHeight = EaglerAdapter.getCanvasHeight();
@@ -390,7 +390,7 @@ public class Minecraft implements Runnable {
EaglerAdapter.glOrtho(0.0F, var1.getScaledWidth(), var1.getScaledHeight(), 0.0F, 1000.0F, 3000.0F);
EaglerAdapter.glMatrixMode(EaglerAdapter.GL_MODELVIEW);
- float f = ((float)(System.currentTimeMillis() - t1) / 333f);
+ float f = ((float)(EaglerAdapter.steadyTimeMillis() - t1) / 333f);
EaglerAdapter.glClear(EaglerAdapter.GL_COLOR_BUFFER_BIT | EaglerAdapter.GL_DEPTH_BUFFER_BIT);
EaglerAdapter.glColor4f(1.0F, 1.0F, 1.0F, MathHelper.clamp_float(1.0f - f, 0.0F, 1.0F));
@@ -406,17 +406,13 @@ public class Minecraft implements Runnable {
EaglerAdapter.glFlush();
EaglerAdapter.updateDisplay();
- long t = t1 + 17 + 17*i - System.currentTimeMillis();
+ long t = t1 + 17 + 17*i - EaglerAdapter.steadyTimeMillis();
if(t > 0) {
- try {
- Thread.sleep(t);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
+ EaglerAdapter.sleep((int)t);
}
}
- t1 = System.currentTimeMillis();
+ t1 = EaglerAdapter.steadyTimeMillis();
for(int i = 0; i < 20; i++) {
this.displayWidth = EaglerAdapter.getCanvasWidth();
this.displayHeight = EaglerAdapter.getCanvasHeight();
@@ -427,7 +423,7 @@ public class Minecraft implements Runnable {
EaglerAdapter.glOrtho(0.0F, var1.getScaledWidth(), var1.getScaledHeight(), 0.0F, 1000.0F, 3000.0F);
EaglerAdapter.glMatrixMode(EaglerAdapter.GL_MODELVIEW);
- float f = ((float)(System.currentTimeMillis() - t1) / 333f);
+ float f = ((float)(EaglerAdapter.steadyTimeMillis() - t1) / 333f);
EaglerAdapter.glClear(EaglerAdapter.GL_COLOR_BUFFER_BIT | EaglerAdapter.GL_DEPTH_BUFFER_BIT);
EaglerAdapter.glColor4f(1.0F, 1.0F, 1.0F, MathHelper.clamp_float(f, 0.0F, 1.0F));
@@ -443,30 +439,22 @@ public class Minecraft implements Runnable {
EaglerAdapter.glFlush();
EaglerAdapter.updateDisplay();
- long t = t1 + 17 + 17*i - System.currentTimeMillis();
+ long t = t1 + 17 + 17*i - EaglerAdapter.steadyTimeMillis();
if(t > 0) {
- try {
- Thread.sleep(t);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
+ EaglerAdapter.sleep((int)t);
}
}
- try {
- Thread.sleep(1600l);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
+ EaglerAdapter.sleep(1600);
- t1 = System.currentTimeMillis();
+ t1 = EaglerAdapter.steadyTimeMillis();
for(int i = 0; i < 21; i++) {
this.displayWidth = EaglerAdapter.getCanvasWidth();
this.displayHeight = EaglerAdapter.getCanvasHeight();
EaglerAdapter.glViewport(0, 0, this.displayWidth, this.displayHeight);
var1 = new ScaledResolution(this.gameSettings, this.displayWidth, this.displayHeight);
- float f = ((float)(System.currentTimeMillis() - t1) / 340f);
+ float f = ((float)(EaglerAdapter.steadyTimeMillis() - t1) / 340f);
EaglerAdapter.glClear(EaglerAdapter.GL_COLOR_BUFFER_BIT | EaglerAdapter.GL_DEPTH_BUFFER_BIT);
EaglerAdapter.glColor4f(1.0F, 1.0F, 1.0F, MathHelper.clamp_float((1.0f - f), 0.0F, 1.0F));
@@ -482,13 +470,9 @@ public class Minecraft implements Runnable {
EaglerAdapter.glFlush();
EaglerAdapter.updateDisplay();
- long t = t1 + 17 + 17*i - System.currentTimeMillis();
+ long t = t1 + 17 + 17*i - EaglerAdapter.steadyTimeMillis();
if(t > 0) {
- try {
- Thread.sleep(t);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
+ EaglerAdapter.sleep((int)t);
}
}
@@ -496,11 +480,7 @@ public class Minecraft implements Runnable {
EaglerAdapter.glFlush();
EaglerAdapter.updateDisplay();
- try {
- Thread.sleep(100l);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
+ EaglerAdapter.sleep(100);
EaglerAdapter.glDisable(EaglerAdapter.GL_BLEND);
EaglerAdapter.glEnable(EaglerAdapter.GL_ALPHA_TEST);
@@ -792,14 +772,14 @@ public class Minecraft implements Runnable {
//boolean var5 = this.isGamePaused;
//this.isGamePaused = false;
- if(System.currentTimeMillis() - secondTimer > 1000l) {
+ if(EaglerAdapter.steadyTimeMillis() - secondTimer > 1000l) {
debugFPS = fpsCounter;
fpsCounter = 0;
debugChunkUpdates = chunkUpdates;
chunkUpdates = 0;
debugChunkGeometryUpdates = chunkGeometryUpdates;
chunkGeometryUpdates = 0;
- secondTimer = System.currentTimeMillis();
+ secondTimer = EaglerAdapter.steadyTimeMillis();
}
this.mcProfiler.startSection("syncDisplay");
@@ -1892,7 +1872,7 @@ public class Minecraft implements Runnable {
* Gets the system time in milliseconds.
*/
public static long getSystemTime() {
- return System.currentTimeMillis();
+ return EaglerAdapter.steadyTimeMillis();
}
/**
diff --git a/src/main/java/net/minecraft/src/EntityAgeable.java b/src/main/java/net/minecraft/src/EntityAgeable.java
index 6873dd1..fdb6040 100644
--- a/src/main/java/net/minecraft/src/EntityAgeable.java
+++ b/src/main/java/net/minecraft/src/EntityAgeable.java
@@ -8,7 +8,7 @@ public abstract class EntityAgeable extends EntityCreature {
protected void entityInit() {
super.entityInit();
- this.dataWatcher.addObject(12, new Integer(0));
+ this.dataWatcher.addObject(12, Integer.valueOf(0));
}
/**
diff --git a/src/main/java/net/minecraft/src/EntityBat.java b/src/main/java/net/minecraft/src/EntityBat.java
index 0d20147..5fedd0b 100644
--- a/src/main/java/net/minecraft/src/EntityBat.java
+++ b/src/main/java/net/minecraft/src/EntityBat.java
@@ -20,7 +20,7 @@ public class EntityBat extends EntityAmbientCreature {
protected void entityInit() {
super.entityInit();
- this.dataWatcher.addObject(16, new Byte((byte) 0));
+ this.dataWatcher.addObject(16, Byte.valueOf((byte) 0));
}
/**
diff --git a/src/main/java/net/minecraft/src/EntityBlaze.java b/src/main/java/net/minecraft/src/EntityBlaze.java
index 1093e46..0739ab0 100644
--- a/src/main/java/net/minecraft/src/EntityBlaze.java
+++ b/src/main/java/net/minecraft/src/EntityBlaze.java
@@ -22,7 +22,7 @@ public class EntityBlaze extends EntityMob {
protected void entityInit() {
super.entityInit();
- this.dataWatcher.addObject(16, new Byte((byte) 0));
+ this.dataWatcher.addObject(16, Byte.valueOf((byte) 0));
}
/**
diff --git a/src/main/java/net/minecraft/src/EntityBoat.java b/src/main/java/net/minecraft/src/EntityBoat.java
index 23dd7ae..b16b85a 100644
--- a/src/main/java/net/minecraft/src/EntityBoat.java
+++ b/src/main/java/net/minecraft/src/EntityBoat.java
@@ -31,9 +31,9 @@ public class EntityBoat extends Entity {
}
protected void entityInit() {
- this.dataWatcher.addObject(17, new Integer(0));
- this.dataWatcher.addObject(18, new Integer(1));
- this.dataWatcher.addObject(19, new Integer(0));
+ this.dataWatcher.addObject(17, Integer.valueOf(0));
+ this.dataWatcher.addObject(18, Integer.valueOf(1));
+ this.dataWatcher.addObject(19, Integer.valueOf(0));
}
/**
diff --git a/src/main/java/net/minecraft/src/EntityDragon.java b/src/main/java/net/minecraft/src/EntityDragon.java
index fdcdb5e..6be9ae9 100644
--- a/src/main/java/net/minecraft/src/EntityDragon.java
+++ b/src/main/java/net/minecraft/src/EntityDragon.java
@@ -80,7 +80,7 @@ public class EntityDragon extends EntityLiving implements IBossDisplayData, IEnt
protected void entityInit() {
super.entityInit();
- this.dataWatcher.addObject(16, new Integer(this.getMaxHealth()));
+ this.dataWatcher.addObject(16, Integer.valueOf(this.getMaxHealth()));
}
/**
diff --git a/src/main/java/net/minecraft/src/EntityEnderman.java b/src/main/java/net/minecraft/src/EntityEnderman.java
index a5bff0f..d0c7bac 100644
--- a/src/main/java/net/minecraft/src/EntityEnderman.java
+++ b/src/main/java/net/minecraft/src/EntityEnderman.java
@@ -24,9 +24,9 @@ public class EntityEnderman extends EntityMob {
protected void entityInit() {
super.entityInit();
- this.dataWatcher.addObject(16, new Byte((byte) 0));
- this.dataWatcher.addObject(17, new Byte((byte) 0));
- this.dataWatcher.addObject(18, new Byte((byte) 0));
+ this.dataWatcher.addObject(16, Byte.valueOf((byte) 0));
+ this.dataWatcher.addObject(17, Byte.valueOf((byte) 0));
+ this.dataWatcher.addObject(18, Byte.valueOf((byte) 0));
}
/**
diff --git a/src/main/java/net/minecraft/src/EntityMinecart.java b/src/main/java/net/minecraft/src/EntityMinecart.java
index 55d301d..8b824f6 100644
--- a/src/main/java/net/minecraft/src/EntityMinecart.java
+++ b/src/main/java/net/minecraft/src/EntityMinecart.java
@@ -74,11 +74,11 @@ public abstract class EntityMinecart extends Entity {
}
protected void entityInit() {
- this.dataWatcher.addObject(17, new Integer(0));
- this.dataWatcher.addObject(18, new Integer(1));
- this.dataWatcher.addObject(19, new Integer(0));
- this.dataWatcher.addObject(20, new Integer(0));
- this.dataWatcher.addObject(21, new Integer(6));
+ this.dataWatcher.addObject(17, Integer.valueOf(0));
+ this.dataWatcher.addObject(18, Integer.valueOf(1));
+ this.dataWatcher.addObject(19, Integer.valueOf(0));
+ this.dataWatcher.addObject(20, Integer.valueOf(0));
+ this.dataWatcher.addObject(21, Integer.valueOf(6));
this.dataWatcher.addObject(22, Byte.valueOf((byte) 0));
}
diff --git a/src/main/java/net/minecraft/src/EntityMinecartFurnace.java b/src/main/java/net/minecraft/src/EntityMinecartFurnace.java
index 98ba5b1..ce94f0c 100644
--- a/src/main/java/net/minecraft/src/EntityMinecartFurnace.java
+++ b/src/main/java/net/minecraft/src/EntityMinecartFurnace.java
@@ -22,7 +22,7 @@ public class EntityMinecartFurnace extends EntityMinecart {
protected void entityInit() {
super.entityInit();
- this.dataWatcher.addObject(16, new Byte((byte) 0));
+ this.dataWatcher.addObject(16, Byte.valueOf((byte) 0));
}
/**
diff --git a/src/main/java/net/minecraft/src/EntityPlayer.java b/src/main/java/net/minecraft/src/EntityPlayer.java
index a45c8bd..97b1ef9 100644
--- a/src/main/java/net/minecraft/src/EntityPlayer.java
+++ b/src/main/java/net/minecraft/src/EntityPlayer.java
@@ -5,6 +5,7 @@ import java.util.Iterator;
import java.util.List;
import net.lax1dude.eaglercraft.DefaultSkinRenderer;
+import net.lax1dude.eaglercraft.EaglerAdapter;
import net.minecraft.client.Minecraft;
public abstract class EntityPlayer extends EntityLiving implements ICommandSender {
@@ -35,7 +36,7 @@ public abstract class EntityPlayer extends EntityLiving implements ICommandSende
public float cameraYaw;
public String username;
- public long eaglerHighPolyAnimationTick = System.currentTimeMillis();
+ public long eaglerHighPolyAnimationTick = EaglerAdapter.steadyTimeMillis();
public float eaglerHighPolyAnimationFloat1 = 0.0f;
public float eaglerHighPolyAnimationFloat2 = 0.0f;
public float eaglerHighPolyAnimationFloat3 = 0.0f;
diff --git a/src/main/java/net/minecraft/src/EntityRenderer.java b/src/main/java/net/minecraft/src/EntityRenderer.java
index e77cfb8..95fcee1 100644
--- a/src/main/java/net/minecraft/src/EntityRenderer.java
+++ b/src/main/java/net/minecraft/src/EntityRenderer.java
@@ -502,7 +502,7 @@ public class EntityRenderer {
if(i < 0.0f) i = 0.0f;
float i2 = i * i;
if(i2 > 0.0f) {
- float f = (float)((System.currentTimeMillis() % 10000000l) * 0.0002);
+ float f = (float)((EaglerAdapter.steadyTimeMillis() % 10000000l) * 0.0002);
f += MathHelper.sin(f * 5.0f) * 0.2f;
i2 *= MathHelper.sin(f) + MathHelper.sin(f * 1.5f + 0.6f) + MathHelper.sin(f * 0.7f + 1.7f) +
MathHelper.sin(f * 3.0f + 3.0f) + MathHelper.sin(f * 5.25f + 1.2f);
@@ -531,7 +531,7 @@ public class EntityRenderer {
i2 = i * i;
if(i > 0.0f) {
- float f = (float)((System.currentTimeMillis() % 10000000l) * 0.00012);
+ float f = (float)((EaglerAdapter.steadyTimeMillis() % 10000000l) * 0.00012);
f += MathHelper.sin(f * 3.0f) * 0.2f;
i2 *= MathHelper.sin(f * 1.2f + 1.0f) + MathHelper.sin(f * 1.5f + 0.8f) * 3.0f + MathHelper.sin(f * 0.6f + 3.0f) +
MathHelper.sin(f * 4.3f) + MathHelper.sin(f * 5.25f + 0.5f);
@@ -609,7 +609,7 @@ public class EntityRenderer {
if(i < 0.0f) i = 0.0f;
float i2 = i * i;
if(i2 > 0.0f) {
- float f = (float)((System.currentTimeMillis() % 10000000l) * 0.0003);
+ float f = (float)((EaglerAdapter.steadyTimeMillis() % 10000000l) * 0.0003);
f += MathHelper.sin(f * 3.0f) * 0.2f;
i2 *= MathHelper.sin(f * 1.2f + 1.0f) + MathHelper.sin(f * 1.5f + 0.8f) * 3.0f + MathHelper.sin(f * 0.6f + 3.0f) +
MathHelper.sin(f * 4.3f) + MathHelper.sin(f * 5.25f + 0.5f);
@@ -1236,7 +1236,7 @@ public class EntityRenderer {
}
private int updateCounter = 0;
- private int randomOffset = (int)(System.currentTimeMillis() % 100000l);
+ private int randomOffset = (int)(EaglerAdapter.steadyTimeMillis() % 100000l);
public boolean asdfghjkl = false;
diff --git a/src/main/java/net/minecraft/src/EntitySheep.java b/src/main/java/net/minecraft/src/EntitySheep.java
index e83196a..392df73 100644
--- a/src/main/java/net/minecraft/src/EntitySheep.java
+++ b/src/main/java/net/minecraft/src/EntitySheep.java
@@ -55,7 +55,7 @@ public class EntitySheep extends EntityAnimal {
protected void entityInit() {
super.entityInit();
- this.dataWatcher.addObject(16, new Byte((byte) 0));
+ this.dataWatcher.addObject(16, Byte.valueOf((byte) 0));
}
/**
diff --git a/src/main/java/net/minecraft/src/EntitySkeleton.java b/src/main/java/net/minecraft/src/EntitySkeleton.java
index 65ba06f..5249ed2 100644
--- a/src/main/java/net/minecraft/src/EntitySkeleton.java
+++ b/src/main/java/net/minecraft/src/EntitySkeleton.java
@@ -9,7 +9,7 @@ public class EntitySkeleton extends EntityMob implements IRangedAttackMob {
protected void entityInit() {
super.entityInit();
- this.dataWatcher.addObject(13, new Byte((byte) 0));
+ this.dataWatcher.addObject(13, Byte.valueOf((byte) 0));
}
/**
diff --git a/src/main/java/net/minecraft/src/EntitySlime.java b/src/main/java/net/minecraft/src/EntitySlime.java
index 7d5fe05..6e1564d 100644
--- a/src/main/java/net/minecraft/src/EntitySlime.java
+++ b/src/main/java/net/minecraft/src/EntitySlime.java
@@ -22,11 +22,11 @@ public class EntitySlime extends EntityLiving implements IMob {
protected void entityInit() {
super.entityInit();
- this.dataWatcher.addObject(16, new Byte((byte) 1));
+ this.dataWatcher.addObject(16, Byte.valueOf((byte) 1));
}
protected void setSlimeSize(int par1) {
- this.dataWatcher.updateObject(16, new Byte((byte) par1));
+ this.dataWatcher.updateObject(16, Byte.valueOf((byte) par1));
this.setSize(0.6F * (float) par1, 0.6F * (float) par1);
this.setPosition(this.posX, this.posY, this.posZ);
this.setEntityHealth(this.getMaxHealth());
diff --git a/src/main/java/net/minecraft/src/EntitySpider.java b/src/main/java/net/minecraft/src/EntitySpider.java
index ee2e27f..f933c2f 100644
--- a/src/main/java/net/minecraft/src/EntitySpider.java
+++ b/src/main/java/net/minecraft/src/EntitySpider.java
@@ -9,7 +9,7 @@ public class EntitySpider extends EntityMob {
protected void entityInit() {
super.entityInit();
- this.dataWatcher.addObject(16, new Byte((byte) 0));
+ this.dataWatcher.addObject(16, Byte.valueOf((byte) 0));
}
public int getMaxHealth() {
diff --git a/src/main/java/net/minecraft/src/EntityWither.java b/src/main/java/net/minecraft/src/EntityWither.java
index 7617eb1..7e5767a 100644
--- a/src/main/java/net/minecraft/src/EntityWither.java
+++ b/src/main/java/net/minecraft/src/EntityWither.java
@@ -27,11 +27,11 @@ public class EntityWither extends EntityMob implements IBossDisplayData, IRanged
protected void entityInit() {
super.entityInit();
- this.dataWatcher.addObject(16, new Integer(100));
- this.dataWatcher.addObject(17, new Integer(0));
- this.dataWatcher.addObject(18, new Integer(0));
- this.dataWatcher.addObject(19, new Integer(0));
- this.dataWatcher.addObject(20, new Integer(0));
+ this.dataWatcher.addObject(16, Integer.valueOf(100));
+ this.dataWatcher.addObject(17, Integer.valueOf(0));
+ this.dataWatcher.addObject(18, Integer.valueOf(0));
+ this.dataWatcher.addObject(19, Integer.valueOf(0));
+ this.dataWatcher.addObject(20, Integer.valueOf(0));
}
/**
diff --git a/src/main/java/net/minecraft/src/EntityWolf.java b/src/main/java/net/minecraft/src/EntityWolf.java
index c45a99c..decd4e8 100644
--- a/src/main/java/net/minecraft/src/EntityWolf.java
+++ b/src/main/java/net/minecraft/src/EntityWolf.java
@@ -53,9 +53,9 @@ public class EntityWolf extends EntityTameable {
protected void entityInit() {
super.entityInit();
- this.dataWatcher.addObject(18, new Integer(this.getHealth()));
- this.dataWatcher.addObject(19, new Byte((byte) 0));
- this.dataWatcher.addObject(20, new Byte((byte) BlockCloth.getBlockFromDye(1)));
+ this.dataWatcher.addObject(18, Integer.valueOf(this.getHealth()));
+ this.dataWatcher.addObject(19, Byte.valueOf((byte) 0));
+ this.dataWatcher.addObject(20, Byte.valueOf((byte) BlockCloth.getBlockFromDye(1)));
}
/**
diff --git a/src/main/java/net/minecraft/src/GuiIngame.java b/src/main/java/net/minecraft/src/GuiIngame.java
index 7c481b0..b061988 100644
--- a/src/main/java/net/minecraft/src/GuiIngame.java
+++ b/src/main/java/net/minecraft/src/GuiIngame.java
@@ -10,7 +10,6 @@ import net.lax1dude.eaglercraft.EnumBrowser;
import net.lax1dude.eaglercraft.IntegratedServer;
import net.lax1dude.eaglercraft.TextureLocation;
import net.lax1dude.eaglercraft.adapter.Tessellator;
-import net.lax1dude.eaglercraft.glemu.EffectPipeline;
import net.minecraft.client.Minecraft;
public class GuiIngame extends Gui {
@@ -749,7 +748,7 @@ public class GuiIngame extends Gui {
if(i < 0.0f) i = 0.0f;
float i2 = i * i;
if(i2 > 0.0f) {
- float f = (float)((System.currentTimeMillis() % 1000000l) * 0.0002);
+ float f = (float)((EaglerAdapter.steadyTimeMillis() % 1000000l) * 0.0002);
f += MathHelper.sin(f * 5.0f) * 0.2f;
i2 *= MathHelper.sin(f) + MathHelper.sin(f * 1.5f + 0.6f) + MathHelper.sin(f * 0.7f + 1.7f) +
MathHelper.sin(f * 3.0f + 3.0f);
diff --git a/src/main/java/net/minecraft/src/GuiMainMenu.java b/src/main/java/net/minecraft/src/GuiMainMenu.java
index 4578942..767ccf6 100644
--- a/src/main/java/net/minecraft/src/GuiMainMenu.java
+++ b/src/main/java/net/minecraft/src/GuiMainMenu.java
@@ -87,7 +87,7 @@ public class GuiMainMenu extends GuiScreen {
}
}
this.field_92025_p = "Eaglercraft 1.5.2 Service Pack #1";
- this.start = System.currentTimeMillis();
+ this.start = EaglerAdapter.steadyTimeMillis();
this.start += this.start % 10000l;
this.ackLines = new ArrayList();
@@ -342,7 +342,7 @@ public class GuiMainMenu extends GuiScreen {
float var9 = 0.0F;
EaglerAdapter.glTranslatef(var7, var8, var9);
- float panTimer = (float)(System.currentTimeMillis() - start) * 0.03f;
+ float panTimer = (float)(EaglerAdapter.steadyTimeMillis() - start) * 0.03f;
EaglerAdapter.glRotatef(MathHelper.sin(panTimer / 400.0F) * 25.0F + 20.0F, 1.0F, 0.0F, 0.0F);
EaglerAdapter.glRotatef(-(panTimer) * 0.1F, 0.0F, 1.0F, 0.0F);
}
@@ -646,7 +646,7 @@ public class GuiMainMenu extends GuiScreen {
}else {
EaglerAdapter.glEnable(EaglerAdapter.GL_BLEND);
EaglerAdapter.glBlendFunc(EaglerAdapter.GL_SRC_ALPHA, EaglerAdapter.GL_ONE_MINUS_SRC_ALPHA);
- EaglerAdapter.glColor4f(0.9f, 0.9f, 0.9f, MathHelper.sin((float)(System.currentTimeMillis() % 1000000l) / 300f) * 0.17f + 0.5f);
+ EaglerAdapter.glColor4f(0.9f, 0.9f, 0.9f, MathHelper.sin((float)(EaglerAdapter.steadyTimeMillis() % 1000000l) / 300f) * 0.17f + 0.5f);
items.bindTexture();
diff --git a/src/main/java/net/minecraft/src/GuiMultiplayer.java b/src/main/java/net/minecraft/src/GuiMultiplayer.java
index a152459..375a4a7 100644
--- a/src/main/java/net/minecraft/src/GuiMultiplayer.java
+++ b/src/main/java/net/minecraft/src/GuiMultiplayer.java
@@ -1,8 +1,5 @@
package net.minecraft.src;
-import java.util.LinkedList;
-import java.util.List;
-
import net.lax1dude.eaglercraft.ConfigConstants;
import net.lax1dude.eaglercraft.EaglerAdapter;
import net.lax1dude.eaglercraft.GuiNetworkSettingsButton;
@@ -81,7 +78,7 @@ public class GuiMultiplayer extends GuiScreen {
public static void tickRefreshCooldown() {
if(cooldownTimer > 0) {
- long t = System.currentTimeMillis();
+ long t = EaglerAdapter.steadyTimeMillis();
if(t - lastCooldown > 5000l) {
--cooldownTimer;
lastCooldown = t;
@@ -90,7 +87,7 @@ public class GuiMultiplayer extends GuiScreen {
}
private static boolean testIfCanRefresh() {
- long t = System.currentTimeMillis();
+ long t = EaglerAdapter.steadyTimeMillis();
if(t - lastRefresh > 1000l) {
lastRefresh = t;
if(cooldownTimer < 8) {
diff --git a/src/main/java/net/minecraft/src/GuiTexturePacks.java b/src/main/java/net/minecraft/src/GuiTexturePacks.java
index d1c8a54..e4c748f 100644
--- a/src/main/java/net/minecraft/src/GuiTexturePacks.java
+++ b/src/main/java/net/minecraft/src/GuiTexturePacks.java
@@ -2,8 +2,6 @@ package net.minecraft.src;
import net.lax1dude.eaglercraft.EaglerAdapter;
import net.lax1dude.eaglercraft.adapter.SimpleStorage;
-import net.minecraft.client.Minecraft;
-
import java.util.List;
public class GuiTexturePacks extends GuiScreen {
diff --git a/src/main/java/net/minecraft/src/Packet.java b/src/main/java/net/minecraft/src/Packet.java
index 0113147..5db7cdb 100644
--- a/src/main/java/net/minecraft/src/Packet.java
+++ b/src/main/java/net/minecraft/src/Packet.java
@@ -8,6 +8,8 @@ import java.util.HashSet;
import java.util.Map;
import java.util.Set;
+import net.lax1dude.eaglercraft.EaglerAdapter;
+
public abstract class Packet {
/** Maps packet id to packet class */
public static IntHashMap packetIdToClassMap = new IntHashMap();
@@ -23,7 +25,7 @@ public abstract class Packet {
protected ILogAgent field_98193_m;
/** the system time in milliseconds when this packet was created. */
- public final long creationTimeMillis = System.currentTimeMillis();
+ public final long creationTimeMillis = EaglerAdapter.steadyTimeMillis();
public static long receivedID;
public static long receivedSize;
diff --git a/src/main/java/net/minecraft/src/RenderGlobal.java b/src/main/java/net/minecraft/src/RenderGlobal.java
index be11bb7..671ea86 100644
--- a/src/main/java/net/minecraft/src/RenderGlobal.java
+++ b/src/main/java/net/minecraft/src/RenderGlobal.java
@@ -572,7 +572,7 @@ public class RenderGlobal implements IWorldAccess {
long stallRate = 500l;
int cooldownRate = 13;
- long ct = System.currentTimeMillis();
+ long ct = EaglerAdapter.steadyTimeMillis();
if(par2 == 0) {
this.theWorld.theProfiler.endStartSection("getoccl");
for (int i = 0; i < this.sortedWorldRenderers.length; ++i) {
@@ -620,7 +620,7 @@ public class RenderGlobal implements IWorldAccess {
var7 -= par1EntityLiving.getEyeHeight();
- ct = System.currentTimeMillis();
+ ct = EaglerAdapter.steadyTimeMillis();
if(par2 == 0 && ct - lastOcclusionQuery > queryRate) {
int totalRenderers = this.sortedWorldRenderers.length;
diff --git a/src/main/java/net/minecraft/src/RenderPlayer.java b/src/main/java/net/minecraft/src/RenderPlayer.java
index a235db0..73fcf67 100644
--- a/src/main/java/net/minecraft/src/RenderPlayer.java
+++ b/src/main/java/net/minecraft/src/RenderPlayer.java
@@ -178,7 +178,7 @@ public class RenderPlayer extends RenderLiving {
if(msh.headModel != null) {
if(msh == HighPolySkin.BABY_CHARLES) {
- long millis = System.currentTimeMillis();
+ long millis = EaglerAdapter.steadyTimeMillis();
float partialTicks = (float) ((millis - par1EntityPlayer.eaglerHighPolyAnimationTick) * 0.02);
//long l50 = millis / 50l * 50l;
//boolean runTick = par1EntityPlayer.eaglerHighPolyAnimationTick < l50 && millis >= l50;
diff --git a/src/main/java/net/minecraft/src/ServerList.java b/src/main/java/net/minecraft/src/ServerList.java
index 2ad4b7a..608e2fa 100644
--- a/src/main/java/net/minecraft/src/ServerList.java
+++ b/src/main/java/net/minecraft/src/ServerList.java
@@ -278,7 +278,7 @@ public class ServerList {
addr = "ws://" + addr;
}
}
- dat.pingSentTime = System.currentTimeMillis();
+ dat.pingSentTime = EaglerAdapter.steadyTimeMillis();
dat.currentQuery = EaglerAdapter.openQuery("MOTD", addr);
if(dat.currentQuery == null) {
dat.hasPing = true;
diff --git a/src/main/java/net/minecraft/src/SoundManager.java b/src/main/java/net/minecraft/src/SoundManager.java
index fbc1af4..064a1d1 100644
--- a/src/main/java/net/minecraft/src/SoundManager.java
+++ b/src/main/java/net/minecraft/src/SoundManager.java
@@ -155,7 +155,7 @@ public class SoundManager {
String path = "/records/" + par1Str.replace('.', '/') + ".mp3";
int snd = EaglerAdapter.beginPlayback(path, par2, par3, par4, 1.0F, 1.0F, music);
if (snd != -1) {
- activerecords.add(new Integer(snd));
+ activerecords.add(Integer.valueOf(snd));
} else {
System.err.println("unregistered record: "+par1Str);
}
diff --git a/src/main/java/net/minecraft/src/StringTranslate.java b/src/main/java/net/minecraft/src/StringTranslate.java
index 931492d..3ac56d7 100644
--- a/src/main/java/net/minecraft/src/StringTranslate.java
+++ b/src/main/java/net/minecraft/src/StringTranslate.java
@@ -1,8 +1,6 @@
package net.minecraft.src;
-import java.io.BufferedReader;
import java.io.IOException;
-import java.io.InputStreamReader;
import java.util.IllegalFormatException;
import java.util.Properties;
import java.util.TreeMap;
diff --git a/src/main/java/net/minecraft/src/TextureStitched.java b/src/main/java/net/minecraft/src/TextureStitched.java
index 7ae57a9..f4c41c6 100644
--- a/src/main/java/net/minecraft/src/TextureStitched.java
+++ b/src/main/java/net/minecraft/src/TextureStitched.java
@@ -183,11 +183,11 @@ public class TextureStitched implements Icon {
int var9 = var8.indexOf(42);
if (var9 > 0) {
- Integer var10 = new Integer(var8.substring(0, var9));
- Integer var11 = new Integer(var8.substring(var9 + 1));
+ Integer var10 = Integer.valueOf(var8.substring(0, var9));
+ Integer var11 = Integer.valueOf(var8.substring(var9 + 1));
var2.add(new Tuple(var10, var11));
} else {
- var2.add(new Tuple(new Integer(var8), Integer.valueOf(1)));
+ var2.add(new Tuple(Integer.valueOf(var8), Integer.valueOf(1)));
}
}
}
diff --git a/src/main/java/net/minecraft/src/TileEntityBeaconRenderer.java b/src/main/java/net/minecraft/src/TileEntityBeaconRenderer.java
index 01d9254..7440de9 100644
--- a/src/main/java/net/minecraft/src/TileEntityBeaconRenderer.java
+++ b/src/main/java/net/minecraft/src/TileEntityBeaconRenderer.java
@@ -25,7 +25,7 @@ public class TileEntityBeaconRenderer extends TileEntitySpecialRenderer {
EaglerAdapter.glDisable(EaglerAdapter.GL_ALPHA_TEST);
EaglerAdapter.glDepthMask(true);
EaglerAdapter.glBlendFunc(EaglerAdapter.GL_SRC_ALPHA, EaglerAdapter.GL_ONE);
- float var11 = ((System.currentTimeMillis() % 200000) / 50.0f);//par1TileEntityBeacon.getWorldObj().getWorldTime() + par8;
+ float var11 = ((EaglerAdapter.steadyTimeMillis() % 200000) / 50.0f);//par1TileEntityBeacon.getWorldObj().getWorldTime() + par8;
float var12 = -var11 * 0.2F - (float) MathHelper.floor_float(-var11 * 0.1F);
byte var13 = 1;
double var14 = (double) var11 * 0.025D * (1.0D - (double) (var13 & 1) * 2.5D);
diff --git a/src/teavm/java/net/lax1dude/eaglercraft/adapter/DetectAnisotropicGlitch.java b/src/teavm/java/net/lax1dude/eaglercraft/adapter/DetectAnisotropicGlitch.java
index ddd5869..db51e74 100644
--- a/src/teavm/java/net/lax1dude/eaglercraft/adapter/DetectAnisotropicGlitch.java
+++ b/src/teavm/java/net/lax1dude/eaglercraft/adapter/DetectAnisotropicGlitch.java
@@ -127,7 +127,7 @@ public class DetectAnisotropicGlitch {
x0, x0, x0, x1
};
- Uint8Array pixels = Uint8Array.create(pixelsData.length);
+ Uint8Array pixels = new Uint8Array(pixelsData.length);
pixels.set(pixelsData);
WebGLTexture tex = ctx.createTexture();
@@ -152,7 +152,7 @@ public class DetectAnisotropicGlitch {
0.0f, 1.0f
};
- Float32Array verts = Float32Array.create(vertsData.length);
+ Float32Array verts = new Float32Array(vertsData.length);
verts.set(vertsData);
WebGLBuffer buf = ctx.createBuffer();
@@ -175,7 +175,7 @@ public class DetectAnisotropicGlitch {
ctx.deleteTexture(tex);
ctx.deleteProgram(pr);
- Uint8Array readPx = Uint8Array.create(4);
+ Uint8Array readPx = new Uint8Array(4);
ctx.readPixels(175, 150, 1, 1, RGBA, UNSIGNED_BYTE, readPx);
boolean b = (readPx.get(0) + readPx.get(1) + readPx.get(2)) != 0;
diff --git a/src/teavm/java/net/lax1dude/eaglercraft/adapter/EaglerAdapterImpl2.java b/src/teavm/java/net/lax1dude/eaglercraft/adapter/EaglerAdapterImpl2.java
index 67272f3..fd22d50 100644
--- a/src/teavm/java/net/lax1dude/eaglercraft/adapter/EaglerAdapterImpl2.java
+++ b/src/teavm/java/net/lax1dude/eaglercraft/adapter/EaglerAdapterImpl2.java
@@ -85,6 +85,8 @@ import org.teavm.jso.webgl.WebGLUniformLocation;
import org.teavm.jso.websocket.CloseEvent;
import org.teavm.jso.websocket.WebSocket;
import org.teavm.jso.workers.Worker;
+import org.teavm.platform.Platform;
+import org.teavm.platform.PlatformRunnable;
import net.lax1dude.eaglercraft.AssetRepository;
import net.lax1dude.eaglercraft.Base64;
@@ -169,14 +171,14 @@ public class EaglerAdapterImpl2 {
public static native String downloadAssetPack(String assetPackageURI);
private static void downloadAssetPack(String assetPackageURI, final AsyncCallback cb) {
- final XMLHttpRequest request = XMLHttpRequest.create();
+ final XMLHttpRequest request = new XMLHttpRequest();
request.setResponseType("arraybuffer");
request.open("GET", assetPackageURI, true);
request.setOnReadyStateChange(new ReadyStateChangeHandler() {
@Override
public void stateChanged() {
if(request.getReadyState() == XMLHttpRequest.DONE) {
- Uint8Array bl = Uint8Array.create((ArrayBuffer)request.getResponse());
+ Uint8Array bl = new Uint8Array((ArrayBuffer)request.getResponse());
loadedPackage = new byte[bl.getByteLength()];
for(int i = 0; i < loadedPackage.length; ++i) {
loadedPackage[i] = (byte) bl.get(i);
@@ -196,14 +198,14 @@ public class EaglerAdapterImpl2 {
cb.complete(new byte[0]);
return;
}
- final XMLHttpRequest request = XMLHttpRequest.create();
+ final XMLHttpRequest request = new XMLHttpRequest();
request.setResponseType("arraybuffer");
request.open("GET", url, true);
request.setOnReadyStateChange(new ReadyStateChangeHandler() {
@Override
public void stateChanged() {
if(request.getReadyState() == XMLHttpRequest.DONE) {
- Uint8Array bl = Uint8Array.create((ArrayBuffer)request.getResponse());
+ Uint8Array bl = new Uint8Array((ArrayBuffer)request.getResponse());
byte[] res = new byte[bl.getByteLength()];
for(int i = 0; i < res.length; ++i) {
res[i] = (byte) bl.get(i);
@@ -230,14 +232,14 @@ public class EaglerAdapterImpl2 {
public static RenderbufferGL backBufferDepth = null;
public static Window win = null;
private static byte[] loadedPackage = null;
- private static EventListener contextmenu = null;
- private static EventListener mousedown = null;
- private static EventListener mouseup = null;
- private static EventListener mousemove = null;
- private static EventListener keydown = null;
- private static EventListener keyup = null;
- private static EventListener keypress = null;
- private static EventListener wheel = null;
+ private static EventListener> contextmenu = null;
+ private static EventListener> mousedown = null;
+ private static EventListener> mouseup = null;
+ private static EventListener> mousemove = null;
+ private static EventListener> keydown = null;
+ private static EventListener> keyup = null;
+ private static EventListener> keypress = null;
+ private static EventListener> wheel = null;
private static String[] identifier = new String[0];
private static String integratedServerScript = "worker_bootstrap.js";
private static boolean anisotropicFilteringSupported = false;
@@ -418,15 +420,11 @@ public class EaglerAdapterImpl2 {
EarlyLoadScreen.paintEnable();
while(mouseEvents.isEmpty() && keyEvents.isEmpty()) {
- try {
- Thread.sleep(100l);
- } catch (InterruptedException e) {
- ;
- }
+ sleep(100);
}
}
- audioctx = AudioContext.create();
+ audioctx = new AudioContext();
masterVolumeNode = audioctx.createGain();
masterVolumeNode.getGain().setValue(1.0f);
masterVolumeNode.connect(audioctx.getDestination());
@@ -440,12 +438,15 @@ public class EaglerAdapterImpl2 {
Window.setInterval(new TimerHandler() {
@Override
public void onTimer() {
- Iterator vids = videosBuffer.values().iterator();
- while(vids.hasNext()) {
- BufferedVideo v = vids.next();
- if(System.currentTimeMillis() - v.requestedTime > v.ttl) {
- v.videoElement.setSrc("");
- vids.remove();
+ if(!videosBuffer.isEmpty()) {
+ long now = steadyTimeMillis();
+ Iterator vids = videosBuffer.values().iterator();
+ while(vids.hasNext()) {
+ BufferedVideo v = vids.next();
+ if(now - v.requestedTime > v.ttl) {
+ v.videoElement.setSrc("");
+ vids.remove();
+ }
}
}
}
@@ -511,8 +512,8 @@ public class EaglerAdapterImpl2 {
}
}
- private static LinkedList mouseEvents = new LinkedList();
- private static LinkedList keyEvents = new LinkedList();
+ private static LinkedList mouseEvents = new LinkedList<>();
+ private static LinkedList keyEvents = new LinkedList<>();
private static int mouseX = 0;
private static int mouseY = 0;
@@ -718,7 +719,7 @@ public class EaglerAdapterImpl2 {
public static final void _wglFlush() {
//webgl.flush();
}
- private static Uint8Array uploadBuffer = Uint8Array.create(ArrayBuffer.create(4 * 1024 * 1024));
+ private static Uint8Array uploadBuffer = new Uint8Array(new ArrayBuffer(4 * 1024 * 1024));
public static final void _wglTexImage2D(int p1, int p2, int p3, int p4, int p5, int p6, int p7, int p8, ByteBuffer p9) {
if(p9 == null) {
webgl.texImage2D(p1, p2, p3, p4, p5, p6, p7, p8, null);
@@ -728,7 +729,7 @@ public class EaglerAdapterImpl2 {
for(int i = 0; i < len; ++i) {
uploadBuffer1.set(i, (short) ((int)p9.get() & 0xff));
}
- Uint8Array data = Uint8Array.create(uploadBuffer.getBuffer(), 0, len);
+ Uint8Array data = new Uint8Array(uploadBuffer.getBuffer(), 0, len);
webgl.texImage2D(p1, p2, p3, p4, p5, p6, p7, p8, data);
}
}
@@ -761,20 +762,20 @@ public class EaglerAdapterImpl2 {
}
public static final void _wglTexImage2D(int p1, int p2, int p3, int p4, int p5, int p6, int p7, int p8, IntBuffer p9) {
int len = p9.remaining();
- DataView deevis = DataView.create(uploadBuffer.getBuffer());
+ DataView deevis = new DataView(uploadBuffer.getBuffer());
for(int i = 0; i < len; ++i) {
deevis.setInt32(i * 4, p9.get(), true);
}
- Uint8Array data = Uint8Array.create(uploadBuffer.getBuffer(), 0, len*4);
+ Uint8Array data = new Uint8Array(uploadBuffer.getBuffer(), 0, len*4);
webgl.texImage2D(p1, p2, p3, p4, p5, p6, p7, p8, data);
}
public static final void _wglTexSubImage2D(int p1, int p2, int p3, int p4, int p5, int p6, int p7, int p8, IntBuffer p9) {
int len = p9.remaining();
- DataView deevis = DataView.create(uploadBuffer.getBuffer());
+ DataView deevis = new DataView(uploadBuffer.getBuffer());
for(int i = 0; i < len; ++i) {
deevis.setInt32(i * 4, p9.get(), true);
}
- Uint8Array data = Uint8Array.create(uploadBuffer.getBuffer(), 0, len*4);
+ Uint8Array data = new Uint8Array(uploadBuffer.getBuffer(), 0, len*4);
webgl.texSubImage2D(p1, p2, p3, p4, p5, p6, p7, p8, data);
}
public static final void _wglDeleteTextures(TextureGL p1) {
@@ -795,7 +796,7 @@ public class EaglerAdapterImpl2 {
//uploadBuffer.set(swapEndian ? ((i >> 2) + (3 - (i & 3))) : i, (short) ((int)p9.get() & 0xff));
uploadBuffer.set(i, (short) ((int)p9.get() & 0xff));
}
- Uint8Array data = Uint8Array.create(uploadBuffer.getBuffer(), 0, len);
+ Uint8Array data = new Uint8Array(uploadBuffer.getBuffer(), 0, len);
webgl.texSubImage2D(p1, p2, p3, p4, p5, p6, p7, p8, data);
}
public static final void _wglActiveTexture(int p1) {
@@ -851,20 +852,20 @@ public class EaglerAdapterImpl2 {
}
public static final void _wglBufferData0(int p1, IntBuffer p2, int p3) {
int len = p2.remaining();
- DataView deevis = DataView.create(uploadBuffer.getBuffer());
+ DataView deevis = new DataView(uploadBuffer.getBuffer());
for(int i = 0; i < len; ++i) {
deevis.setInt32(i * 4, p2.get(), true);
}
- Uint8Array data = Uint8Array.create(uploadBuffer.getBuffer(), 0, len*4);
+ Uint8Array data = new Uint8Array(uploadBuffer.getBuffer(), 0, len*4);
webgl.bufferData(p1, data, p3);
}
public static final void _wglBufferSubData0(int p1, int p2, IntBuffer p3) {
int len = p3.remaining();
- DataView deevis = DataView.create(uploadBuffer.getBuffer());
+ DataView deevis = new DataView(uploadBuffer.getBuffer());
for(int i = 0; i < len; ++i) {
deevis.setInt32(i * 4, p3.get(), true);
}
- Uint8Array data = Uint8Array.create(uploadBuffer.getBuffer(), 0, len*4);
+ Uint8Array data = new Uint8Array(uploadBuffer.getBuffer(), 0, len*4);
webgl.bufferSubData(p1, p2, data);
}
public static final void _wglBufferData(int p1, Object p2, int p3) {
@@ -916,9 +917,9 @@ public class EaglerAdapterImpl2 {
public static final void _wglUniform4i(UniformGL p1, int p2, int p3, int p4, int p5) {
if(p1 != null) webgl.uniform4i(p1.obj, p2, p3, p4, p5);
}
- private static Float32Array mat2 = Float32Array.create(4);
- private static Float32Array mat3 = Float32Array.create(9);
- private static Float32Array mat4 = Float32Array.create(16);
+ private static Float32Array mat2 = new Float32Array(4);
+ private static Float32Array mat3 = new Float32Array(9);
+ private static Float32Array mat4 = new Float32Array(16);
public static final void _wglUniformMat2fv(UniformGL p1, float[] mat) {
mat2.set(mat);
if(p1 != null) webgl.uniformMatrix2fv(p1.obj, false, mat2);
@@ -1049,8 +1050,8 @@ public class EaglerAdapterImpl2 {
private static native void freeDataURL(String url);
public static final EaglerImage loadPNG(byte[] data) {
- ArrayBuffer arr = ArrayBuffer.create(data.length);
- Uint8Array.create(arr).set(data);
+ ArrayBuffer arr = new ArrayBuffer(data.length);
+ (new Uint8Array(arr)).set(data);
return loadPNG0(arr);
}
@@ -1088,7 +1089,7 @@ public class EaglerAdapterImpl2 {
ret.complete(null);
return;
}
- DataView dv = DataView.create(pxls.getBuffer());
+ DataView dv = new DataView(pxls.getBuffer());
int[] pixels = new int[totalPixels];
for(int i = 0, j; i < pixels.length; ++i) {
j = dv.getUint32(i << 2, false);
@@ -1233,13 +1234,13 @@ public class EaglerAdapterImpl2 {
public BufferedVideo(HTMLVideoElement videoElement, String url, int ttl) {
this.videoElement = videoElement;
this.url = url;
- this.requestedTime = System.currentTimeMillis();
+ this.requestedTime = steadyTimeMillis();
this.ttl = ttl;
}
}
- private static final HashMap videosBuffer = new HashMap();
+ private static final HashMap videosBuffer = new HashMap<>();
public static final void bufferVideo(String src, int ttl) {
if(!videosBuffer.containsKey(src)) {
@@ -1326,7 +1327,7 @@ public class EaglerAdapterImpl2 {
private static native void html5VideoTexSubImage2D(WebGL2RenderingContext ctx, int target, int format, int type, HTMLVideoElement video);
public static final void updateVideoTexture() {
- long ms = System.currentTimeMillis();
+ long ms = steadyTimeMillis();
if(ms - frameTimer < frameRate && videoTexIsInitialized) {
return;
}
@@ -1485,13 +1486,13 @@ public class EaglerAdapterImpl2 {
public BufferedImageElem(HTMLImageElement imageElement, String url, int ttl) {
this.imageElement = imageElement;
this.url = url;
- this.requestedTime = System.currentTimeMillis();
+ this.requestedTime = steadyTimeMillis();
this.ttl = ttl;
}
}
- private static final HashMap imagesBuffer = new HashMap();
+ private static final HashMap imagesBuffer = new HashMap<>();
public static final void bufferImage(String src, int ttl) {
if(!imagesBuffer.containsKey(src)) {
@@ -1529,7 +1530,7 @@ public class EaglerAdapterImpl2 {
private static native void html5ImageTexSubImage2D(WebGL2RenderingContext ctx, int target, int format, int type, HTMLImageElement image);
public static final void updateImageTexture() {
- long ms = System.currentTimeMillis();
+ long ms = steadyTimeMillis();
if(ms - imageFrameTimer < imageFrameRate && imageTexIsInitialized) {
return;
}
@@ -1609,7 +1610,7 @@ public class EaglerAdapterImpl2 {
public static final void mouseSetGrabbed(boolean grabbed) {
if(grabbed) {
canvas.requestPointerLock();
- long t = System.currentTimeMillis();
+ long t = steadyTimeMillis();
if(mouseUngrabTimeout != 0) Window.clearTimeout(mouseUngrabTimeout);
mouseUngrabTimeout = 0;
if(t - mouseUngrabTimer < 3000l) {
@@ -1621,7 +1622,7 @@ public class EaglerAdapterImpl2 {
}, 3000 - (int)(t - mouseUngrabTimer));
}
}else {
- mouseUngrabTimer = System.currentTimeMillis();
+ mouseUngrabTimer = steadyTimeMillis();
if(mouseUngrabTimeout != 0) Window.clearTimeout(mouseUngrabTimeout);
mouseUngrabTimeout = 0;
doc.exitPointerLock();
@@ -1712,11 +1713,7 @@ public class EaglerAdapterImpl2 {
webgl.blitFramebuffer(0, 0, backBufferWidth, backBufferHeight, 0, 0, w2, h2, COLOR_BUFFER_BIT, NEAREST);
webgl.bindFramebuffer(FRAMEBUFFER, backBuffer.obj);
resizeBackBuffer(w2, h2);
- try {
- Thread.sleep(1l);
- } catch (InterruptedException e) {
- ;
- }
+ sleep(1);
}
public static final void setupBackBuffer() {
backBuffer = _wglCreateFramebuffer();
@@ -1805,14 +1802,14 @@ public class EaglerAdapterImpl2 {
NONE, FAILED, BLOCKED, FAILED_POSSIBLY_LOCKED, LOCKED, NOW_LOCKED;
}
- private static final Set rateLimitedAddresses = new HashSet();
- private static final Set blockedAddresses = new HashSet();
+ private static final Set rateLimitedAddresses = new HashSet<>();
+ private static final Set blockedAddresses = new HashSet<>();
private static WebSocket sock = null;
private static boolean sockIsConnecting = false;
private static boolean sockIsConnected = false;
private static boolean sockIsAlive = false;
- private static LinkedList readPackets = new LinkedList();
+ private static LinkedList readPackets = new LinkedList<>();
private static RateLimit rateLimitStatus = null;
private static String currentSockURI = null;
@@ -1848,16 +1845,16 @@ public class EaglerAdapterImpl2 {
rateLimitStatus = null;
currentSockURI = sockURI;
try {
- sock = WebSocket.create(sockURI);
+ sock = new WebSocket(sockURI);
} catch(Throwable t) {
sockIsConnecting = false;
sockIsAlive = false;
return;
}
sock.setBinaryType("arraybuffer");
- sock.onOpen(new EventListener() {
+ sock.addEventListener("open", new EventListener() {
@Override
- public void handleEvent(MessageEvent evt) {
+ public void handleEvent(Event evt) {
sockIsConnecting = false;
sockIsAlive = false;
sockIsConnected = true;
@@ -1865,7 +1862,7 @@ public class EaglerAdapterImpl2 {
cb.complete("okay");
}
});
- sock.onClose(new EventListener() {
+ sock.addEventListener("close", new EventListener() {
@Override
public void handleEvent(CloseEvent evt) {
sock = null;
@@ -1895,7 +1892,7 @@ public class EaglerAdapterImpl2 {
if(b) cb.complete("fail");
}
});
- sock.onMessage(new EventListener() {
+ sock.addEventListener("message", new EventListener() {
@Override
public void handleEvent(MessageEvent evt) {
sockIsAlive = true;
@@ -1918,7 +1915,7 @@ public class EaglerAdapterImpl2 {
sock.close();
return;
}
- Uint8Array a = Uint8Array.create(evt.getDataAsArray());
+ Uint8Array a = new Uint8Array(evt.getDataAsArray());
byte[] b = new byte[a.getByteLength()];
for(int i = 0; i < b.length; ++i) {
b[i] = (byte) (a.get(i) & 0xFF);
@@ -1956,7 +1953,7 @@ public class EaglerAdapterImpl2 {
private static native void nativeBinarySend(WebSocket sock, ArrayBuffer buffer);
public static final void writePacket(byte[] packet) {
if(sock != null && !sockIsConnecting) {
- Uint8Array arr = Uint8Array.create(packet.length);
+ Uint8Array arr = new Uint8Array(packet.length);
arr.set(packet);
nativeBinarySend(sock, arr.getBuffer());
}
@@ -2013,7 +2010,7 @@ public class EaglerAdapterImpl2 {
public static final byte[] getFileChooserResult() {
ArrayBuffer b = getFileChooserResult0();
if(b == null) return null;
- Uint8Array array = Uint8Array.create(b);
+ Uint8Array array = new Uint8Array(b);
byte[] ret = new byte[array.getByteLength()];
for(int i = 0; i < ret.length; ++i) {
ret[i] = (byte) array.get(i);
@@ -2043,7 +2040,7 @@ public class EaglerAdapterImpl2 {
private static int playbackId = 0;
private static int audioElementId = 0;
- private static final HashMap loadedSoundFiles = new HashMap();
+ private static final HashMap loadedSoundFiles = new HashMap<>();
private static AudioContext audioctx = null;
private static GainNode masterVolumeNode = null;
private static GainNode musicVolumeNode = null;
@@ -2101,7 +2098,7 @@ public class EaglerAdapterImpl2 {
});
}
- private static final HashMap activeSoundEffects = new HashMap();
+ private static final HashMap activeSoundEffects = new HashMap<>();
private static class AudioBufferX {
private final AudioBuffer buffer;
@@ -2147,7 +2144,7 @@ public class EaglerAdapterImpl2 {
if(ret == null) {
byte[] file = loadResourceBytes(fileName);
if(file == null) return null;
- Uint8Array buf = Uint8Array.create(file.length);
+ Uint8Array buf = new Uint8Array(file.length);
buf.set(file);
ret = new AudioBufferX(decodeAudioAsync(buf.getBuffer()));
loadedSoundFiles.put(fileName, ret);
@@ -2662,8 +2659,8 @@ public class EaglerAdapterImpl2 {
return volumeSpeak;
}
- private static final Set mutedSet = new HashSet();
- private static final Set speakingSet = new HashSet();
+ private static final Set mutedSet = new HashSet<>();
+ private static final Set speakingSet = new HashSet<>();
public static final Set getVoiceListening() {
return voiceGains.keySet();
}
@@ -2690,7 +2687,7 @@ public class EaglerAdapterImpl2 {
speakingSet.clear();
for (String username : voiceAnalysers.keySet()) {
AnalyserNode analyser = voiceAnalysers.get(username);
- Uint8Array array = Uint8Array.create(analyser.getFrequencyBinCount());
+ Uint8Array array = new Uint8Array(analyser.getFrequencyBinCount());
analyser.getByteFrequencyData(array);
int len = array.getLength();
for (int i = 0; i < len; i++) {
@@ -2777,11 +2774,11 @@ public class EaglerAdapterImpl2 {
}
public static final Object _wCreateLowLevelIntBuffer(int len) {
- return Int32Array.create(len);
+ return new Int32Array(len);
}
private static int appendbufferindex = 0;
- private static Int32Array appendbuffer = Int32Array.create(ArrayBuffer.create(525000*4));
+ private static Int32Array appendbuffer = new Int32Array(new ArrayBuffer(525000*4));
public static final void _wAppendLowLevelBuffer(Object arr) {
Int32Array a = ((Int32Array)arr);
@@ -2792,7 +2789,7 @@ public class EaglerAdapterImpl2 {
}
public static final Object _wGetLowLevelBuffersAppended() {
- Int32Array ret = Int32Array.create(appendbuffer.getBuffer(), 0, appendbufferindex);
+ Int32Array ret = new Int32Array(appendbuffer.getBuffer(), 0, appendbufferindex);
appendbufferindex = 0;
return ret;
}
@@ -2810,7 +2807,7 @@ public class EaglerAdapterImpl2 {
public void onMessage(String channel, ArrayBuffer buf);
}
- private static final HashMap> workerMessageQueue = new HashMap();
+ private static final HashMap> workerMessageQueue = new HashMap<>();
private static Worker server = null;
private static boolean serverAlive = false;
@@ -2837,7 +2834,7 @@ public class EaglerAdapterImpl2 {
return;
}
- Uint8Array a = Uint8Array.create(buf);
+ Uint8Array a = new Uint8Array(buf);
byte[] pkt = new byte[a.getLength()];
for(int i = 0; i < pkt.length; ++i) {
pkt[i] = (byte) a.get(i);
@@ -2865,7 +2862,7 @@ public class EaglerAdapterImpl2 {
server.terminate();
}
workerMessageQueue.put("IPC", new LinkedList());
- server = Worker.create(integratedServerScript);
+ server = new Worker(integratedServerScript);
server.onError(new EventListener() {
@Override
public void handleEvent(ErrorEvent evt) {
@@ -2893,8 +2890,8 @@ public class EaglerAdapterImpl2 {
}
public static final void sendToIntegratedServer(String channel, byte[] pkt) {
- ArrayBuffer arb = ArrayBuffer.create(pkt.length);
- Uint8Array ar = Uint8Array.create(arb);
+ ArrayBuffer arb = new ArrayBuffer(pkt.length);
+ Uint8Array ar = new Uint8Array(arb);
ar.set(pkt);
sendWorkerPacket(server, channel, arb);
//System.out.println("[Client][WRITE][" + channel + "]: " + pkt.length);
@@ -2906,7 +2903,7 @@ public class EaglerAdapterImpl2 {
System.err.println("Tried to enable existing channel '" + channel + "' again");
}else {
System.out.println("[Client][ENABLE][" + channel + "]");
- workerMessageQueue.put(channel, new LinkedList());
+ workerMessageQueue.put(channel, new LinkedList<>());
}
}
}
@@ -2940,8 +2937,8 @@ public class EaglerAdapterImpl2 {
private static final native void downloadBytesImpl(String str, ArrayBuffer buf);
public static final void downloadBytes(String str, byte[] dat) {
- ArrayBuffer d = ArrayBuffer.create(dat.length);
- Uint8Array.create(d).set(dat);
+ ArrayBuffer d = new ArrayBuffer(dat.length);
+ (new Uint8Array(d)).set(dat);
downloadBytesImpl(str, d);
}
@@ -2956,11 +2953,11 @@ public class EaglerAdapterImpl2 {
public static native String getClipboard();
private static void getClipboard(final AsyncCallback cb) {
- final long start = System.currentTimeMillis();
+ final long start = steadyTimeMillis();
getClipboard0(new StupidFunctionResolveString() {
@Override
public void resolveStr(String s) {
- if(System.currentTimeMillis() - start > 500l) {
+ if(steadyTimeMillis() - start > 500l) {
unpressCTRL = true;
}
cb.complete(s);
@@ -2979,8 +2976,8 @@ public class EaglerAdapterImpl2 {
private static class ServerQueryImpl implements ServerQuery {
- private final LinkedList queryResponses = new LinkedList();
- private final LinkedList queryResponsesBytes = new LinkedList();
+ private final LinkedList queryResponses = new LinkedList<>();
+ private final LinkedList queryResponsesBytes = new LinkedList<>();
private final String type;
private boolean open;
private boolean alive;
@@ -2998,7 +2995,7 @@ public class EaglerAdapterImpl2 {
pingTimer = -1l;
WebSocket s = null;
try {
- s = WebSocket.create(uri);
+ s = new WebSocket(uri);
s.setBinaryType("arraybuffer");
open = true;
}catch(Throwable t) {
@@ -3013,14 +3010,14 @@ public class EaglerAdapterImpl2 {
}
sock = s;
if(open) {
- sock.onOpen(new EventListener() {
+ sock.addEventListener("open", new EventListener() {
@Override
- public void handleEvent(MessageEvent evt) {
- pingStart = System.currentTimeMillis();
+ public void handleEvent(Event evt) {
+ pingStart = steadyTimeMillis();
sock.send("Accept: " + type);
}
});
- sock.onClose(new EventListener() {
+ sock.addEventListener("close", new EventListener() {
@Override
public void handleEvent(CloseEvent evt) {
open = false;
@@ -3033,12 +3030,12 @@ public class EaglerAdapterImpl2 {
}
}
});
- sock.onMessage(new EventListener() {
+ sock.addEventListener("message", new EventListener() {
@Override
public void handleEvent(MessageEvent evt) {
alive = true;
if(pingTimer == -1) {
- pingTimer = System.currentTimeMillis() - pingStart;
+ pingTimer = steadyTimeMillis() - pingStart;
}
if(isString(evt.getData())) {
try {
@@ -3069,7 +3066,7 @@ public class EaglerAdapterImpl2 {
System.err.println("Query response could not be parsed: " + t.toString());
}
}else {
- Uint8Array a = Uint8Array.create(evt.getDataAsArray());
+ Uint8Array a = new Uint8Array(evt.getDataAsArray());
byte[] b = new byte[a.getByteLength()];
for(int i = 0; i < b.length; ++i) {
b[i] = (byte) (a.get(i) & 0xFF);
@@ -3153,9 +3150,9 @@ public class EaglerAdapterImpl2 {
int checkIntegerA = 0xFF000000;
int checkIntegerB = 0x000000FF;
- ArrayBuffer buf = ArrayBuffer.create(4);
- Int32Array bufW = Int32Array.create(buf);
- Uint8Array bufR = Uint8Array.create(buf);
+ ArrayBuffer buf = new ArrayBuffer(4);
+ Int32Array bufW = new Int32Array(buf);
+ Uint8Array bufR = new Uint8Array(buf);
bufW.set(0, checkIntegerA);
@@ -3204,13 +3201,13 @@ public class EaglerAdapterImpl2 {
}
private static final ArrayBuffer convertToArrayBuffer(byte[] arr) {
- Uint8Array buf = Uint8Array.create(arr.length);
+ Uint8Array buf = new Uint8Array(arr.length);
buf.set(arr);
return buf.getBuffer();
}
- private static final Map relayQueryLimited = new HashMap();
- private static final Map relayQueryBlocked = new HashMap();
+ private static final Map relayQueryLimited = new HashMap<>();
+ private static final Map relayQueryBlocked = new HashMap<>();
private static class RelayQueryImpl implements RelayQuery {
@@ -3238,8 +3235,8 @@ public class EaglerAdapterImpl2 {
this.uri = uri;
WebSocket s = null;
try {
- connectionOpenedAt = System.currentTimeMillis();
- s = WebSocket.create(uri);
+ connectionOpenedAt = steadyTimeMillis();
+ s = new WebSocket(uri);
s.setBinaryType("arraybuffer");
open = true;
failed = false;
@@ -3251,11 +3248,11 @@ public class EaglerAdapterImpl2 {
return;
}
sock = s;
- sock.onOpen(new EventListener() {
+ sock.addEventListener("open", new EventListener() {
@Override
- public void handleEvent(MessageEvent evt) {
+ public void handleEvent(Event evt) {
try {
- connectionPingStart = System.currentTimeMillis();
+ connectionPingStart = steadyTimeMillis();
nativeBinarySend(sock, convertToArrayBuffer(
IPacket.writePacket(new IPacket00Handshake(0x03, IntegratedServer.preferredRelayVersion, ""))
));
@@ -3266,18 +3263,18 @@ public class EaglerAdapterImpl2 {
}
}
});
- sock.onMessage(new EventListener() {
+ sock.addEventListener("message", new EventListener() {
@Override
public void handleEvent(MessageEvent evt) {
if(evt.getData() != null && !isString(evt.getData())) {
hasRecievedAnyData = true;
- Uint8Array buf = Uint8Array.create(evt.getDataAsArray());
+ Uint8Array buf = new Uint8Array(evt.getDataAsArray());
byte[] arr = new byte[buf.getLength()];
for(int i = 0; i < arr.length; ++i) {
arr[i] = (byte)buf.get(i);
}
if(arr.length == 2 && arr[0] == (byte)0xFC) {
- long millis = System.currentTimeMillis();
+ long millis = steadyTimeMillis();
if(arr[1] == (byte)0x00 || arr[1] == (byte)0x01) {
rateLimitStatus = RateLimit.BLOCKED;
relayQueryLimited.put(RelayQueryImpl.this.uri, millis);
@@ -3300,7 +3297,7 @@ public class EaglerAdapterImpl2 {
IPacket69Pong ipkt = (IPacket69Pong)pkt;
versError = RelayQuery.VersionMismatch.COMPATIBLE;
if(connectionPingTimer == -1) {
- connectionPingTimer = System.currentTimeMillis() - connectionPingStart;
+ connectionPingTimer = steadyTimeMillis() - connectionPingStart;
}
vers = ipkt.protcolVersion;
comment = ipkt.comment;
@@ -3340,7 +3337,7 @@ public class EaglerAdapterImpl2 {
}
}
});
- sock.onClose(new EventListener() {
+ sock.addEventListener("close", new EventListener() {
@Override
public void handleEvent(CloseEvent evt) {
open = false;
@@ -3348,14 +3345,14 @@ public class EaglerAdapterImpl2 {
failed = true;
Long l = relayQueryBlocked.get(uri);
if(l != null) {
- if(System.currentTimeMillis() - l.longValue() < 400000l) {
+ if(steadyTimeMillis() - l.longValue() < 400000l) {
rateLimitStatus = RateLimit.LOCKED;
return;
}
}
l = relayQueryLimited.get(uri);
if(l != null) {
- if(System.currentTimeMillis() - l.longValue() < 900000l) {
+ if(steadyTimeMillis() - l.longValue() < 900000l) {
rateLimitStatus = RateLimit.BLOCKED;
return;
}
@@ -3470,7 +3467,7 @@ public class EaglerAdapterImpl2 {
}
public static final RelayQuery openRelayQuery(String addr) {
- long millis = System.currentTimeMillis();
+ long millis = steadyTimeMillis();
Long l = relayQueryBlocked.get(addr);
if(l != null && millis - l.longValue() < 60000l) {
@@ -3504,7 +3501,7 @@ public class EaglerAdapterImpl2 {
this.uri = uri;
WebSocket s = null;
try {
- s = WebSocket.create(uri);
+ s = new WebSocket(uri);
s.setBinaryType("arraybuffer");
open = true;
failed = false;
@@ -3515,9 +3512,9 @@ public class EaglerAdapterImpl2 {
return;
}
sock = s;
- sock.onOpen(new EventListener() {
+ sock.addEventListener("open", new EventListener() {
@Override
- public void handleEvent(MessageEvent evt) {
+ public void handleEvent(Event evt) {
try {
nativeBinarySend(sock, convertToArrayBuffer(
IPacket.writePacket(new IPacket00Handshake(0x04, IntegratedServer.preferredRelayVersion, ""))
@@ -3530,18 +3527,18 @@ public class EaglerAdapterImpl2 {
}
}
});
- sock.onMessage(new EventListener() {
+ sock.addEventListener("message", new EventListener() {
@Override
public void handleEvent(MessageEvent evt) {
if(evt.getData() != null && !isString(evt.getData())) {
hasRecievedAnyData = true;
- Uint8Array buf = Uint8Array.create(evt.getDataAsArray());
+ Uint8Array buf = new Uint8Array(evt.getDataAsArray());
byte[] arr = new byte[buf.getLength()];
for(int i = 0; i < arr.length; ++i) {
arr[i] = (byte)buf.get(i);
}
if(arr.length == 2 && arr[0] == (byte)0xFC) {
- long millis = System.currentTimeMillis();
+ long millis = steadyTimeMillis();
if(arr[1] == (byte)0x00 || arr[1] == (byte)0x01) {
rateLimitStatus = RateLimit.BLOCKED;
relayQueryLimited.put(RelayWorldsQueryImpl.this.uri, millis);
@@ -3597,7 +3594,7 @@ public class EaglerAdapterImpl2 {
}
}
});
- sock.onClose(new EventListener() {
+ sock.addEventListener("close", new EventListener() {
@Override
public void handleEvent(CloseEvent evt) {
open = false;
@@ -3605,14 +3602,14 @@ public class EaglerAdapterImpl2 {
failed = true;
Long l = relayQueryBlocked.get(uri);
if(l != null) {
- if(System.currentTimeMillis() - l.longValue() < 400000l) {
+ if(steadyTimeMillis() - l.longValue() < 400000l) {
rateLimitStatus = RateLimit.LOCKED;
return;
}
}
l = relayQueryLimited.get(uri);
if(l != null) {
- if(System.currentTimeMillis() - l.longValue() < 900000l) {
+ if(steadyTimeMillis() - l.longValue() < 900000l) {
rateLimitStatus = RateLimit.BLOCKED;
return;
}
@@ -3686,7 +3683,7 @@ public class EaglerAdapterImpl2 {
@Override
public List getWorlds() {
- return new ArrayList(0);
+ return new ArrayList<>(0);
}
@Override
@@ -3696,7 +3693,7 @@ public class EaglerAdapterImpl2 {
}
public static final RelayWorldsQuery openRelayWorldsQuery(String addr) {
- long millis = System.currentTimeMillis();
+ long millis = steadyTimeMillis();
Long l = relayQueryBlocked.get(addr);
if(l != null && millis - l.longValue() < 60000l) {
@@ -3722,14 +3719,14 @@ public class EaglerAdapterImpl2 {
private boolean hasRecievedAnyData;
- private final List exceptions = new LinkedList();
- private final List packets = new LinkedList();
+ private final List exceptions = new LinkedList<>();
+ private final List packets = new LinkedList<>();
private RelayServerSocketImpl(String uri, int timeout) {
this.uri = uri;
WebSocket s = null;
try {
- s = WebSocket.create(uri);
+ s = new WebSocket(uri);
s.setBinaryType("arraybuffer");
open = false;
closed = false;
@@ -3743,18 +3740,18 @@ public class EaglerAdapterImpl2 {
return;
}
sock = s;
- sock.onOpen(new EventListener() {
+ sock.addEventListener("open", new EventListener() {
@Override
- public void handleEvent(MessageEvent evt) {
+ public void handleEvent(Event evt) {
open = true;
}
});
- sock.onMessage(new EventListener() {
+ sock.addEventListener("message", new EventListener() {
@Override
public void handleEvent(MessageEvent evt) {
if(evt.getData() != null && !isString(evt.getData())) {
hasRecievedAnyData = true;
- Uint8Array buf = Uint8Array.create(evt.getDataAsArray());
+ Uint8Array buf = new Uint8Array(evt.getDataAsArray());
byte[] arr = new byte[buf.getLength()];
for(int i = 0; i < arr.length; ++i) {
arr[i] = (byte)buf.get(i);
@@ -3773,7 +3770,7 @@ public class EaglerAdapterImpl2 {
}
}
});
- sock.onClose(new EventListener() {
+ sock.addEventListener("close", new EventListener() {
@Override
public void handleEvent(CloseEvent evt) {
if(!hasRecievedAnyData) {
@@ -3939,7 +3936,7 @@ public class EaglerAdapterImpl2 {
}
public static final RelayServerSocket openRelayConnection(String addr, int timeout) {
- long millis = System.currentTimeMillis();
+ long millis = steadyTimeMillis();
Long l = relayQueryBlocked.get(addr);
if(l != null && millis - l.longValue() < 60000l) {
@@ -4012,7 +4009,7 @@ public class EaglerAdapterImpl2 {
rtcLANClient.setRemotePacketHandler(new EaglercraftLANClient.RemotePacketHandler() {
@Override
public void call(ArrayBuffer buffer) {
- Uint8Array array = Uint8Array.create(buffer);
+ Uint8Array array = new Uint8Array(buffer);
byte[] ret = new byte[array.getByteLength()];
for(int i = 0; i < ret.length; ++i) {
ret[i] = (byte) array.get(i);
@@ -4122,7 +4119,7 @@ public class EaglerAdapterImpl2 {
rtcLANServer.setRemoteClientPacketHandler(new EaglercraftLANServer.PeerPacketHandler() {
@Override
public void call(String peerId, ArrayBuffer buffer) {
- Uint8Array array = Uint8Array.create(buffer);
+ Uint8Array array = new Uint8Array(buffer);
byte[] ret = new byte[array.getByteLength()];
for(int i = 0; i < ret.length; ++i) {
ret[i] = (byte) array.get(i);
@@ -4167,16 +4164,16 @@ public class EaglerAdapterImpl2 {
byte[] fragData = new byte[((i + fragmentSize > data.length) ? (data.length % fragmentSize) : fragmentSize) + 1];
System.arraycopy(data, i, fragData, 1, fragData.length - 1);
fragData[0] = (i + fragmentSize < data.length) ? (byte) 1 : (byte) 0;
- ArrayBuffer arr = ArrayBuffer.create(fragData.length);
- Uint8Array.create(arr).set(fragData);
+ ArrayBuffer arr = new ArrayBuffer(fragData.length);
+ (new Uint8Array(arr)).set(fragData);
rtcLANServer.sendPacketToRemoteClient(peer, arr);
}
} else {
byte[] sendData = new byte[data.length + 1];
sendData[0] = 0;
System.arraycopy(data, 0, sendData, 1, data.length);
- ArrayBuffer arr = ArrayBuffer.create(sendData.length);
- Uint8Array.create(arr).set(sendData);
+ ArrayBuffer arr = new ArrayBuffer(sendData.length);
+ (new Uint8Array(arr)).set(sendData);
rtcLANServer.sendPacketToRemoteClient(peer, arr);
}
}
@@ -4200,5 +4197,41 @@ public class EaglerAdapterImpl2 {
public static final int countPeers() {
return rtcLANServer.countPeers();
}
-
+
+ private static final JSObject steadyTimeFunc = getSteadyTimeFunc();
+
+ @JSBody(params = { }, script = "return ((typeof performance !== \"undefined\") && (typeof performance.now === \"function\"))"
+ + "? performance.now.bind(performance)"
+ + ": (function(epochStart){ return function() { return Date.now() - epochStart; }; })(Date.now());")
+ private static native JSObject getSteadyTimeFunc();
+
+ @JSBody(params = { "steadyTimeFunc" }, script = "return steadyTimeFunc();")
+ private static native double steadyTimeMillis0(JSObject steadyTimeFunc);
+
+ public static long steadyTimeMillis() {
+ return (long)steadyTimeMillis0(steadyTimeFunc);
+ }
+
+ public static long nanoTime() {
+ return (long)(steadyTimeMillis0(steadyTimeFunc) * 1000000.0);
+ }
+
+ @Async
+ public static native void sleep(int millis);
+
+ private static void sleep(int millis, final AsyncCallback callback) {
+ Platform.schedule(new DumbSleepHandler(callback), millis);
+ }
+
+ private static class DumbSleepHandler implements PlatformRunnable {
+ private final AsyncCallback callback;
+ private DumbSleepHandler(AsyncCallback callback) {
+ this.callback = callback;
+ }
+ @Override
+ public void run() {
+ callback.complete(null);
+ }
+ }
+
}
diff --git a/src/teavm/java/net/lax1dude/eaglercraft/adapter/SimpleStorage.java b/src/teavm/java/net/lax1dude/eaglercraft/adapter/SimpleStorage.java
index d294f46..7ecd0a4 100644
--- a/src/teavm/java/net/lax1dude/eaglercraft/adapter/SimpleStorage.java
+++ b/src/teavm/java/net/lax1dude/eaglercraft/adapter/SimpleStorage.java
@@ -3,16 +3,15 @@ package net.lax1dude.eaglercraft.adapter;
import org.teavm.interop.Async;
import org.teavm.interop.AsyncCallback;
import org.teavm.jso.core.JSString;
+import org.teavm.jso.indexeddb.IDBDatabase;
+import org.teavm.jso.indexeddb.IDBFactory;
+import org.teavm.jso.indexeddb.IDBGetRequest;
+import org.teavm.jso.indexeddb.IDBObjectStore;
+import org.teavm.jso.indexeddb.IDBOpenDBRequest;
+import org.teavm.jso.indexeddb.IDBRequest;
import org.teavm.jso.typedarrays.ArrayBuffer;
import org.teavm.jso.typedarrays.Uint8Array;
-import net.lax1dude.eaglercraft.adapter.teavm.IDBDatabase;
-import net.lax1dude.eaglercraft.adapter.teavm.IDBFactory;
-import net.lax1dude.eaglercraft.adapter.teavm.IDBGetRequest;
-import net.lax1dude.eaglercraft.adapter.teavm.IDBObjectStore;
-import net.lax1dude.eaglercraft.adapter.teavm.IDBOpenDBRequest;
-import net.lax1dude.eaglercraft.adapter.teavm.IDBRequest;
-
public class SimpleStorage {
private static IDBDatabase database;
private static boolean available;
@@ -51,7 +50,7 @@ public class SimpleStorage {
}
IDBGetRequest request = getStore().get(JSString.valueOf(key));
request.setOnSuccess(() -> {
- Uint8Array a = Uint8Array.create((ArrayBuffer) request.getResult().cast());
+ Uint8Array a = new Uint8Array((ArrayBuffer) request.getResult().cast());
byte[] b = new byte[a.getByteLength()];
for(int i = 0; i < b.length; ++i) {
b[i] = (byte) (a.get(i) & 0xFF);
@@ -119,8 +118,8 @@ public class SimpleStorage {
});
});
} else {
- ArrayBuffer arr = ArrayBuffer.create(value.length);
- Uint8Array.create(arr).set(value);
+ ArrayBuffer arr = new ArrayBuffer(value.length);
+ (new Uint8Array(arr)).set(value);
IDBRequest request2 = getStore().put(arr, JSString.valueOf(key));
request2.setOnSuccess(() -> {
IDBGetRequest request3 = getStore().get(JSString.valueOf("__LIST__"));
diff --git a/src/teavm/java/net/lax1dude/eaglercraft/adapter/Tessellator.java b/src/teavm/java/net/lax1dude/eaglercraft/adapter/Tessellator.java
index d791fe2..88ffd0a 100644
--- a/src/teavm/java/net/lax1dude/eaglercraft/adapter/Tessellator.java
+++ b/src/teavm/java/net/lax1dude/eaglercraft/adapter/Tessellator.java
@@ -93,9 +93,9 @@ public class Tessellator {
private Tessellator(int par1) {
this.bufferSize = par1;
- ArrayBuffer a = ArrayBuffer.create(par1 * 4);
- this.intBuffer = Int32Array.create(a);
- this.floatBuffer = Float32Array.create(a);
+ ArrayBuffer a = new ArrayBuffer(par1 * 4);
+ this.intBuffer = new Int32Array(a);
+ this.floatBuffer = new Float32Array(a);
}
/**
@@ -128,7 +128,7 @@ public class Tessellator {
EaglerAdapter.glClientActiveTexture(EaglerAdapter.GL_TEXTURE0);
}
- EaglerAdapter.glDrawArrays(this.drawMode, 0, this.vertexCount, Int32Array.create(intBuffer.getBuffer(), 0, this.vertexCount * 8));
+ EaglerAdapter.glDrawArrays(this.drawMode, 0, this.vertexCount, new Int32Array(intBuffer.getBuffer(), 0, this.vertexCount * 8));
if (this.hasTexture) {
EaglerAdapter.glDisableVertexAttrib(EaglerAdapter.GL_TEXTURE_COORD_ARRAY);
diff --git a/src/teavm/java/net/lax1dude/eaglercraft/adapter/teavm/EventHandler.java b/src/teavm/java/net/lax1dude/eaglercraft/adapter/teavm/EventHandler.java
deleted file mode 100644
index 856b834..0000000
--- a/src/teavm/java/net/lax1dude/eaglercraft/adapter/teavm/EventHandler.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright 2015 Alexey Andreev.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.lax1dude.eaglercraft.adapter.teavm;
-
-import org.teavm.jso.JSFunctor;
-import org.teavm.jso.JSObject;
-
-@JSFunctor
-public interface EventHandler extends JSObject {
- void handleEvent();
-}
diff --git a/src/teavm/java/net/lax1dude/eaglercraft/adapter/teavm/IDBCountRequest.java b/src/teavm/java/net/lax1dude/eaglercraft/adapter/teavm/IDBCountRequest.java
deleted file mode 100644
index 9c0cb98..0000000
--- a/src/teavm/java/net/lax1dude/eaglercraft/adapter/teavm/IDBCountRequest.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Copyright 2015 Alexey Andreev.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.lax1dude.eaglercraft.adapter.teavm;
-
-import org.teavm.jso.JSProperty;
-
-public interface IDBCountRequest extends IDBRequest {
- @JSProperty
- int getResult();
-}
diff --git a/src/teavm/java/net/lax1dude/eaglercraft/adapter/teavm/IDBCursor.java b/src/teavm/java/net/lax1dude/eaglercraft/adapter/teavm/IDBCursor.java
deleted file mode 100644
index 42ecb90..0000000
--- a/src/teavm/java/net/lax1dude/eaglercraft/adapter/teavm/IDBCursor.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright 2015 Alexey Andreev.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.lax1dude.eaglercraft.adapter.teavm;
-
-import org.teavm.jso.JSMethod;
-import org.teavm.jso.JSObject;
-import org.teavm.jso.JSProperty;
-
-public interface IDBCursor extends JSObject {
- String DIRECTION_NEXT = "next";
-
- String DIRECTION_NEXT_UNIQUE = "nextunique";
-
- String DIRECTION_PREVIOUS = "prev";
-
- String DIRECTION_PREVIOUS_UNIQUE = "prevunique";
-
- @JSProperty
- IDBCursorSource getSource();
-
- @JSProperty
- String getDirection();
-
- @JSProperty
- JSObject getKey();
-
- @JSProperty
- JSObject getValue();
-
- @JSProperty
- JSObject getPrimaryKey();
-
- IDBRequest update(JSObject value);
-
- void advance(int count);
-
- @JSMethod("continue")
- void doContinue();
-
- IDBRequest delete();
-}
diff --git a/src/teavm/java/net/lax1dude/eaglercraft/adapter/teavm/IDBCursorRequest.java b/src/teavm/java/net/lax1dude/eaglercraft/adapter/teavm/IDBCursorRequest.java
deleted file mode 100644
index d134d42..0000000
--- a/src/teavm/java/net/lax1dude/eaglercraft/adapter/teavm/IDBCursorRequest.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Copyright 2015 Alexey Andreev.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.lax1dude.eaglercraft.adapter.teavm;
-
-import org.teavm.jso.JSProperty;
-
-public interface IDBCursorRequest extends IDBRequest {
- @JSProperty
- IDBCursor getResult();
-}
diff --git a/src/teavm/java/net/lax1dude/eaglercraft/adapter/teavm/IDBCursorSource.java b/src/teavm/java/net/lax1dude/eaglercraft/adapter/teavm/IDBCursorSource.java
deleted file mode 100644
index 6f36503..0000000
--- a/src/teavm/java/net/lax1dude/eaglercraft/adapter/teavm/IDBCursorSource.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Copyright 2015 Alexey Andreev.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.lax1dude.eaglercraft.adapter.teavm;
-
-import org.teavm.jso.JSObject;
-
-public interface IDBCursorSource extends JSObject {
-}
diff --git a/src/teavm/java/net/lax1dude/eaglercraft/adapter/teavm/IDBDatabase.java b/src/teavm/java/net/lax1dude/eaglercraft/adapter/teavm/IDBDatabase.java
deleted file mode 100644
index b1f671e..0000000
--- a/src/teavm/java/net/lax1dude/eaglercraft/adapter/teavm/IDBDatabase.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright 2015 Alexey Andreev.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.lax1dude.eaglercraft.adapter.teavm;
-
-import org.teavm.jso.JSProperty;
-import org.teavm.jso.dom.events.EventTarget;
-
-public interface IDBDatabase extends EventTarget {
- String TRANSACTION_READONLY = "readonly";
-
- String TRANSACTION_READWRITE = "readwrite";
-
- String TRANSACTION_VERSIONCHANGE = "versionchange";
-
- @JSProperty
- String getName();
-
- @JSProperty
- int getVersion();
-
- @JSProperty
- String[] getObjectStoreNames();
-
- net.lax1dude.eaglercraft.adapter.teavm.IDBObjectStore createObjectStore(String name,
- IDBObjectStoreParameters optionalParameters);
-
- IDBObjectStore createObjectStore(String name);
-
- void deleteObjectStore(String name);
-
- IDBTransaction transaction(String storeName, String transactionMode);
-
- IDBTransaction transaction(String storeName);
-
- IDBTransaction transaction(String[] storeNames, String transactionMode);
-
- IDBTransaction transaction(String[] storeNames);
-
- void close();
-
- @JSProperty("onabort")
- void setOnAbort(net.lax1dude.eaglercraft.adapter.teavm.EventHandler handler);
-
- @JSProperty("onerror")
- void setOnError(net.lax1dude.eaglercraft.adapter.teavm.EventHandler handler);
-
- @JSProperty("onversionchange")
- void setOnVersionChange(EventHandler handler);
-}
diff --git a/src/teavm/java/net/lax1dude/eaglercraft/adapter/teavm/IDBError.java b/src/teavm/java/net/lax1dude/eaglercraft/adapter/teavm/IDBError.java
deleted file mode 100644
index 3ae0afd..0000000
--- a/src/teavm/java/net/lax1dude/eaglercraft/adapter/teavm/IDBError.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright 2015 Alexey Andreev.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.lax1dude.eaglercraft.adapter.teavm;
-
-import org.teavm.jso.JSObject;
-import org.teavm.jso.JSProperty;
-
-public abstract class IDBError implements JSObject {
- @JSProperty
- public abstract String getName();
-}
diff --git a/src/teavm/java/net/lax1dude/eaglercraft/adapter/teavm/IDBFactory.java b/src/teavm/java/net/lax1dude/eaglercraft/adapter/teavm/IDBFactory.java
deleted file mode 100644
index 29d8bf2..0000000
--- a/src/teavm/java/net/lax1dude/eaglercraft/adapter/teavm/IDBFactory.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright 2015 Alexey Andreev.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.lax1dude.eaglercraft.adapter.teavm;
-
-import org.teavm.jso.JSBody;
-import org.teavm.jso.JSObject;
-
-public abstract class IDBFactory implements JSObject {
- public static boolean isSupported() {
- return !getInstanceImpl().isUndefined();
- }
-
- @JSBody(script = "return typeof this === 'undefined';")
- private native boolean isUndefined();
-
- public static IDBFactory getInstance() {
- IDBFactory factory = getInstanceImpl();
- if (factory.isUndefined()) {
- throw new IllegalStateException("IndexedDB is not supported in this browser");
- }
- return factory;
- }
-
- @JSBody(script = "return window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || "
- + "window.msIndexedDB;")
- static native IDBFactory getInstanceImpl();
-
- public abstract IDBOpenDBRequest open(String name, int version);
-
- public abstract IDBOpenDBRequest deleteDatabase(String name);
-
- public abstract int cmp(JSObject a, JSObject b);
-}
diff --git a/src/teavm/java/net/lax1dude/eaglercraft/adapter/teavm/IDBGetRequest.java b/src/teavm/java/net/lax1dude/eaglercraft/adapter/teavm/IDBGetRequest.java
deleted file mode 100644
index 0590aa7..0000000
--- a/src/teavm/java/net/lax1dude/eaglercraft/adapter/teavm/IDBGetRequest.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright 2015 Alexey Andreev.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.lax1dude.eaglercraft.adapter.teavm;
-
-import org.teavm.jso.JSObject;
-import org.teavm.jso.JSProperty;
-
-public interface IDBGetRequest extends IDBRequest {
- @JSProperty
- JSObject getResult();
-}
diff --git a/src/teavm/java/net/lax1dude/eaglercraft/adapter/teavm/IDBIndex.java b/src/teavm/java/net/lax1dude/eaglercraft/adapter/teavm/IDBIndex.java
deleted file mode 100644
index a9a880d..0000000
--- a/src/teavm/java/net/lax1dude/eaglercraft/adapter/teavm/IDBIndex.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright 2015 Alexey Andreev.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.lax1dude.eaglercraft.adapter.teavm;
-
-import org.teavm.jso.JSBody;
-import org.teavm.jso.JSObject;
-import org.teavm.jso.JSProperty;
-import org.teavm.jso.core.JSString;
-
-public abstract class IDBIndex implements JSObject, IDBCursorSource {
- @JSProperty
- public abstract String getName();
-
- @JSProperty("keyPath")
- abstract JSObject getKeyPathImpl();
-
- public final String[] getKeyPath() {
- JSObject result = getKeyPathImpl();
- if (JSString.isInstance(result)) {
- return new String[] { result.cast().stringValue() };
- } else {
- return unwrapStringArray(result);
- }
- }
-
- @JSBody(script = "return this;")
- private native String[] unwrapStringArray(JSObject obj);
-
- @JSProperty
- public abstract boolean isMultiEntry();
-
- @JSProperty
- public abstract boolean isUnique();
-
- public abstract IDBCursorRequest openCursor();
-
- public abstract IDBCursorRequest openCursor(IDBKeyRange range);
-
- public abstract IDBCursorRequest openKeyCursor();
-
- public abstract IDBGetRequest get(JSObject key);
-
- public abstract IDBGetRequest getKey(JSObject key);
-
- public abstract IDBCountRequest count(JSObject key);
-
- public abstract IDBCountRequest count();
-}
diff --git a/src/teavm/java/net/lax1dude/eaglercraft/adapter/teavm/IDBKeyRange.java b/src/teavm/java/net/lax1dude/eaglercraft/adapter/teavm/IDBKeyRange.java
deleted file mode 100644
index 8028487..0000000
--- a/src/teavm/java/net/lax1dude/eaglercraft/adapter/teavm/IDBKeyRange.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright 2015 Alexey Andreev.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.lax1dude.eaglercraft.adapter.teavm;
-
-import org.teavm.jso.JSBody;
-import org.teavm.jso.JSObject;
-import org.teavm.jso.JSProperty;
-
-public abstract class IDBKeyRange implements JSObject {
- @JSProperty
- public abstract JSObject getLower();
-
- @JSProperty
- public abstract JSObject getUpper();
-
- @JSProperty
- public abstract boolean isLowerOpen();
-
- @JSProperty
- public abstract boolean isUpperOpen();
-
- @JSBody(params = "value", script = "return IDBKeyRange.only(value);")
- public static native IDBKeyRange only(JSObject value);
-
- @JSBody(params = { "lower", "open" }, script = "return IDBKeyRange.lowerBound(lower, open);")
- public static native IDBKeyRange lowerBound(JSObject lower, boolean open);
-
- public static IDBKeyRange lowerBound(JSObject lower) {
- return lowerBound(lower, false);
- }
-
- @JSBody(params = { "upper", "open" }, script = "return IDBKeyRange.upperBound(upper, open);")
- public static native IDBKeyRange upperBound(JSObject upper, boolean open);
-
- public static IDBKeyRange upperBound(JSObject upper) {
- return upperBound(upper, false);
- }
-
- @JSBody(params = { "lower", "upper", "lowerOpen",
- "upperOpen" }, script = "return IDBKeyRange.bound(lower, upper, lowerOpen, upperOpen);")
- public static native IDBKeyRange bound(JSObject lower, JSObject upper, boolean lowerOpen, boolean upperOpen);
-
- public static IDBKeyRange bound(JSObject lower, JSObject upper) {
- return bound(lower, upper, false, false);
- }
-}
diff --git a/src/teavm/java/net/lax1dude/eaglercraft/adapter/teavm/IDBObjectStore.java b/src/teavm/java/net/lax1dude/eaglercraft/adapter/teavm/IDBObjectStore.java
deleted file mode 100644
index 62848bf..0000000
--- a/src/teavm/java/net/lax1dude/eaglercraft/adapter/teavm/IDBObjectStore.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright 2015 Alexey Andreev.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.lax1dude.eaglercraft.adapter.teavm;
-
-import org.teavm.jso.JSBody;
-import org.teavm.jso.JSObject;
-import org.teavm.jso.JSProperty;
-import org.teavm.jso.core.JSString;
-
-public abstract class IDBObjectStore implements JSObject, IDBCursorSource {
- @JSProperty
- public abstract String getName();
-
- @JSProperty("keyPath")
- abstract JSObject getKeyPathImpl();
-
- public final String[] getKeyPath() {
- JSObject result = getKeyPathImpl();
- if (JSString.isInstance(result)) {
- return new String[] { result.cast().stringValue() };
- } else {
- return unwrapStringArray(result);
- }
- }
-
- @JSBody(params = { "arr" }, script = "return arr;")
- private native String[] unwrapStringArray(JSObject obj);
-
- @JSProperty
- public abstract String[] getIndexNames();
-
- @JSProperty
- public abstract boolean isAutoIncrement();
-
- public abstract IDBRequest put(JSObject value, JSObject key);
-
- public abstract IDBRequest put(JSObject value);
-
- public abstract IDBRequest add(JSObject value, JSObject key);
-
- public abstract IDBRequest add(JSObject value);
-
- public abstract IDBRequest delete(JSObject key);
-
- public abstract IDBGetRequest get(JSObject key);
-
- public abstract IDBRequest clear();
-
- public abstract IDBCursorRequest openCursor();
-
- public abstract IDBCursorRequest openCursor(IDBKeyRange range);
-
- public abstract net.lax1dude.eaglercraft.adapter.teavm.IDBIndex createIndex(String name, String key);
-
- public abstract net.lax1dude.eaglercraft.adapter.teavm.IDBIndex createIndex(String name,
- String[] keys);
-
- public abstract IDBIndex index(String name);
-
- public abstract void deleteIndex(String name);
-
- public abstract IDBCountRequest count();
-
- public abstract IDBCountRequest count(JSObject key);
-}
diff --git a/src/teavm/java/net/lax1dude/eaglercraft/adapter/teavm/IDBObjectStoreParameters.java b/src/teavm/java/net/lax1dude/eaglercraft/adapter/teavm/IDBObjectStoreParameters.java
deleted file mode 100644
index 17c1b98..0000000
--- a/src/teavm/java/net/lax1dude/eaglercraft/adapter/teavm/IDBObjectStoreParameters.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright 2015 Alexey Andreev.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.lax1dude.eaglercraft.adapter.teavm;
-
-import org.teavm.jso.JSBody;
-import org.teavm.jso.JSObject;
-import org.teavm.jso.JSProperty;
-
-public abstract class IDBObjectStoreParameters implements JSObject {
- @JSBody(script = "return {};")
- public static native IDBObjectStoreParameters create();
-
- public final IDBObjectStoreParameters keyPath(String... keys) {
- setKeyPath(keys);
- return this;
- }
-
- public final IDBObjectStoreParameters autoIncrement(boolean autoIncrement) {
- setAutoIncrement(autoIncrement);
- return this;
- }
-
- @JSProperty
- abstract void setKeyPath(String[] keys);
-
- @JSProperty
- abstract void setAutoIncrement(boolean autoIncrement);
-}
diff --git a/src/teavm/java/net/lax1dude/eaglercraft/adapter/teavm/IDBOpenDBRequest.java b/src/teavm/java/net/lax1dude/eaglercraft/adapter/teavm/IDBOpenDBRequest.java
deleted file mode 100644
index 827f48c..0000000
--- a/src/teavm/java/net/lax1dude/eaglercraft/adapter/teavm/IDBOpenDBRequest.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright 2015 Alexey Andreev.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.lax1dude.eaglercraft.adapter.teavm;
-
-import org.teavm.jso.JSProperty;
-import org.teavm.jso.dom.events.EventListener;
-
-public interface IDBOpenDBRequest extends IDBRequest {
- @JSProperty
- IDBDatabase getResult();
-
- @JSProperty
- void setOnBlocked(EventHandler handler);
-
- @JSProperty("onupgradeneeded")
- void setOnUpgradeNeeded(EventListener listener);
-}
diff --git a/src/teavm/java/net/lax1dude/eaglercraft/adapter/teavm/IDBRequest.java b/src/teavm/java/net/lax1dude/eaglercraft/adapter/teavm/IDBRequest.java
deleted file mode 100644
index d97e273..0000000
--- a/src/teavm/java/net/lax1dude/eaglercraft/adapter/teavm/IDBRequest.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright 2015 Alexey Andreev.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.lax1dude.eaglercraft.adapter.teavm;
-
-import org.teavm.jso.JSProperty;
-import org.teavm.jso.dom.events.EventTarget;
-
-public interface IDBRequest extends EventTarget {
- String STATE_PENDING = "pending";
- String STATE_DONE = "done";
-
- @JSProperty
- IDBError getError();
-
- @JSProperty
- IDBRequestSource getSource();
-
- @JSProperty
- IDBTransaction getTransaction();
-
- @JSProperty
- String getReadyState();
-
- @JSProperty("onerror")
- void setOnError(net.lax1dude.eaglercraft.adapter.teavm.EventHandler handler);
-
- @JSProperty("onsuccess")
- void setOnSuccess(EventHandler handler);
-}
diff --git a/src/teavm/java/net/lax1dude/eaglercraft/adapter/teavm/IDBRequestSource.java b/src/teavm/java/net/lax1dude/eaglercraft/adapter/teavm/IDBRequestSource.java
deleted file mode 100644
index e208dea..0000000
--- a/src/teavm/java/net/lax1dude/eaglercraft/adapter/teavm/IDBRequestSource.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Copyright 2015 Alexey Andreev.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.lax1dude.eaglercraft.adapter.teavm;
-
-import org.teavm.jso.JSObject;
-
-public interface IDBRequestSource extends JSObject {
-}
diff --git a/src/teavm/java/net/lax1dude/eaglercraft/adapter/teavm/IDBTransaction.java b/src/teavm/java/net/lax1dude/eaglercraft/adapter/teavm/IDBTransaction.java
deleted file mode 100644
index 60d2efe..0000000
--- a/src/teavm/java/net/lax1dude/eaglercraft/adapter/teavm/IDBTransaction.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright 2015 Alexey Andreev.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.lax1dude.eaglercraft.adapter.teavm;
-
-import org.teavm.jso.JSObject;
-import org.teavm.jso.JSProperty;
-import org.teavm.jso.dom.events.EventTarget;
-
-public interface IDBTransaction extends JSObject, EventTarget {
- @JSProperty
- String getMode();
-
- @JSProperty
- IDBDatabase getDb();
-
- @JSProperty
- IDBError getError();
-
- IDBObjectStore objectStore(String name);
-
- void abort();
-
- @JSProperty("onabort")
- void setOnAbort(net.lax1dude.eaglercraft.adapter.teavm.EventHandler handler);
-
- @JSProperty("oncomplete")
- void setOnComplete(net.lax1dude.eaglercraft.adapter.teavm.EventHandler handler);
-
- @JSProperty("onerror")
- void setOnError(EventHandler handler);
-}
diff --git a/src/teavm/java/net/lax1dude/eaglercraft/adapter/teavm/IDBVersionChangeEvent.java b/src/teavm/java/net/lax1dude/eaglercraft/adapter/teavm/IDBVersionChangeEvent.java
deleted file mode 100644
index 5046041..0000000
--- a/src/teavm/java/net/lax1dude/eaglercraft/adapter/teavm/IDBVersionChangeEvent.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright 2015 Alexey Andreev.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.lax1dude.eaglercraft.adapter.teavm;
-
-import org.teavm.jso.JSProperty;
-import org.teavm.jso.dom.events.Event;
-
-public interface IDBVersionChangeEvent extends Event {
- @JSProperty
- int getOldVersion();
-
- @JSProperty
- int getNewVersion();
-}
diff --git a/src/teavm/java/net/lax1dude/eaglercraft/adapter/teavm/SelfDefence.java b/src/teavm/java/net/lax1dude/eaglercraft/adapter/teavm/SelfDefence.java
index 3406c45..3a2b146 100644
--- a/src/teavm/java/net/lax1dude/eaglercraft/adapter/teavm/SelfDefence.java
+++ b/src/teavm/java/net/lax1dude/eaglercraft/adapter/teavm/SelfDefence.java
@@ -28,7 +28,7 @@ public class SelfDefence {
@JSBody(params = { "cb" }, script = "const ccb = cb; const _open = window.open; window.open = (url,name,params) => { var rw = _open(url,name,params); ccb(rw); return rw; }")
private static native void injectWindowCapture(NewWindowCallback callback);
- private static final List capturedChildWindows = new ArrayList();
+ private static final List capturedChildWindows = new ArrayList<>();
public static void init(HTMLCanvasElement legitCanvas) {
canvas = legitCanvas;