TeaVM 0.6.1, No Fucking Lag!
This commit is contained in:
parent
8d31000bd1
commit
aa02e00ca3
Binary file not shown.
285118
javascript/classes.js
285118
javascript/classes.js
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
|
@ -1,30 +1,4 @@
|
||||||
|
|
||||||
buildscript {
|
|
||||||
repositories {
|
|
||||||
flatDir {
|
|
||||||
dirs "deps"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
classpath name: "gson-2.2.4"
|
|
||||||
classpath name: "joda-time-2.7"
|
|
||||||
classpath name: "jzlib-1.1.3"
|
|
||||||
classpath name: "teavm-classlib-0.7.0-SNAPSHOT"
|
|
||||||
classpath name: "teavm-interop-0.7.0-SNAPSHOT"
|
|
||||||
classpath name: "teavm-jso-0.7.0-SNAPSHOT"
|
|
||||||
classpath name: "teavm-jso-apis-0.7.0-SNAPSHOT"
|
|
||||||
classpath name: "teavm-jso-impl-0.7.0-SNAPSHOT"
|
|
||||||
classpath name: "teavm-platform-0.7.0-SNAPSHOT"
|
|
||||||
classpath name: "teavm-metaprogramming-api-0.7.0-SNAPSHOT"
|
|
||||||
classpath name: "teavm-metaprogramming-impl-0.7.0-SNAPSHOT"
|
|
||||||
classpath name: "teavm-core-0.7.0-SNAPSHOT"
|
|
||||||
classpath name: "teavm-tooling-0.7.0-SNAPSHOT"
|
|
||||||
classpath name: "teavm-cli-0.6.1"
|
|
||||||
classpath name: "teavm-gradle-plugin-1.0.0-patched"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
apply plugin: "java"
|
apply plugin: "java"
|
||||||
apply plugin: "eclipse"
|
apply plugin: "eclipse"
|
||||||
apply plugin: "io.github.zebalu.teavm-gradle-plugin"
|
apply plugin: "io.github.zebalu.teavm-gradle-plugin"
|
||||||
|
@ -47,18 +21,39 @@ repositories {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
buildscript {
|
||||||
|
repositories {
|
||||||
|
jcenter()
|
||||||
|
}
|
||||||
|
|
||||||
|
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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
jcenter()
|
||||||
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation name: "gson-2.2.4"
|
implementation 'org.teavm:teavm-platform:0.6.1'
|
||||||
implementation name: "joda-time-2.7"
|
implementation 'org.teavm:teavm-classlib:0.6.1'
|
||||||
implementation name: "jzlib-1.1.3"
|
|
||||||
implementation name: "teavm-classlib-0.7.0-SNAPSHOT"
|
|
||||||
implementation name: "teavm-interop-0.7.0-SNAPSHOT"
|
|
||||||
implementation name: "teavm-jso-0.7.0-SNAPSHOT"
|
|
||||||
implementation name: "teavm-jso-apis-0.7.0-SNAPSHOT"
|
|
||||||
implementation name: "teavm-jso-impl-0.7.0-SNAPSHOT"
|
|
||||||
implementation name: "teavm-platform-0.7.0-SNAPSHOT"
|
|
||||||
implementation name: "teavm-metaprogramming-api-0.7.0-SNAPSHOT"
|
|
||||||
implementation name: "teavm-metaprogramming-impl-0.7.0-SNAPSHOT"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
teavm {
|
teavm {
|
||||||
|
@ -90,7 +85,7 @@ teavm {
|
||||||
|
|
||||||
classesToPreserve = null;
|
classesToPreserve = null;
|
||||||
stopOnErrors = false;
|
stopOnErrors = false;
|
||||||
optimizationLevel = "FULL"; //org.teavm.vm.TeaVMOptimizationLevel.SIMPLE;
|
optimizationLevel = "ADVANCED"; //org.teavm.vm.TeaVMOptimizationLevel.SIMPLE;
|
||||||
fastGlobalAnalysis = false;
|
fastGlobalAnalysis = false;
|
||||||
targetType = "JAVASCRIPT"; //org.teavm.tooling.TeaVMTargetType.JAVASCRIPT;
|
targetType = "JAVASCRIPT"; //org.teavm.tooling.TeaVMTargetType.JAVASCRIPT;
|
||||||
cacheDirectory = null;
|
cacheDirectory = null;
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,79 @@
|
||||||
|
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);
|
||||||
|
}
|
|
@ -304,6 +304,7 @@ public class IntegratedServer {
|
||||||
break;
|
break;
|
||||||
case IPCPacket07ImportWorld.ID: {
|
case IPCPacket07ImportWorld.ID: {
|
||||||
IPCPacket07ImportWorld pkt = (IPCPacket07ImportWorld)packet;
|
IPCPacket07ImportWorld pkt = (IPCPacket07ImportWorld)packet;
|
||||||
|
if(isServerStopped()) {
|
||||||
if(pkt.worldFormat == IPCPacket07ImportWorld.WORLD_FORMAT_EAG) {
|
if(pkt.worldFormat == IPCPacket07ImportWorld.WORLD_FORMAT_EAG) {
|
||||||
try {
|
try {
|
||||||
String folder = VFSSaveHandler.worldNameToFolderName(pkt.worldName);
|
String folder = VFSSaveHandler.worldNameToFolderName(pkt.worldName);
|
||||||
|
@ -343,6 +344,10 @@ public class IntegratedServer {
|
||||||
throwExceptionToClient("Failed to import world '" + pkt.worldName + "' as EPK", t);
|
throwExceptionToClient("Failed to import world '" + pkt.worldName + "' as EPK", t);
|
||||||
sendTaskFailed();
|
sendTaskFailed();
|
||||||
}
|
}
|
||||||
|
}else {
|
||||||
|
System.err.println("Client tried to import a world in an unknown format: 0x" + Integer.toHexString(pkt.worldFormat));
|
||||||
|
sendTaskFailed();
|
||||||
|
}
|
||||||
}else {
|
}else {
|
||||||
System.err.println("Client tried to import a world '" + pkt.worldName + "' while the server is running");
|
System.err.println("Client tried to import a world '" + pkt.worldName + "' while the server is running");
|
||||||
sendTaskFailed();
|
sendTaskFailed();
|
||||||
|
@ -496,7 +501,7 @@ public class IntegratedServer {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if(!msg.channel.startsWith("NET|") || currentProcess == null) {
|
if(!msg.channel.startsWith("NET|") || currentProcess == null) {
|
||||||
System.err.println("Unknown ICP channel: '" + msg.channel + "' passed " + msg.data.length + " bytes");
|
//System.err.println("Unknown ICP channel: '" + msg.channel + "' passed " + msg.data.length + " bytes");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
String u = msg.channel.substring(4);
|
String u = msg.channel.substring(4);
|
||||||
|
@ -553,18 +558,8 @@ public class IntegratedServer {
|
||||||
@JSBody(params = { "wb" }, script = "onmessage = function(o) { wb(o.data.ch, o.data.dat); };")
|
@JSBody(params = { "wb" }, script = "onmessage = function(o) { wb(o.data.ch, o.data.dat); };")
|
||||||
private static native void registerPacketHandler(WorkerBinaryPacketHandler wb);
|
private static native void registerPacketHandler(WorkerBinaryPacketHandler wb);
|
||||||
|
|
||||||
@JSBody(script = "return (((typeof window) !== \"undefined\") && ((typeof window.testScript) !== \"undefined\")) ? window.testScript : null;")
|
|
||||||
private static native String shouldLaunchTest();
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
|
||||||
String test = shouldLaunchTest();
|
|
||||||
|
|
||||||
if(test != null) {
|
|
||||||
WorkerTest.init(test);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
registerPacketHandler(new WorkerBinaryPacketHandlerImpl());
|
registerPacketHandler(new WorkerBinaryPacketHandlerImpl());
|
||||||
|
|
||||||
isRunning = true;
|
isRunning = true;
|
||||||
|
|
|
@ -24,7 +24,6 @@ import org.teavm.jso.indexeddb.IDBCursorRequest;
|
||||||
import org.teavm.jso.indexeddb.IDBDatabase;
|
import org.teavm.jso.indexeddb.IDBDatabase;
|
||||||
import org.teavm.jso.indexeddb.IDBFactory;
|
import org.teavm.jso.indexeddb.IDBFactory;
|
||||||
import org.teavm.jso.indexeddb.IDBGetRequest;
|
import org.teavm.jso.indexeddb.IDBGetRequest;
|
||||||
import org.teavm.jso.indexeddb.IDBObjectStore;
|
|
||||||
import org.teavm.jso.indexeddb.IDBObjectStoreParameters;
|
import org.teavm.jso.indexeddb.IDBObjectStoreParameters;
|
||||||
import org.teavm.jso.indexeddb.IDBOpenDBRequest;
|
import org.teavm.jso.indexeddb.IDBOpenDBRequest;
|
||||||
import org.teavm.jso.indexeddb.IDBRequest;
|
import org.teavm.jso.indexeddb.IDBRequest;
|
||||||
|
@ -489,7 +488,7 @@ public class VirtualFilesystem {
|
||||||
f.setOnUpgradeNeeded(new EventListener<IDBVersionChangeEvent>() {
|
f.setOnUpgradeNeeded(new EventListener<IDBVersionChangeEvent>() {
|
||||||
@Override
|
@Override
|
||||||
public void handleEvent(IDBVersionChangeEvent evt) {
|
public void handleEvent(IDBVersionChangeEvent evt) {
|
||||||
f.getResult().createObjectStore("filesystem", IDBObjectStoreParameters.create().keyPath("path"));
|
IDBObjectStorePatched.createObjectStorePatch(f.getResult(), "filesystem", IDBObjectStoreParameters.create().keyPath("path"));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -499,7 +498,7 @@ public class VirtualFilesystem {
|
||||||
|
|
||||||
private static void deleteFile(IDBDatabase db, String name, final AsyncCallback<BooleanResult> cb) {
|
private static void deleteFile(IDBDatabase db, String name, final AsyncCallback<BooleanResult> cb) {
|
||||||
IDBTransaction tx = db.transaction("filesystem", "readwrite");
|
IDBTransaction tx = db.transaction("filesystem", "readwrite");
|
||||||
final IDBRequest r = tx.objectStore("filesystem").delete(makeTheFuckingKeyWork(name));
|
final IDBRequest r = IDBObjectStorePatched.objectStorePatch(tx, "filesystem").delete(makeTheFuckingKeyWork(name));
|
||||||
|
|
||||||
r.setOnSuccess(new EventHandler() {
|
r.setOnSuccess(new EventHandler() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -526,7 +525,7 @@ public class VirtualFilesystem {
|
||||||
|
|
||||||
private static void readWholeFile(IDBDatabase db, String name, final AsyncCallback<ArrayBuffer> cb) {
|
private static void readWholeFile(IDBDatabase db, String name, final AsyncCallback<ArrayBuffer> cb) {
|
||||||
IDBTransaction tx = db.transaction("filesystem", "readonly");
|
IDBTransaction tx = db.transaction("filesystem", "readonly");
|
||||||
final IDBGetRequest r = tx.objectStore("filesystem").get(makeTheFuckingKeyWork(name));
|
final IDBGetRequest r = IDBObjectStorePatched.objectStorePatch(tx, "filesystem").get(makeTheFuckingKeyWork(name));
|
||||||
r.setOnSuccess(new EventHandler() {
|
r.setOnSuccess(new EventHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void handleEvent() {
|
public void handleEvent() {
|
||||||
|
@ -553,7 +552,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) {
|
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");
|
IDBTransaction tx = db.transaction("filesystem", rw ? "readwrite" : "readonly");
|
||||||
final IDBCursorRequest r = tx.objectStore("filesystem").openCursor();
|
final IDBCursorRequest r = IDBObjectStorePatched.objectStorePatch(tx, "filesystem").openCursor();
|
||||||
final int[] res = new int[1];
|
final int[] res = new int[1];
|
||||||
r.setOnSuccess(new EventHandler() {
|
r.setOnSuccess(new EventHandler() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -591,7 +590,7 @@ public class VirtualFilesystem {
|
||||||
|
|
||||||
private static void deleteFiles(IDBDatabase db, final String prefix, final AsyncCallback<Integer> cb) {
|
private static void deleteFiles(IDBDatabase db, final String prefix, final AsyncCallback<Integer> cb) {
|
||||||
IDBTransaction tx = db.transaction("filesystem", "readwrite");
|
IDBTransaction tx = db.transaction("filesystem", "readwrite");
|
||||||
final IDBCursorRequest r = tx.objectStore("filesystem").openCursor();
|
final IDBCursorRequest r = IDBObjectStorePatched.objectStorePatch(tx, "filesystem").openCursor();
|
||||||
final int[] res = new int[1];
|
final int[] res = new int[1];
|
||||||
r.setOnSuccess(new EventHandler() {
|
r.setOnSuccess(new EventHandler() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -624,7 +623,7 @@ public class VirtualFilesystem {
|
||||||
|
|
||||||
private static void fileExists(IDBDatabase db, String name, final AsyncCallback<BooleanResult> cb) {
|
private static void fileExists(IDBDatabase db, String name, final AsyncCallback<BooleanResult> cb) {
|
||||||
IDBTransaction tx = db.transaction("filesystem", "readonly");
|
IDBTransaction tx = db.transaction("filesystem", "readonly");
|
||||||
final IDBCountRequest r = tx.objectStore("filesystem").count(makeTheFuckingKeyWork(name));
|
final IDBCountRequest r = IDBObjectStorePatched.objectStorePatch(tx, "filesystem").count(makeTheFuckingKeyWork(name));
|
||||||
r.setOnSuccess(new EventHandler() {
|
r.setOnSuccess(new EventHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void handleEvent() {
|
public void handleEvent() {
|
||||||
|
@ -647,7 +646,7 @@ public class VirtualFilesystem {
|
||||||
|
|
||||||
private static void writeWholeFile(IDBDatabase db, String name, ArrayBuffer data, final AsyncCallback<BooleanResult> cb) {
|
private static void writeWholeFile(IDBDatabase db, String name, ArrayBuffer data, final AsyncCallback<BooleanResult> cb) {
|
||||||
IDBTransaction tx = db.transaction("filesystem", "readwrite");
|
IDBTransaction tx = db.transaction("filesystem", "readwrite");
|
||||||
final IDBRequest r = tx.objectStore("filesystem").put(writeRow(name, data));
|
final IDBRequest r = IDBObjectStorePatched.objectStorePatch(tx, "filesystem").put(writeRow(name, data));
|
||||||
|
|
||||||
r.setOnSuccess(new EventHandler() {
|
r.setOnSuccess(new EventHandler() {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,169 +0,0 @@
|
||||||
package net.lax1dude.eaglercraft.sp;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.LinkedList;
|
|
||||||
|
|
||||||
import org.teavm.jso.JSBody;
|
|
||||||
import org.teavm.jso.JSFunctor;
|
|
||||||
import org.teavm.jso.JSObject;
|
|
||||||
import org.teavm.jso.browser.Window;
|
|
||||||
import org.teavm.jso.dom.events.ErrorEvent;
|
|
||||||
import org.teavm.jso.dom.events.EventListener;
|
|
||||||
import org.teavm.jso.dom.html.HTMLDocument;
|
|
||||||
import org.teavm.jso.typedarrays.ArrayBuffer;
|
|
||||||
import org.teavm.jso.typedarrays.Uint8Array;
|
|
||||||
import org.teavm.jso.workers.Worker;
|
|
||||||
|
|
||||||
import net.lax1dude.eaglercraft.sp.ipc.*;
|
|
||||||
|
|
||||||
public class WorkerTest {
|
|
||||||
|
|
||||||
private static final LinkedList<PKT> messageQueue = new LinkedList();
|
|
||||||
private static boolean isAlive = false;
|
|
||||||
private static boolean isLoading = false;
|
|
||||||
|
|
||||||
protected static class PKT {
|
|
||||||
protected final String channel;
|
|
||||||
protected final byte[] data;
|
|
||||||
protected PKT(String channel, byte[] data) {
|
|
||||||
this.channel = channel;
|
|
||||||
this.data = data;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Worker server = null;
|
|
||||||
|
|
||||||
@JSFunctor
|
|
||||||
private static interface WorkerBinaryPacketHandler extends JSObject {
|
|
||||||
public void onMessage(String channel, ArrayBuffer buf);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class WorkerBinaryPacketHandlerImpl implements WorkerBinaryPacketHandler {
|
|
||||||
|
|
||||||
public void onMessage(String channel, ArrayBuffer buf) {
|
|
||||||
if(channel == null) {
|
|
||||||
System.err.println("Recieved IPC packet with null channel");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(buf == null) {
|
|
||||||
System.err.println("Recieved IPC packet with null buffer");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Uint8Array a = Uint8Array.create(buf);
|
|
||||||
byte[] pkt = new byte[a.getLength()];
|
|
||||||
for(int i = 0; i < pkt.length; ++i) {
|
|
||||||
pkt[i] = (byte) a.get(i);
|
|
||||||
}
|
|
||||||
|
|
||||||
messageQueue.add(new PKT(channel, pkt));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@JSBody(params = { "w", "wb" }, script = "w.onmessage = function(o) { wb(o.data.ch, o.data.dat); };")
|
|
||||||
private static native void registerPacketHandler(Worker w, WorkerBinaryPacketHandler wb);
|
|
||||||
|
|
||||||
@JSBody(params = { "w", "ch", "dat" }, script = "w.postMessage({ ch: ch, dat : dat });")
|
|
||||||
private static native void sendWorkerPacket(Worker w, String channel, ArrayBuffer arr);
|
|
||||||
|
|
||||||
public static void sendIPCPacket(IPCPacketBase pkt) {
|
|
||||||
byte[] serialized;
|
|
||||||
|
|
||||||
try {
|
|
||||||
serialized = IPCPacketManager.IPCSerialize(pkt);
|
|
||||||
} catch (IOException e) {
|
|
||||||
System.err.println("Could not serialize IPC packet 0x" + Integer.toHexString(pkt.id()) + " class '" + pkt.getClass().getSimpleName() + "'");
|
|
||||||
e.printStackTrace();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ArrayBuffer arb = ArrayBuffer.create(serialized.length);
|
|
||||||
Uint8Array ar = Uint8Array.create(arb);
|
|
||||||
ar.set(serialized);
|
|
||||||
sendWorkerPacket(server, "IPC", arb);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void init(String path) {
|
|
||||||
server = Worker.create(path);
|
|
||||||
server.onError(new EventListener<ErrorEvent>() {
|
|
||||||
@Override
|
|
||||||
public void handleEvent(ErrorEvent evt) {
|
|
||||||
System.err.println("Worker Error: " + evt.getError());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
registerPacketHandler(server, new WorkerBinaryPacketHandlerImpl());
|
|
||||||
|
|
||||||
while(true) {
|
|
||||||
|
|
||||||
while(messageQueue.size() > 0) {
|
|
||||||
PKT p = messageQueue.remove(0);
|
|
||||||
if(p.channel.equals("IPC")) {
|
|
||||||
|
|
||||||
IPCPacketBase packet;
|
|
||||||
try {
|
|
||||||
packet = IPCPacketManager.IPCDeserialize(p.data);
|
|
||||||
}catch(IOException e) {
|
|
||||||
System.err.print("Failed to deserialize IPC packet: ");
|
|
||||||
e.printStackTrace();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
int id = packet.id();
|
|
||||||
|
|
||||||
try {
|
|
||||||
switch(id) {
|
|
||||||
case IPCPacketFFProcessKeepAlive.ID: {
|
|
||||||
isAlive = true;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case IPCPacket15ThrowException.ID: {
|
|
||||||
IPCPacket15ThrowException pkt = (IPCPacket15ThrowException)packet;
|
|
||||||
System.err.println("Server Exception: " + pkt.errorMessage);
|
|
||||||
for(String s : pkt.stackTrace) {
|
|
||||||
System.err.println(" " + s);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case IPCPacket0DProgressUpdate.ID: {
|
|
||||||
IPCPacket0DProgressUpdate pkt = (IPCPacket0DProgressUpdate)packet;
|
|
||||||
System.out.println("Progress: " + pkt.updateMessage + " (" + (int)(100 * pkt.updateProgress) + "/100)");
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
System.err.println("IPC packet type 0x" + Integer.toHexString(id) + " class '" + packet.getClass().getSimpleName() + "' was not handled");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}catch(Throwable t) {
|
|
||||||
System.err.println("fuck");
|
|
||||||
t.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if(isAlive && !isLoading) {
|
|
||||||
isLoading = true;
|
|
||||||
|
|
||||||
HTMLDocument doc = Window.current().getDocument();
|
|
||||||
String[] stat = doc.getElementById("str_STAT_GUID").getInnerText().split("\n");
|
|
||||||
String[] lang = doc.getElementById("str_LOCALE").getInnerText().split("\n");
|
|
||||||
|
|
||||||
sendIPCPacket(new IPCPacket14StringList(IPCPacket14StringList.STAT_GUID, stat));
|
|
||||||
sendIPCPacket(new IPCPacket14StringList(IPCPacket14StringList.LOCALE, lang));
|
|
||||||
|
|
||||||
sendIPCPacket(new IPCPacket02InitWorld("eagler", 1, 0, "", 6969696969696969l, true, true, true));
|
|
||||||
sendIPCPacket(new IPCPacket00StartServer("eagler", "LAX1DUDE", 0));
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
Thread.sleep(1l); // allow some async to occur
|
|
||||||
}catch(InterruptedException e) {
|
|
||||||
System.err.println("you eagler");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -20,119 +20,168 @@ public class AchievementList {
|
||||||
public static List achievementList = new ArrayList();
|
public static List achievementList = new ArrayList();
|
||||||
|
|
||||||
/** Is the 'open inventory' achievement. */
|
/** Is the 'open inventory' achievement. */
|
||||||
public static Achievement openInventory = (new Achievement(0, "openInventory", 0, 0, Item.book, (Achievement) null))
|
public static Achievement openInventory = null;
|
||||||
.setIndependent().registerAchievement();
|
|
||||||
|
|
||||||
/** Is the 'getting wood' achievement. */
|
/** Is the 'getting wood' achievement. */
|
||||||
public static Achievement mineWood = (new Achievement(1, "mineWood", 2, 1, Block.wood, openInventory))
|
public static Achievement mineWood = null;
|
||||||
.registerAchievement();
|
|
||||||
|
|
||||||
/** Is the 'benchmarking' achievement. */
|
/** Is the 'benchmarking' achievement. */
|
||||||
public static Achievement buildWorkBench = (new Achievement(2, "buildWorkBench", 4, -1, Block.workbench, mineWood))
|
public static Achievement buildWorkBench = null;
|
||||||
.registerAchievement();
|
|
||||||
|
|
||||||
/** Is the 'time to mine' achievement. */
|
/** Is the 'time to mine' achievement. */
|
||||||
public static Achievement buildPickaxe = (new Achievement(3, "buildPickaxe", 4, 2, Item.pickaxeWood,
|
public static Achievement buildPickaxe = null;
|
||||||
buildWorkBench)).registerAchievement();
|
|
||||||
|
|
||||||
/** Is the 'hot topic' achievement. */
|
/** Is the 'hot topic' achievement. */
|
||||||
public static Achievement buildFurnace = (new Achievement(4, "buildFurnace", 3, 4, Block.furnaceIdle, buildPickaxe))
|
public static Achievement buildFurnace = null;
|
||||||
.registerAchievement();
|
|
||||||
|
|
||||||
/** Is the 'acquire hardware' achievement. */
|
/** Is the 'acquire hardware' achievement. */
|
||||||
public static Achievement acquireIron = (new Achievement(5, "acquireIron", 1, 4, Item.ingotIron, buildFurnace))
|
public static Achievement acquireIron = null;
|
||||||
.registerAchievement();
|
|
||||||
|
|
||||||
/** Is the 'time to farm' achievement. */
|
/** Is the 'time to farm' achievement. */
|
||||||
public static Achievement buildHoe = (new Achievement(6, "buildHoe", 2, -3, Item.hoeWood, buildWorkBench))
|
public static Achievement buildHoe = null;
|
||||||
.registerAchievement();
|
|
||||||
|
|
||||||
/** Is the 'bake bread' achievement. */
|
/** Is the 'bake bread' achievement. */
|
||||||
public static Achievement makeBread = (new Achievement(7, "makeBread", -1, -3, Item.bread, buildHoe))
|
public static Achievement makeBread = null;
|
||||||
.registerAchievement();
|
|
||||||
|
|
||||||
/** Is the 'the lie' achievement. */
|
/** Is the 'the lie' achievement. */
|
||||||
public static Achievement bakeCake = (new Achievement(8, "bakeCake", 0, -5, Item.cake, buildHoe))
|
public static Achievement bakeCake = null;
|
||||||
.registerAchievement();
|
|
||||||
|
|
||||||
/** Is the 'getting a upgrade' achievement. */
|
/** Is the 'getting a upgrade' achievement. */
|
||||||
public static Achievement buildBetterPickaxe = (new Achievement(9, "buildBetterPickaxe", 6, 2, Item.pickaxeStone,
|
public static Achievement buildBetterPickaxe = null;
|
||||||
buildPickaxe)).registerAchievement();
|
|
||||||
|
|
||||||
/** Is the 'delicious fish' achievement. */
|
/** Is the 'delicious fish' achievement. */
|
||||||
public static Achievement cookFish = (new Achievement(10, "cookFish", 2, 6, Item.fishCooked, buildFurnace))
|
public static Achievement cookFish = null;
|
||||||
.registerAchievement();
|
|
||||||
|
|
||||||
/** Is the 'on a rail' achievement */
|
/** Is the 'on a rail' achievement */
|
||||||
public static Achievement onARail = (new Achievement(11, "onARail", 2, 3, Block.rail, acquireIron)).setSpecial()
|
public static Achievement onARail = null;
|
||||||
.registerAchievement();
|
|
||||||
|
|
||||||
/** Is the 'time to strike' achievement. */
|
/** Is the 'time to strike' achievement. */
|
||||||
public static Achievement buildSword = (new Achievement(12, "buildSword", 6, -1, Item.swordWood, buildWorkBench))
|
public static Achievement buildSword = null;
|
||||||
.registerAchievement();
|
|
||||||
|
|
||||||
/** Is the 'monster hunter' achievement. */
|
/** Is the 'monster hunter' achievement. */
|
||||||
public static Achievement killEnemy = (new Achievement(13, "killEnemy", 8, -1, Item.bone, buildSword))
|
public static Achievement killEnemy = null;
|
||||||
.registerAchievement();
|
|
||||||
|
|
||||||
/** is the 'cow tipper' achievement. */
|
/** is the 'cow tipper' achievement. */
|
||||||
public static Achievement killCow = (new Achievement(14, "killCow", 7, -3, Item.leather, buildSword))
|
public static Achievement killCow = null;
|
||||||
.registerAchievement();
|
|
||||||
|
|
||||||
/** Is the 'when pig fly' achievement. */
|
/** Is the 'when pig fly' achievement. */
|
||||||
public static Achievement flyPig = (new Achievement(15, "flyPig", 8, -4, Item.saddle, killCow)).setSpecial()
|
public static Achievement flyPig = null;
|
||||||
.registerAchievement();
|
|
||||||
|
|
||||||
/** The achievement for killing a Skeleton from 50 meters aways. */
|
/** The achievement for killing a Skeleton from 50 meters aways. */
|
||||||
public static Achievement snipeSkeleton = (new Achievement(16, "snipeSkeleton", 7, 0, Item.bow, killEnemy))
|
public static Achievement snipeSkeleton = null;
|
||||||
.setSpecial().registerAchievement();
|
|
||||||
|
|
||||||
/** Is the 'DIAMONDS!' achievement */
|
/** Is the 'DIAMONDS!' achievement */
|
||||||
public static Achievement diamonds = (new Achievement(17, "diamonds", -1, 5, Item.diamond, acquireIron))
|
public static Achievement diamonds = null;
|
||||||
.registerAchievement();
|
|
||||||
|
|
||||||
/** Is the 'We Need to Go Deeper' achievement */
|
/** Is the 'We Need to Go Deeper' achievement */
|
||||||
public static Achievement portal = (new Achievement(18, "portal", -1, 7, Block.obsidian, diamonds))
|
public static Achievement portal = null;
|
||||||
.registerAchievement();
|
|
||||||
|
|
||||||
/** Is the 'Return to Sender' achievement */
|
/** Is the 'Return to Sender' achievement */
|
||||||
public static Achievement ghast = (new Achievement(19, "ghast", -4, 8, Item.ghastTear, portal)).setSpecial()
|
public static Achievement ghast = null;
|
||||||
.registerAchievement();
|
|
||||||
|
|
||||||
/** Is the 'Into Fire' achievement */
|
/** Is the 'Into Fire' achievement */
|
||||||
public static Achievement blazeRod = (new Achievement(20, "blazeRod", 0, 9, Item.blazeRod, portal))
|
public static Achievement blazeRod = null;
|
||||||
.registerAchievement();
|
|
||||||
|
|
||||||
/** Is the 'Local Brewery' achievement */
|
/** Is the 'Local Brewery' achievement */
|
||||||
public static Achievement potion = (new Achievement(21, "potion", 2, 8, Item.potion, blazeRod))
|
public static Achievement potion = null;
|
||||||
.registerAchievement();
|
|
||||||
|
|
||||||
/** Is the 'The End?' achievement */
|
/** Is the 'The End?' achievement */
|
||||||
public static Achievement theEnd = (new Achievement(22, "theEnd", 3, 10, Item.eyeOfEnder, blazeRod)).setSpecial()
|
public static Achievement theEnd = null;
|
||||||
.registerAchievement();
|
|
||||||
|
|
||||||
/** Is the 'The End.' achievement */
|
/** Is the 'The End.' achievement */
|
||||||
public static Achievement theEnd2 = (new Achievement(23, "theEnd2", 4, 13, Block.dragonEgg, theEnd)).setSpecial()
|
public static Achievement theEnd2 = null;
|
||||||
.registerAchievement();
|
|
||||||
|
|
||||||
/** Is the 'Enchanter' achievement */
|
/** Is the 'Enchanter' achievement */
|
||||||
public static Achievement enchantments = (new Achievement(24, "enchantments", -4, 4, Block.enchantmentTable,
|
public static Achievement enchantments = null;
|
||||||
diamonds)).registerAchievement();
|
|
||||||
public static Achievement overkill = (new Achievement(25, "overkill", -4, 1, Item.swordDiamond, enchantments))
|
public static Achievement overkill = null;
|
||||||
.setSpecial().registerAchievement();
|
|
||||||
|
|
||||||
/** Is the 'Librarian' achievement */
|
/** Is the 'Librarian' achievement */
|
||||||
public static Achievement bookcase = (new Achievement(26, "bookcase", -3, 6, Block.bookShelf, enchantments))
|
public static Achievement bookcase = null;
|
||||||
|
|
||||||
|
public static void init() {
|
||||||
|
achievementList = new ArrayList();
|
||||||
|
|
||||||
|
openInventory = (new Achievement(0, "openInventory", 0, 0, Item.book, (Achievement) null))
|
||||||
|
.setIndependent().registerAchievement();
|
||||||
|
|
||||||
|
mineWood = (new Achievement(1, "mineWood", 2, 1, Block.wood, openInventory))
|
||||||
.registerAchievement();
|
.registerAchievement();
|
||||||
|
|
||||||
/**
|
buildWorkBench = (new Achievement(2, "buildWorkBench", 4, -1, Block.workbench, mineWood))
|
||||||
* A stub functions called to make the static initializer for this class run.
|
.registerAchievement();
|
||||||
*/
|
|
||||||
public static void init() {
|
buildPickaxe = (new Achievement(3, "buildPickaxe", 4, 2, Item.pickaxeWood,
|
||||||
System.out.println("yee");
|
buildWorkBench)).registerAchievement();
|
||||||
|
|
||||||
|
buildFurnace = (new Achievement(4, "buildFurnace", 3, 4, Block.furnaceIdle, buildPickaxe))
|
||||||
|
.registerAchievement();
|
||||||
|
|
||||||
|
acquireIron = (new Achievement(5, "acquireIron", 1, 4, Item.ingotIron, buildFurnace))
|
||||||
|
.registerAchievement();
|
||||||
|
|
||||||
|
buildHoe = (new Achievement(6, "buildHoe", 2, -3, Item.hoeWood, buildWorkBench))
|
||||||
|
.registerAchievement();
|
||||||
|
|
||||||
|
makeBread = (new Achievement(7, "makeBread", -1, -3, Item.bread, buildHoe))
|
||||||
|
.registerAchievement();
|
||||||
|
|
||||||
|
bakeCake = (new Achievement(8, "bakeCake", 0, -5, Item.cake, buildHoe))
|
||||||
|
.registerAchievement();
|
||||||
|
|
||||||
|
buildBetterPickaxe = (new Achievement(9, "buildBetterPickaxe", 6, 2, Item.pickaxeStone,
|
||||||
|
buildPickaxe)).registerAchievement();
|
||||||
|
|
||||||
|
cookFish = (new Achievement(10, "cookFish", 2, 6, Item.fishCooked, buildFurnace))
|
||||||
|
.registerAchievement();
|
||||||
|
|
||||||
|
onARail = (new Achievement(11, "onARail", 2, 3, Block.rail, acquireIron)).setSpecial()
|
||||||
|
.registerAchievement();
|
||||||
|
|
||||||
|
buildSword = (new Achievement(12, "buildSword", 6, -1, Item.swordWood, buildWorkBench))
|
||||||
|
.registerAchievement();
|
||||||
|
|
||||||
|
killEnemy = (new Achievement(13, "killEnemy", 8, -1, Item.bone, buildSword))
|
||||||
|
.registerAchievement();
|
||||||
|
|
||||||
|
killCow = (new Achievement(14, "killCow", 7, -3, Item.leather, buildSword))
|
||||||
|
.registerAchievement();
|
||||||
|
|
||||||
|
flyPig = (new Achievement(15, "flyPig", 8, -4, Item.saddle, killCow)).setSpecial()
|
||||||
|
.registerAchievement();
|
||||||
|
|
||||||
|
snipeSkeleton = (new Achievement(16, "snipeSkeleton", 7, 0, Item.bow, killEnemy))
|
||||||
|
.setSpecial().registerAchievement();
|
||||||
|
|
||||||
|
diamonds = (new Achievement(17, "diamonds", -1, 5, Item.diamond, acquireIron))
|
||||||
|
.registerAchievement();
|
||||||
|
|
||||||
|
portal = (new Achievement(18, "portal", -1, 7, Block.obsidian, diamonds))
|
||||||
|
.registerAchievement();
|
||||||
|
|
||||||
|
ghast = (new Achievement(19, "ghast", -4, 8, Item.ghastTear, portal)).setSpecial()
|
||||||
|
.registerAchievement();
|
||||||
|
|
||||||
|
blazeRod = (new Achievement(20, "blazeRod", 0, 9, Item.blazeRod, portal))
|
||||||
|
.registerAchievement();
|
||||||
|
|
||||||
|
potion = (new Achievement(21, "potion", 2, 8, Item.potion, blazeRod))
|
||||||
|
.registerAchievement();
|
||||||
|
|
||||||
|
theEnd = (new Achievement(22, "theEnd", 3, 10, Item.eyeOfEnder, blazeRod)).setSpecial()
|
||||||
|
.registerAchievement();
|
||||||
|
|
||||||
|
theEnd2 = (new Achievement(23, "theEnd2", 4, 13, Block.dragonEgg, theEnd)).setSpecial()
|
||||||
|
.registerAchievement();
|
||||||
|
|
||||||
|
enchantments = (new Achievement(24, "enchantments", -4, 4, Block.enchantmentTable,
|
||||||
|
diamonds)).registerAchievement();
|
||||||
|
|
||||||
|
overkill = (new Achievement(25, "overkill", -4, 1, Item.swordDiamond, enchantments))
|
||||||
|
.setSpecial().registerAchievement();
|
||||||
|
|
||||||
|
bookcase = (new Achievement(26, "bookcase", -3, 6, Block.bookShelf, enchantments))
|
||||||
|
.registerAchievement();
|
||||||
}
|
}
|
||||||
|
|
||||||
static {
|
|
||||||
System.out.println(achievementList.size() + " achievements");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@ public class AchievementMap {
|
||||||
|
|
||||||
public static void init(List<String> guid) {
|
public static void init(List<String> guid) {
|
||||||
instance = new AchievementMap(guid);
|
instance = new AchievementMap(guid);
|
||||||
|
StatList.initAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Maps a achievement id with it's unique GUID. */
|
/** Maps a achievement id with it's unique GUID. */
|
||||||
|
|
|
@ -1341,6 +1341,5 @@ public class Block {
|
||||||
}
|
}
|
||||||
|
|
||||||
canBlockGrass[0] = true;
|
canBlockGrass[0] = true;
|
||||||
StatList.initBreakableStats();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -617,7 +617,4 @@ public class Item {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static {
|
|
||||||
StatList.initStats();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,19 +54,19 @@ public class Packet51MapChunk extends Packet {
|
||||||
this.zCh = par1Chunk.zPosition;
|
this.zCh = par1Chunk.zPosition;
|
||||||
this.includeInitialize = par2;
|
this.includeInitialize = par2;
|
||||||
Packet51MapChunkData var4 = getMapChunkData(par1Chunk, par2, par3);
|
Packet51MapChunkData var4 = getMapChunkData(par1Chunk, par2, par3);
|
||||||
Deflater var5 = new Deflater(-1);
|
//Deflater var5 = new Deflater(-1);
|
||||||
this.yChMax = var4.chunkHasAddSectionFlag;
|
this.yChMax = var4.chunkHasAddSectionFlag;
|
||||||
this.yChMin = var4.chunkExistFlag;
|
this.yChMin = var4.chunkExistFlag;
|
||||||
|
|
||||||
try {
|
//try {
|
||||||
this.compressedChunkData = var4.compressedData;
|
//this.compressedChunkData = var4.compressedData;
|
||||||
var5.setInput(var4.compressedData, 0, var4.compressedData.length);
|
//var5.setInput(var4.compressedData, 0, var4.compressedData.length);
|
||||||
var5.finish();
|
//var5.finish();
|
||||||
this.chunkData = new byte[var4.compressedData.length];
|
this.chunkData = var4.compressedData;
|
||||||
this.tempLength = var5.deflate(this.chunkData);
|
this.tempLength = var4.compressedData.length;
|
||||||
} finally {
|
//} finally {
|
||||||
var5.end();
|
// var5.end();
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -79,7 +79,9 @@ public class Packet51MapChunk extends Packet {
|
||||||
this.yChMin = par1DataInputStream.readShort();
|
this.yChMin = par1DataInputStream.readShort();
|
||||||
this.yChMax = par1DataInputStream.readShort();
|
this.yChMax = par1DataInputStream.readShort();
|
||||||
this.tempLength = par1DataInputStream.readInt();
|
this.tempLength = par1DataInputStream.readInt();
|
||||||
|
this.compressedChunkData = new byte[this.tempLength];
|
||||||
|
par1DataInputStream.readFully(this.compressedChunkData, 0, this.tempLength);
|
||||||
|
/*
|
||||||
if (temp.length < this.tempLength) {
|
if (temp.length < this.tempLength) {
|
||||||
temp = new byte[this.tempLength];
|
temp = new byte[this.tempLength];
|
||||||
}
|
}
|
||||||
|
@ -109,6 +111,7 @@ public class Packet51MapChunk extends Packet {
|
||||||
} finally {
|
} finally {
|
||||||
var4.end();
|
var4.end();
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -120,7 +123,7 @@ public class Packet51MapChunk extends Packet {
|
||||||
par1DataOutputStream.writeBoolean(this.includeInitialize);
|
par1DataOutputStream.writeBoolean(this.includeInitialize);
|
||||||
par1DataOutputStream.writeShort((short) (this.yChMin & 65535));
|
par1DataOutputStream.writeShort((short) (this.yChMin & 65535));
|
||||||
par1DataOutputStream.writeShort((short) (this.yChMax & 65535));
|
par1DataOutputStream.writeShort((short) (this.yChMax & 65535));
|
||||||
par1DataOutputStream.writeInt(this.tempLength);
|
par1DataOutputStream.writeInt(this.tempLength | 0x10000000);
|
||||||
par1DataOutputStream.write(this.chunkData, 0, this.tempLength);
|
par1DataOutputStream.write(this.chunkData, 0, this.tempLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,9 +4,6 @@ import java.io.DataInputStream;
|
||||||
import java.io.DataOutputStream;
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.zip.DataFormatException;
|
|
||||||
import java.util.zip.Deflater;
|
|
||||||
import java.util.zip.Inflater;
|
|
||||||
|
|
||||||
public class Packet56MapChunks extends Packet {
|
public class Packet56MapChunks extends Packet {
|
||||||
private int[] chunkPostX;
|
private int[] chunkPostX;
|
||||||
|
@ -60,75 +57,17 @@ public class Packet56MapChunks extends Packet {
|
||||||
this.field_73584_f[var4] = var6.compressedData;
|
this.field_73584_f[var4] = var6.compressedData;
|
||||||
}
|
}
|
||||||
|
|
||||||
Deflater var11 = new Deflater(-1);
|
|
||||||
|
|
||||||
try {
|
|
||||||
var11.setInput(chunkDataNotCompressed, 0, var3);
|
|
||||||
var11.finish();
|
|
||||||
this.chunkDataBuffer = new byte[var3];
|
this.chunkDataBuffer = new byte[var3];
|
||||||
this.dataLength = var11.deflate(this.chunkDataBuffer);
|
System.arraycopy(chunkDataNotCompressed, 0, this.chunkDataBuffer, 0, var3);
|
||||||
} finally {
|
this.dataLength = this.chunkDataBuffer.length;
|
||||||
var11.end();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Abstract. Reads the raw packet data from the data stream.
|
* Abstract. Reads the raw packet data from the data stream.
|
||||||
*/
|
*/
|
||||||
public void readPacketData(DataInputStream par1DataInputStream) throws IOException {
|
public void readPacketData(DataInputStream par1DataInputStream) throws IOException {
|
||||||
short var2 = par1DataInputStream.readShort();
|
// not used in server
|
||||||
this.dataLength = par1DataInputStream.readInt();
|
|
||||||
this.skyLightSent = par1DataInputStream.readBoolean();
|
|
||||||
this.chunkPostX = new int[var2];
|
|
||||||
this.chunkPosZ = new int[var2];
|
|
||||||
this.field_73590_a = new int[var2];
|
|
||||||
this.field_73588_b = new int[var2];
|
|
||||||
this.field_73584_f = new byte[var2][];
|
|
||||||
|
|
||||||
if (chunkDataNotCompressed.length < this.dataLength) {
|
|
||||||
chunkDataNotCompressed = new byte[this.dataLength];
|
|
||||||
}
|
|
||||||
|
|
||||||
par1DataInputStream.readFully(chunkDataNotCompressed, 0, this.dataLength);
|
|
||||||
byte[] var3 = new byte[196864 * var2];
|
|
||||||
Inflater var4 = new Inflater();
|
|
||||||
var4.setInput(chunkDataNotCompressed, 0, this.dataLength);
|
|
||||||
|
|
||||||
try {
|
|
||||||
var4.inflate(var3);
|
|
||||||
} catch (DataFormatException var12) {
|
|
||||||
throw new IOException("Bad compressed data format");
|
|
||||||
} finally {
|
|
||||||
var4.end();
|
|
||||||
}
|
|
||||||
|
|
||||||
int var5 = 0;
|
|
||||||
|
|
||||||
for (int var6 = 0; var6 < var2; ++var6) {
|
|
||||||
this.chunkPostX[var6] = par1DataInputStream.readInt();
|
|
||||||
this.chunkPosZ[var6] = par1DataInputStream.readInt();
|
|
||||||
this.field_73590_a[var6] = par1DataInputStream.readShort();
|
|
||||||
this.field_73588_b[var6] = par1DataInputStream.readShort();
|
|
||||||
int var7 = 0;
|
|
||||||
int var8 = 0;
|
|
||||||
int var9;
|
|
||||||
|
|
||||||
for (var9 = 0; var9 < 16; ++var9) {
|
|
||||||
var7 += this.field_73590_a[var6] >> var9 & 1;
|
|
||||||
var8 += this.field_73588_b[var6] >> var9 & 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
var9 = 2048 * 4 * var7 + 256;
|
|
||||||
var9 += 2048 * var8;
|
|
||||||
|
|
||||||
if (this.skyLightSent) {
|
|
||||||
var9 += 2048 * var7;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.field_73584_f[var6] = new byte[var9];
|
|
||||||
System.arraycopy(var3, var5, this.field_73584_f[var6], 0, var9);
|
|
||||||
var5 += var9;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -105,15 +105,9 @@ public class StatList {
|
||||||
|
|
||||||
/** Tracks the number of times a given block or item has been broken. */
|
/** Tracks the number of times a given block or item has been broken. */
|
||||||
public static StatBase[] objectBreakStats;
|
public static StatBase[] objectBreakStats;
|
||||||
private static boolean blockStatsInitialized;
|
private static boolean blockStatsInitialized = false;
|
||||||
private static boolean itemStatsInitialized;
|
private static boolean itemStatsInitialized = false;
|
||||||
|
|
||||||
/**
|
|
||||||
* This method simply NOPs. It is presumably used to call the static
|
|
||||||
* constructors on server start.
|
|
||||||
*/
|
|
||||||
public static void nopInit() {
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes statistic fields related to breakable items and blocks.
|
* Initializes statistic fields related to breakable items and blocks.
|
||||||
|
@ -132,6 +126,11 @@ public class StatList {
|
||||||
initCraftableStats();
|
initCraftableStats();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void initAll() {
|
||||||
|
initStats();
|
||||||
|
initBreakableStats();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes statistics related to craftable items. Is only called after both
|
* Initializes statistics related to craftable items. Is only called after both
|
||||||
* block and item stats have been initialized.
|
* block and item stats have been initialized.
|
||||||
|
@ -271,9 +270,4 @@ public class StatList {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static {
|
|
||||||
AchievementList.init();
|
|
||||||
blockStatsInitialized = false;
|
|
||||||
itemStatsInitialized = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -481,7 +481,7 @@ public class GuiIngame extends Gui {
|
||||||
var8.drawStringWithShadow(info.get(i), (int)(var6 / 0.75f) - var8.getStringWidth(info.get(i)) - 2, 12 + i * 10, 14737632);
|
var8.drawStringWithShadow(info.get(i), (int)(var6 / 0.75f) - var8.getStringWidth(info.get(i)) - 2, 12 + i * 10, 14737632);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
if(mc.currentScreen == null || !(mc.currentScreen instanceof GuiIngameMenu)) {
|
if(mc.currentScreen == null || !(mc.currentScreen instanceof GuiIngameMenu)) {
|
||||||
int offset = this.mc.isChatOpen() ? 135 : 0;
|
int offset = this.mc.isChatOpen() ? 135 : 0;
|
||||||
int offset2 = this.mc.isChatOpen() ? 4 : 0;
|
int offset2 = this.mc.isChatOpen() ? 4 : 0;
|
||||||
|
@ -490,6 +490,7 @@ public class GuiIngame extends Gui {
|
||||||
str = "eaglercraft: " + ConfigConstants.version;
|
str = "eaglercraft: " + ConfigConstants.version;
|
||||||
var8.drawStringWithShadow(str, (var6 * 4 / 3) - 2 - var8.getStringWidth(str) - offset, 12 + offset2, 14737632);
|
var8.drawStringWithShadow(str, (var6 * 4 / 3) - 2 - var8.getStringWidth(str) - offset, 12 + offset2, 14737632);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
EaglerAdapter.glPopMatrix();
|
EaglerAdapter.glPopMatrix();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,6 +61,9 @@ public class Packet51MapChunk extends Packet {
|
||||||
this.yChMax = par1DataInputStream.readShort();
|
this.yChMax = par1DataInputStream.readShort();
|
||||||
this.tempLength = par1DataInputStream.readInt();
|
this.tempLength = par1DataInputStream.readInt();
|
||||||
|
|
||||||
|
boolean compress = (this.tempLength & 0x10000000) != 0x10000000; // stupid
|
||||||
|
|
||||||
|
if(compress) {
|
||||||
if (temp.length < this.tempLength) {
|
if (temp.length < this.tempLength) {
|
||||||
temp = new byte[this.tempLength];
|
temp = new byte[this.tempLength];
|
||||||
}
|
}
|
||||||
|
@ -80,6 +83,12 @@ public class Packet51MapChunk extends Packet {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.compressedChunkData = EaglerInflater.uncompress(temp);
|
this.compressedChunkData = EaglerInflater.uncompress(temp);
|
||||||
|
}else {
|
||||||
|
this.tempLength &= 0xFFFFFFF;
|
||||||
|
this.compressedChunkData = new byte[this.tempLength];
|
||||||
|
par1DataInputStream.readFully(this.compressedChunkData, 0, this.tempLength);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -113,84 +122,4 @@ public class Packet51MapChunk extends Packet {
|
||||||
return this.compressedChunkData;
|
return this.compressedChunkData;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Packet51MapChunkData getMapChunkData(Chunk par0Chunk, boolean par1, int par2) {
|
|
||||||
int var3 = 0;
|
|
||||||
ExtendedBlockStorage[] var4 = par0Chunk.getBlockStorageArray();
|
|
||||||
int var5 = 0;
|
|
||||||
Packet51MapChunkData var6 = new Packet51MapChunkData();
|
|
||||||
byte[] var7 = temp;
|
|
||||||
|
|
||||||
if (par1) {
|
|
||||||
par0Chunk.sendUpdates = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
int var8;
|
|
||||||
|
|
||||||
for (var8 = 0; var8 < var4.length; ++var8) {
|
|
||||||
if (var4[var8] != null && (!par1 || !var4[var8].isEmpty()) && (par2 & 1 << var8) != 0) {
|
|
||||||
var6.chunkExistFlag |= 1 << var8;
|
|
||||||
|
|
||||||
if (var4[var8].getBlockMSBArray() != null) {
|
|
||||||
var6.chunkHasAddSectionFlag |= 1 << var8;
|
|
||||||
++var5;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (var8 = 0; var8 < var4.length; ++var8) {
|
|
||||||
if (var4[var8] != null && (!par1 || !var4[var8].isEmpty()) && (par2 & 1 << var8) != 0) {
|
|
||||||
byte[] var9 = var4[var8].getBlockLSBArray();
|
|
||||||
System.arraycopy(var9, 0, var7, var3, var9.length);
|
|
||||||
var3 += var9.length;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
NibbleArray var10;
|
|
||||||
|
|
||||||
for (var8 = 0; var8 < var4.length; ++var8) {
|
|
||||||
if (var4[var8] != null && (!par1 || !var4[var8].isEmpty()) && (par2 & 1 << var8) != 0) {
|
|
||||||
var10 = var4[var8].getMetadataArray();
|
|
||||||
System.arraycopy(var10.data, 0, var7, var3, var10.data.length);
|
|
||||||
var3 += var10.data.length;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (var8 = 0; var8 < var4.length; ++var8) {
|
|
||||||
if (var4[var8] != null && (!par1 || !var4[var8].isEmpty()) && (par2 & 1 << var8) != 0) {
|
|
||||||
var10 = var4[var8].getBlocklightArray();
|
|
||||||
System.arraycopy(var10.data, 0, var7, var3, var10.data.length);
|
|
||||||
var3 += var10.data.length;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!par0Chunk.worldObj.provider.hasNoSky) {
|
|
||||||
for (var8 = 0; var8 < var4.length; ++var8) {
|
|
||||||
if (var4[var8] != null && (!par1 || !var4[var8].isEmpty()) && (par2 & 1 << var8) != 0) {
|
|
||||||
var10 = var4[var8].getSkylightArray();
|
|
||||||
System.arraycopy(var10.data, 0, var7, var3, var10.data.length);
|
|
||||||
var3 += var10.data.length;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (var5 > 0) {
|
|
||||||
for (var8 = 0; var8 < var4.length; ++var8) {
|
|
||||||
if (var4[var8] != null && (!par1 || !var4[var8].isEmpty()) && var4[var8].getBlockMSBArray() != null && (par2 & 1 << var8) != 0) {
|
|
||||||
var10 = var4[var8].getBlockMSBArray();
|
|
||||||
System.arraycopy(var10.data, 0, var7, var3, var10.data.length);
|
|
||||||
var3 += var10.data.length;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (par1) {
|
|
||||||
byte[] var11 = par0Chunk.getBiomeArray();
|
|
||||||
System.arraycopy(var11, 0, var7, var3, var11.length);
|
|
||||||
var3 += var11.length;
|
|
||||||
}
|
|
||||||
|
|
||||||
var6.compressedData = new byte[var3];
|
|
||||||
System.arraycopy(var7, 0, var6.compressedData, 0, var3);
|
|
||||||
return var6;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,8 +5,6 @@ import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import net.lax1dude.eaglercraft.EaglerInflater;
|
|
||||||
|
|
||||||
public class Packet56MapChunks extends Packet {
|
public class Packet56MapChunks extends Packet {
|
||||||
private int[] chunkPostX;
|
private int[] chunkPostX;
|
||||||
private int[] chunkPosZ;
|
private int[] chunkPosZ;
|
||||||
|
@ -46,12 +44,8 @@ public class Packet56MapChunks extends Packet {
|
||||||
this.field_73588_b = new int[var2];
|
this.field_73588_b = new int[var2];
|
||||||
this.field_73584_f = new byte[var2][];
|
this.field_73584_f = new byte[var2][];
|
||||||
|
|
||||||
if (chunkDataNotCompressed.length < this.dataLength) {
|
byte[] var3 = new byte[this.dataLength];
|
||||||
chunkDataNotCompressed = new byte[this.dataLength];
|
par1DataInputStream.readFully(var3, 0, this.dataLength);
|
||||||
}
|
|
||||||
|
|
||||||
par1DataInputStream.readFully(chunkDataNotCompressed, 0, this.dataLength);
|
|
||||||
byte[] var3 = EaglerInflater.uncompress(chunkDataNotCompressed);
|
|
||||||
|
|
||||||
int var5 = 0;
|
int var5 = 0;
|
||||||
|
|
||||||
|
|
|
@ -83,8 +83,10 @@ import org.teavm.jso.workers.Worker;
|
||||||
import net.lax1dude.eaglercraft.AssetRepository;
|
import net.lax1dude.eaglercraft.AssetRepository;
|
||||||
import net.lax1dude.eaglercraft.Base64;
|
import net.lax1dude.eaglercraft.Base64;
|
||||||
import net.lax1dude.eaglercraft.EaglerImage;
|
import net.lax1dude.eaglercraft.EaglerImage;
|
||||||
|
import net.lax1dude.eaglercraft.EaglerProfile;
|
||||||
import net.lax1dude.eaglercraft.EarlyLoadScreen;
|
import net.lax1dude.eaglercraft.EarlyLoadScreen;
|
||||||
import net.lax1dude.eaglercraft.ExpiringSet;
|
import net.lax1dude.eaglercraft.ExpiringSet;
|
||||||
|
import net.lax1dude.eaglercraft.IntegratedServer;
|
||||||
import net.lax1dude.eaglercraft.LocalStorageManager;
|
import net.lax1dude.eaglercraft.LocalStorageManager;
|
||||||
import net.lax1dude.eaglercraft.PKT;
|
import net.lax1dude.eaglercraft.PKT;
|
||||||
import net.lax1dude.eaglercraft.ServerQuery;
|
import net.lax1dude.eaglercraft.ServerQuery;
|
||||||
|
@ -94,6 +96,7 @@ import net.lax1dude.eaglercraft.adapter.teavm.SelfDefence;
|
||||||
import net.lax1dude.eaglercraft.adapter.teavm.WebGL2RenderingContext;
|
import net.lax1dude.eaglercraft.adapter.teavm.WebGL2RenderingContext;
|
||||||
import net.lax1dude.eaglercraft.adapter.teavm.WebGLQuery;
|
import net.lax1dude.eaglercraft.adapter.teavm.WebGLQuery;
|
||||||
import net.lax1dude.eaglercraft.adapter.teavm.WebGLVertexArray;
|
import net.lax1dude.eaglercraft.adapter.teavm.WebGLVertexArray;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.src.MathHelper;
|
import net.minecraft.src.MathHelper;
|
||||||
|
|
||||||
public class EaglerAdapterImpl2 {
|
public class EaglerAdapterImpl2 {
|
||||||
|
@ -1833,6 +1836,9 @@ public class EaglerAdapterImpl2 {
|
||||||
enableVoice(Voice.VoiceChannel.NONE);
|
enableVoice(Voice.VoiceChannel.NONE);
|
||||||
}
|
}
|
||||||
public static final boolean connectionOpen() {
|
public static final boolean connectionOpen() {
|
||||||
|
if(IntegratedServer.doesChannelExist(EaglerProfile.username)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
if(sock == null || sock.getReadyState() == 3) {
|
if(sock == null || sock.getReadyState() == 3) {
|
||||||
sockIsConnecting = false;
|
sockIsConnecting = false;
|
||||||
}
|
}
|
||||||
|
@ -1857,7 +1863,7 @@ public class EaglerAdapterImpl2 {
|
||||||
public static final byte[] loadLocalStorage(String key) {
|
public static final byte[] loadLocalStorage(String key) {
|
||||||
Storage strg = win.getLocalStorage();
|
Storage strg = win.getLocalStorage();
|
||||||
if(strg != null) {
|
if(strg != null) {
|
||||||
String s =strg.getItem("_eaglercraft."+key);
|
String s = strg.getItem("_eaglercraft."+key);
|
||||||
if(s != null) {
|
if(s != null) {
|
||||||
return Base64.decodeBase64(s);
|
return Base64.decodeBase64(s);
|
||||||
}else {
|
}else {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user