fixes for sp2, part 1
This commit is contained in:
parent
158d821e16
commit
511e95a067
12
.classpath
12
.classpath
|
@ -3,22 +3,22 @@
|
|||
<classpathentry kind="src" output="bin/main" path="src/main/java">
|
||||
<attributes>
|
||||
<attribute name="gradle_scope" value="main"/>
|
||||
<attribute name="gradle_used_by_scope" value="main,test"/>
|
||||
<attribute name="gradle_used_by_scope" value="main,test,teavm"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" output="bin/main" path="src/teavm/java">
|
||||
<classpathentry kind="src" output="bin/teavm" path="src/teavm/java">
|
||||
<attributes>
|
||||
<attribute name="gradle_scope" value="main"/>
|
||||
<attribute name="gradle_used_by_scope" value="main,test"/>
|
||||
<attribute name="gradle_scope" value="teavm"/>
|
||||
<attribute name="gradle_used_by_scope" value="test,teavm"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" output="bin/main" path="sp-server/src/ipc/java">
|
||||
<attributes>
|
||||
<attribute name="gradle_scope" value="main"/>
|
||||
<attribute name="gradle_used_by_scope" value="main,test"/>
|
||||
<attribute name="gradle_used_by_scope" value="main,test,teavm"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8/"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17/"/>
|
||||
<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/>
|
||||
<classpathentry kind="output" path="bin/default"/>
|
||||
</classpath>
|
||||
|
|
92
build.gradle
92
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 {
|
||||
def folder = "javascript"
|
||||
def name = "classes.js"
|
||||
|
||||
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;
|
||||
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
|
||||
}
|
||||
|
|
1
gradle.properties
Normal file
1
gradle.properties
Normal file
|
@ -0,0 +1 @@
|
|||
org.gradle.jvmargs=-Xmx2G -Xms2G
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
4
gradle/wrapper/gradle-wrapper.properties
vendored
4
gradle/wrapper/gradle-wrapper.properties
vendored
|
@ -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
|
||||
|
|
Binary file not shown.
|
@ -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'
|
||||
|
|
|
@ -3,16 +3,16 @@
|
|||
<classpathentry kind="src" output="bin/main" path="src/main/java">
|
||||
<attributes>
|
||||
<attribute name="gradle_scope" value="main"/>
|
||||
<attribute name="gradle_used_by_scope" value="main,test"/>
|
||||
<attribute name="gradle_used_by_scope" value="main,test,teavm"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" output="bin/main" path="src/ipc/java">
|
||||
<attributes>
|
||||
<attribute name="gradle_scope" value="main"/>
|
||||
<attribute name="gradle_used_by_scope" value="main,test"/>
|
||||
<attribute name="gradle_used_by_scope" value="main,test,teavm"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8/"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17/"/>
|
||||
<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/>
|
||||
<classpathentry kind="output" path="bin/default"/>
|
||||
</classpath>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>eaglercraft-sp-server</name>
|
||||
<name>eaglercraft-sp-server-service-pack-2</name>
|
||||
<comment>Project sp-server created by Buildship.</comment>
|
||||
<projects>
|
||||
</projects>
|
||||
|
|
|
@ -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 {
|
||||
def folder = "../javascript"
|
||||
def name = "classes_server.js"
|
||||
|
||||
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;
|
||||
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
|
||||
}
|
||||
|
|
1
sp-server/gradle.properties
Normal file
1
sp-server/gradle.properties
Normal file
|
@ -0,0 +1 @@
|
|||
org.gradle.jvmargs=-Xmx2G -Xms2G
|
BIN
sp-server/gradle/wrapper/gradle-wrapper.jar
vendored
BIN
sp-server/gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
|
@ -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
|
||||
|
|
|
@ -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
|
|
@ -19,11 +19,11 @@ public class IPCPacket14StringList implements IPCPacketBase {
|
|||
public final List<String> 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<String> list) {
|
||||
stringList = new ArrayList();
|
||||
stringList = new ArrayList<>();
|
||||
for(String s : list) {
|
||||
s = s.trim();
|
||||
if(s.length() > 0) {
|
||||
|
|
|
@ -15,11 +15,11 @@ public class IPCPacket15ThrowException implements IPCPacketBase {
|
|||
public final List<String> 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;
|
||||
}
|
||||
|
||||
|
|
|
@ -25,8 +25,8 @@ public class IPCPacket16NBTList implements IPCPacketBase {
|
|||
public final List<NBTTagCompound> 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<NBTTagCompound> list) {
|
||||
tagList = new LinkedList();
|
||||
tagList = new LinkedList<>();
|
||||
nbtTagList = list;
|
||||
for(int i = 0, size = list.size(); i < size; ++i) {
|
||||
NBTTagCompound tag = list.get(i);
|
||||
|
|
|
@ -15,7 +15,7 @@ public class IPCPacket17ConfigureLAN implements IPCPacketBase {
|
|||
public final List<String> iceServers;
|
||||
|
||||
public IPCPacket17ConfigureLAN() {
|
||||
iceServers = new ArrayList();
|
||||
iceServers = new ArrayList<>();
|
||||
}
|
||||
|
||||
public IPCPacket17ConfigureLAN(int gamemode, boolean cheats, List<String> iceServers) {
|
||||
|
|
|
@ -8,7 +8,7 @@ import java.util.function.Supplier;
|
|||
|
||||
public class IPCPacketManager {
|
||||
|
||||
public static final HashMap<Integer, Supplier<IPCPacketBase>> mappings = new HashMap();
|
||||
public static final HashMap<Integer, Supplier<IPCPacketBase>> mappings = new HashMap<>();
|
||||
|
||||
public static final IPCInputStream IPC_INPUT_STREAM = new IPCInputStream();
|
||||
public static final IPCOutputStream IPC_OUTPUT_STREAM = new IPCOutputStream();
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ public class ExpiringSet<T> extends HashSet<T> {
|
|||
|
||||
public void checkForExpirations() {
|
||||
Iterator<T> 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<T> extends HashSet<T> {
|
|||
checkForExpirations();
|
||||
boolean success = super.add(o);
|
||||
if (success)
|
||||
timestamps.put(o, System.currentTimeMillis());
|
||||
timestamps.put(o, SysUtil.steadyTimeMillis());
|
||||
return success;
|
||||
}
|
||||
|
||||
|
|
|
@ -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.<JSString>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);
|
||||
}
|
|
@ -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<PKT> messageQueue = new LinkedList();
|
||||
private static final LinkedList<PKT> 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<String> arr = new LinkedList();
|
||||
List<String> 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<String> newWorlds = new LinkedList();
|
||||
LinkedList<String> 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<String> newWorlds = new LinkedList();
|
||||
LinkedList<String> 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<NBTTagCompound>()));
|
||||
break;
|
||||
}
|
||||
LinkedList<String> updatedList = new LinkedList();
|
||||
LinkedList<NBTTagCompound> sendListNBT = new LinkedList();
|
||||
LinkedList<String> updatedList = new LinkedList<>();
|
||||
LinkedList<NBTTagCompound> 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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -10,9 +10,9 @@ import net.minecraft.src.Packet250CustomPayload;
|
|||
|
||||
public class SkinsPlugin {
|
||||
|
||||
private static final HashMap<String,byte[]> skinCollection = new HashMap();
|
||||
private static final HashMap<String,byte[]> capeCollection = new HashMap();
|
||||
private static final HashMap<String,Long> lastSkinLayerUpdate = new HashMap();
|
||||
private static final HashMap<String,byte[]> skinCollection = new HashMap<>();
|
||||
private static final HashMap<String,byte[]> capeCollection = new HashMap<>();
|
||||
private static final HashMap<String,Long> 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;
|
||||
|
|
|
@ -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<Void> callback) {
|
||||
Platform.schedule(new DumbSleepHandler(callback), millis);
|
||||
}
|
||||
|
||||
private static class DumbSleepHandler implements PlatformRunnable {
|
||||
private final AsyncCallback<Void> callback;
|
||||
private DumbSleepHandler(AsyncCallback<Void> callback) {
|
||||
this.callback = callback;
|
||||
}
|
||||
@Override
|
||||
public void run() {
|
||||
callback.complete(null);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -17,7 +17,7 @@ public class VFSSaveHandler implements ISaveHandler, IPlayerFileData {
|
|||
|
||||
public final VFile worldDirectory;
|
||||
|
||||
private final HashMap<Integer, VFSChunkLoader> chunkLoaders = new HashMap();
|
||||
private final HashMap<Integer, VFSChunkLoader> chunkLoaders = new HashMap<>();
|
||||
|
||||
public VFSSaveHandler(VFile worldDirectory) {
|
||||
this.worldDirectory = worldDirectory;
|
||||
|
|
|
@ -35,7 +35,7 @@ public class VFile {
|
|||
protected String path;
|
||||
|
||||
public static String createPath(Object... p) {
|
||||
ArrayList<String> r = new ArrayList();
|
||||
ArrayList<String> r = new ArrayList<>();
|
||||
for(int i = 0; i < p.length; ++i) {
|
||||
if(p[i] == null) {
|
||||
continue;
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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<String, VFSFile> fileMap = new HashMap();
|
||||
private final HashMap<String, VFSFile> fileMap = new HashMap<>();
|
||||
|
||||
public final String database;
|
||||
private final IDBDatabase indexeddb;
|
||||
|
@ -395,7 +395,7 @@ public class VirtualFilesystem {
|
|||
}
|
||||
|
||||
public List<String> listFiles(String prefix) {
|
||||
final ArrayList<String> list = new ArrayList();
|
||||
final ArrayList<String> 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<VFSFile> files = fileMap.values().iterator();
|
||||
while(files.hasNext()) {
|
||||
if(curr - files.next().cacheHit > age) {
|
||||
|
@ -487,7 +487,7 @@ public class VirtualFilesystem {
|
|||
f.setOnUpgradeNeeded(new EventListener<IDBVersionChangeEvent>() {
|
||||
@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<BooleanResult> 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<ArrayBuffer> 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<Integer> 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<Integer> 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<BooleanResult> 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<BooleanResult> 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
|
||||
|
|
|
@ -26,7 +26,7 @@ public class VoiceChatPlugin {
|
|||
private static final Map<String, ExpiringSet<String>> voiceRequests = new HashMap<>();
|
||||
private static final Set<String[]> voicePairs = new HashSet<>();
|
||||
|
||||
private static final List<String> iceServers = new ArrayList();
|
||||
private static final List<String> iceServers = new ArrayList<>();
|
||||
|
||||
private static final int VOICE_SIGNAL_ALLOWED = 0;
|
||||
private static final int VOICE_SIGNAL_REQUEST = 0;
|
||||
|
|
|
@ -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<NetHandler> conns = new ArrayList(this.connections);
|
||||
List<NetHandler> conns = new ArrayList<>(this.connections);
|
||||
for (NetHandler var2 : conns) {
|
||||
var2.handlePackets();
|
||||
}
|
||||
|
|
|
@ -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<byte[]> frags = new LinkedList();
|
||||
private LinkedList<byte[]> frags = new LinkedList<>();
|
||||
|
||||
public WorkerNetworkManager(String ipcChannel, MinecraftServer srv, WorkerListenThread th) {
|
||||
this.ipcChannel = ipcChannel;
|
||||
|
|
|
@ -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<String> 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;
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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) -> {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 + "%");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
@ -1996,4 +1996,19 @@ public class EaglerAdapterImpl2 {
|
|||
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) {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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<String,byte[]> filePool = new HashMap();
|
||||
private static final HashMap<String,byte[]> filePoolTemp = new HashMap();
|
||||
public static final HashMap<String, String> fileNameOverrides = new HashMap();
|
||||
private static final HashMap<String,byte[]> filePool = new HashMap<>();
|
||||
private static final HashMap<String,byte[]> filePoolTemp = new HashMap<>();
|
||||
public static final HashMap<String, String> fileNameOverrides = new HashMap<>();
|
||||
|
||||
public static final void loadOverrides(JSONObject json) {
|
||||
JSONObject overrides = json.optJSONObject("assetOverrides", null);
|
||||
|
|
|
@ -104,20 +104,21 @@ public class DefaultSkinRenderer {
|
|||
false, true
|
||||
};
|
||||
|
||||
private static final HashMap<Integer,EntityOtherPlayerMP> skinCookies = new HashMap();
|
||||
private static final HashMap<EntityOtherPlayerMP,Integer> skinGLUnits = new HashMap();
|
||||
private static final HashMap<EntityOtherPlayerMP,Integer> capeGLUnits = new HashMap();
|
||||
private static final HashMap<EntityOtherPlayerMP,Long> skinGLTimeout = new HashMap();
|
||||
private static final HashMap<Integer,EntityOtherPlayerMP> skinCookies = new HashMap<>();
|
||||
private static final HashMap<EntityOtherPlayerMP,Integer> skinGLUnits = new HashMap<>();
|
||||
private static final HashMap<EntityOtherPlayerMP,Integer> capeGLUnits = new HashMap<>();
|
||||
private static final HashMap<EntityOtherPlayerMP,Long> 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<Entry<EntityOtherPlayerMP,Long>> itr = skinGLTimeout.entrySet().iterator();
|
||||
while(itr.hasNext()) {
|
||||
Entry<EntityOtherPlayerMP,Long> 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);
|
||||
|
|
|
@ -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<EaglerProfileSkin> skins = new ArrayList();
|
||||
public static ArrayList<EaglerProfileCape> capes = new ArrayList();
|
||||
public static ArrayList<EaglerProfileSkin> skins = new ArrayList<>();
|
||||
public static ArrayList<EaglerProfileCape> capes = new ArrayList<>();
|
||||
|
||||
public static final EaglercraftRandom rand;
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ public class ExpiringSet<T> extends HashSet<T> {
|
|||
|
||||
public void checkForExpirations() {
|
||||
Iterator<T> 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<T> extends HashSet<T> {
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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<String> speakers = EaglerAdapter.getVoiceSpeaking();
|
||||
Set<String> muted = EaglerAdapter.getVoiceMuted();
|
||||
|
||||
List<String> listenerList = new ArrayList();
|
||||
List<String> listenerList = new ArrayList<>();
|
||||
listenerList.addAll(listeners);
|
||||
listenerList.removeAll(muted);
|
||||
|
||||
|
@ -169,7 +169,7 @@ public class GuiVoiceOverlay extends Gui {
|
|||
Set<String> speakers = EaglerAdapter.getVoiceSpeaking();
|
||||
Set<String> muted = EaglerAdapter.getVoiceMuted();
|
||||
|
||||
List<String> listenerList = new ArrayList();
|
||||
List<String> listenerList = new ArrayList<>();
|
||||
listenerList.addAll(speakers);
|
||||
listenerList.removeAll(muted);
|
||||
|
||||
|
|
|
@ -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<String> integratedServerTPS = new LinkedList();
|
||||
private static List<String> 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<IPCPacket15ThrowException> exceptions = new LinkedList();
|
||||
private static final LinkedList<IPCPacket15ThrowException> exceptions = new LinkedList<>();
|
||||
|
||||
public static final LinkedList<NBTTagCompound> worlds = new LinkedList();
|
||||
public static final LinkedList<NBTTagCompound> worlds = new LinkedList<>();
|
||||
|
||||
public static int statusState() {
|
||||
return statusState;
|
||||
|
@ -408,7 +408,7 @@ public class IntegratedServer {
|
|||
}
|
||||
}
|
||||
|
||||
private static final HashMap<String, WorkerNetworkManager> openConnections = new HashMap();
|
||||
private static final HashMap<String, WorkerNetworkManager> openConnections = new HashMap<>();
|
||||
|
||||
public static final boolean doesChannelExist(String channel) {
|
||||
return openConnections.containsKey(channel);
|
||||
|
|
|
@ -12,7 +12,7 @@ import net.lax1dude.eaglercraft.sp.relay.pkt.*;
|
|||
|
||||
public class IntegratedServerLAN {
|
||||
|
||||
public static final List<String> currentICEServers = new ArrayList();
|
||||
public static final List<String> 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<String, LANClient> clients = new HashMap();
|
||||
private static final Map<String, LANClient> 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 {
|
||||
|
|
|
@ -67,7 +67,7 @@ public class LANClientNetworkManager implements INetworkManager {
|
|||
|
||||
// print servers
|
||||
System.out.println("Relay [" + displayRelay + "|" + displayCode + "] provided ICE servers:");
|
||||
List<String> servers = new ArrayList();
|
||||
List<String> 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;
|
||||
}
|
||||
|
|
|
@ -13,15 +13,15 @@ import net.lax1dude.eaglercraft.sp.relay.pkt.IPacket07LocalWorlds.LocalWorld;
|
|||
|
||||
public class LANServerList {
|
||||
|
||||
private final List<LanServer> lanServersList = new LinkedList();
|
||||
private final Map<String,RelayWorldsQuery> lanServersQueryList = new LinkedHashMap();
|
||||
private final Set<String> deadURIs = new HashSet();
|
||||
private final List<LanServer> lanServersList = new LinkedList<>();
|
||||
private final Map<String,RelayWorldsQuery> lanServersQueryList = new LinkedHashMap<>();
|
||||
private final Set<String> 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)) {
|
||||
|
|
|
@ -15,7 +15,7 @@ import net.minecraft.src.NBTTagList;
|
|||
|
||||
public class RelayManager {
|
||||
|
||||
private final List<RelayServer> relays = new ArrayList();
|
||||
private final List<RelayServer> 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<RelayServer> brokenServers = new LinkedList();
|
||||
private final List<RelayServer> brokenServers = new LinkedList<>();
|
||||
|
||||
public RelayServerSocket getWorkingRelay(Consumer<String> 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()) {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -33,6 +33,6 @@ public class TextureLocation {
|
|||
r.bindTexture(glObject);
|
||||
}
|
||||
|
||||
private static final ArrayList<TextureLocation> locations = new ArrayList();
|
||||
private static final ArrayList<TextureLocation> locations = new ArrayList<>();
|
||||
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -65,7 +65,7 @@ public class WebsocketNetworkManager implements INetworkManager {
|
|||
}
|
||||
|
||||
private ByteBuffer oldChunkBuffer = null;
|
||||
private LinkedList<ByteBuffer> readChunks = new LinkedList();
|
||||
private LinkedList<ByteBuffer> readChunks = new LinkedList<>();
|
||||
|
||||
public void processReadPackets() {
|
||||
readChunks.clear();
|
||||
|
|
|
@ -133,7 +133,7 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
|
|||
|
||||
public static final boolean isWebGL = _wisWebGL();
|
||||
|
||||
static final GLObjectMap<TextureGL> texObjects = new GLObjectMap(256);
|
||||
static final GLObjectMap<TextureGL> 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<Integer, DisplayList> displayLists = new HashMap();
|
||||
private static final HashMap<Integer, DisplayList> displayListsInitialized = new HashMap();
|
||||
private static final HashMap<Integer, DisplayList> displayLists = new HashMap<>();
|
||||
private static final HashMap<Integer, DisplayList> displayListsInitialized = new HashMap<>();
|
||||
|
||||
public static final int getDisplayListCount() {
|
||||
return displayListsInitialized.size();
|
||||
|
@ -1318,7 +1318,7 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
|
|||
|
||||
}
|
||||
|
||||
private static final GLObjectMap<QueryGL> queryObjs = new GLObjectMap(256);
|
||||
private static final GLObjectMap<QueryGL> 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;
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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<FixedFunctionShader> instanceList = new ArrayList();
|
||||
private static final List<FixedFunctionShader> instanceList = new ArrayList<>();
|
||||
|
||||
public static void refreshCoreGL() {
|
||||
for(int i = 0; i < instances.length; ++i) {
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -11,8 +11,8 @@ import java.util.Map;
|
|||
|
||||
public class IPacket {
|
||||
|
||||
private static final Map<Integer,Class<? extends IPacket>> definedPacketClasses = new HashMap();
|
||||
private static final Map<Class<? extends IPacket>,Integer> definedPacketIds = new HashMap();
|
||||
private static final Map<Integer,Class<? extends IPacket>> definedPacketClasses = new HashMap<>();
|
||||
private static final Map<Class<? extends IPacket>,Integer> definedPacketIds = new HashMap<>();
|
||||
|
||||
private static void register(int id, Class<? extends IPacket> clazz) {
|
||||
definedPacketClasses.put(id, clazz);
|
||||
|
|
|
@ -10,7 +10,7 @@ public class IPacket01ICEServers extends IPacket {
|
|||
public final Collection<ICEServerSet.RelayServer> servers;
|
||||
|
||||
public IPacket01ICEServers() {
|
||||
servers = new ArrayList();
|
||||
servers = new ArrayList<>();
|
||||
}
|
||||
|
||||
public void read(DataInputStream input) throws IOException {
|
||||
|
|
|
@ -22,7 +22,7 @@ public class IPacket07LocalWorlds extends IPacket {
|
|||
public final List<LocalWorld> worldsList;
|
||||
|
||||
public IPacket07LocalWorlds() {
|
||||
this.worldsList = new ArrayList();
|
||||
this.worldsList = new ArrayList<>();
|
||||
}
|
||||
|
||||
public void read(DataInputStream input) throws IOException {
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user