Got the world to render
This commit is contained in:
parent
4e1b162982
commit
727d0570d5
File diff suppressed because one or more lines are too long
|
@ -68,6 +68,8 @@ import net.lax1dude.eaglercraft.AssetRepository;
|
|||
import net.lax1dude.eaglercraft.Base64;
|
||||
import net.lax1dude.eaglercraft.Client;
|
||||
import net.lax1dude.eaglercraft.EaglerImage;
|
||||
import net.lax1dude.eaglercraft.adapter.teavm.IndexedDBFilesystem;
|
||||
import net.lax1dude.eaglercraft.adapter.teavm.IndexedDBFilesystem.OpenState;
|
||||
//import net.lax1dude.eaglercraft.adapter.teavm.IndexedDBFilesystem;
|
||||
//import net.lax1dude.eaglercraft.adapter.teavm.IndexedDBFilesystem.OpenState;
|
||||
import net.lax1dude.eaglercraft.adapter.teavm.WebGL2RenderingContext;
|
||||
|
@ -307,15 +309,15 @@ public class EaglerAdapterImpl2 {
|
|||
onBeforeCloseRegister();
|
||||
initFileChooser();
|
||||
|
||||
// OpenState st = IndexedDBFilesystem.initialize();
|
||||
// if(st != OpenState.OPENED) {
|
||||
// if(st == OpenState.LOCKED) {
|
||||
// Client.showDatabaseLockedScreen("\nError: World folder is locked!\n\nYou are already playing Eaglercraft in a different tab.\nClose all other Eaglercraft tabs and reload");
|
||||
// }else {
|
||||
// Client.showDatabaseLockedScreen("\nError: World folder could not be loaded!\n\n" + IndexedDBFilesystem.errorDetail());
|
||||
// }
|
||||
// throw new Client.AbortedLaunchException();
|
||||
// }
|
||||
OpenState st = IndexedDBFilesystem.initialize();
|
||||
if(st != OpenState.OPENED) {
|
||||
if(st == OpenState.LOCKED) {
|
||||
Client.showDatabaseLockedScreen("\nError: World folder is locked!\n\nYou are already playing Eaglercraft in a different tab.\nClose all other Eaglercraft tabs and reload");
|
||||
}else {
|
||||
Client.showDatabaseLockedScreen("\nError: World folder could not be loaded!\n\n" + IndexedDBFilesystem.errorDetail());
|
||||
}
|
||||
throw new Client.AbortedLaunchException();
|
||||
}
|
||||
|
||||
downloadAssetPack(assetPackageURI);
|
||||
|
||||
|
@ -1747,54 +1749,47 @@ public class EaglerAdapterImpl2 {
|
|||
private static native boolean isString(JSObject obj);
|
||||
|
||||
public static final boolean fileExists(String path) {
|
||||
//return IndexedDBFilesystem.fileExists(path);
|
||||
return false;
|
||||
return IndexedDBFilesystem.fileExists(path);
|
||||
}
|
||||
|
||||
public static final boolean directoryExists(String path) {
|
||||
//return IndexedDBFilesystem.directoryExists(path);
|
||||
return false;
|
||||
return IndexedDBFilesystem.directoryExists(path);
|
||||
}
|
||||
|
||||
public static final boolean pathExists(String path) {
|
||||
//return IndexedDBFilesystem.pathExists(path);
|
||||
return false;
|
||||
return IndexedDBFilesystem.pathExists(path);
|
||||
}
|
||||
|
||||
public static final void writeFile(String path, byte[] data) {
|
||||
//IndexedDBFilesystem.writeFile(path, data);
|
||||
IndexedDBFilesystem.writeFile(path, data);
|
||||
}
|
||||
|
||||
public static final byte[] readFile(String path) {
|
||||
//return IndexedDBFilesystem.readFile(path);
|
||||
return null;
|
||||
return IndexedDBFilesystem.readFile(path);
|
||||
}
|
||||
|
||||
public static final long getLastModified(String path) {
|
||||
//return IndexedDBFilesystem.getLastModified(path);
|
||||
return 0L;
|
||||
return IndexedDBFilesystem.getLastModified(path);
|
||||
}
|
||||
|
||||
public static final int getFileSize(String path) {
|
||||
//return IndexedDBFilesystem.getFileSize(path);
|
||||
return 0;
|
||||
return IndexedDBFilesystem.getFileSize(path);
|
||||
}
|
||||
|
||||
public static final void renameFile(String oldPath, String newPath) {
|
||||
//IndexedDBFilesystem.renameFile(oldPath, newPath);
|
||||
IndexedDBFilesystem.renameFile(oldPath, newPath);
|
||||
}
|
||||
|
||||
public static final void copyFile(String oldPath, String newPath) {
|
||||
//IndexedDBFilesystem.copyFile(oldPath, newPath);
|
||||
IndexedDBFilesystem.copyFile(oldPath, newPath);
|
||||
}
|
||||
|
||||
public static final void deleteFile(String path) {
|
||||
//IndexedDBFilesystem.deleteFile(path);
|
||||
IndexedDBFilesystem.deleteFile(path);
|
||||
}
|
||||
|
||||
public static final Collection<FileEntry> listFiles(String path, boolean listDirs, boolean recursiveDirs) {
|
||||
//return IndexedDBFilesystem.listFiles(path, listDirs, recursiveDirs);
|
||||
return null;
|
||||
return IndexedDBFilesystem.listFiles(path, listDirs, recursiveDirs);
|
||||
}
|
||||
|
||||
public static final Collection<FileEntry> listFilesAndDirectories(String path) {
|
||||
|
|
|
@ -0,0 +1,79 @@
|
|||
package net.lax1dude.eaglercraft.adapter.teavm;
|
||||
|
||||
import org.teavm.jso.JSBody;
|
||||
import org.teavm.jso.JSObject;
|
||||
import org.teavm.jso.JSProperty;
|
||||
import org.teavm.jso.core.JSString;
|
||||
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);
|
||||
}
|
|
@ -0,0 +1,407 @@
|
|||
package net.lax1dude.eaglercraft.adapter.teavm;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedList;
|
||||
|
||||
import org.teavm.interop.Async;
|
||||
import org.teavm.interop.AsyncCallback;
|
||||
import org.teavm.jso.JSBody;
|
||||
import org.teavm.jso.JSObject;
|
||||
import org.teavm.jso.dom.events.EventListener;
|
||||
import org.teavm.jso.indexeddb.EventHandler;
|
||||
import org.teavm.jso.indexeddb.IDBCountRequest;
|
||||
import org.teavm.jso.indexeddb.IDBCursor;
|
||||
import org.teavm.jso.indexeddb.IDBCursorRequest;
|
||||
import org.teavm.jso.indexeddb.IDBDatabase;
|
||||
import org.teavm.jso.indexeddb.IDBFactory;
|
||||
import org.teavm.jso.indexeddb.IDBGetRequest;
|
||||
import org.teavm.jso.indexeddb.IDBObjectStoreParameters;
|
||||
import org.teavm.jso.indexeddb.IDBOpenDBRequest;
|
||||
import org.teavm.jso.indexeddb.IDBRequest;
|
||||
import org.teavm.jso.indexeddb.IDBTransaction;
|
||||
import org.teavm.jso.indexeddb.IDBVersionChangeEvent;
|
||||
import org.teavm.jso.typedarrays.ArrayBuffer;
|
||||
import org.teavm.jso.typedarrays.Uint8Array;
|
||||
|
||||
import net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2;
|
||||
import net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2.FileEntry;
|
||||
|
||||
public class IndexedDBFilesystem {
|
||||
|
||||
public static enum OpenState {
|
||||
OPENED, LOCKED, ERROR
|
||||
}
|
||||
|
||||
private static String err = "";
|
||||
private static IDBDatabase db = null;
|
||||
|
||||
public static final OpenState initialize() {
|
||||
DatabaseOpen dbo = AsyncHandlers.openDB("_net_lax1dude_eaglercraft_beta_IndexedDBFilesystem_1_3");
|
||||
if(dbo == null) {
|
||||
err = "Unknown Error";
|
||||
return OpenState.ERROR;
|
||||
}
|
||||
if(dbo.failedLocked) {
|
||||
return OpenState.LOCKED;
|
||||
}
|
||||
if(dbo.failedInit || dbo.database == null) {
|
||||
err = dbo.failedError == null ? "Initialization Failed" : dbo.failedError;
|
||||
return OpenState.ERROR;
|
||||
}
|
||||
db = dbo.database;
|
||||
return OpenState.OPENED;
|
||||
}
|
||||
|
||||
public static final String errorDetail() {
|
||||
return err;
|
||||
}
|
||||
|
||||
public static final boolean fileExists(String path) {
|
||||
return AsyncHandlers.fileGetType(db, path) == FileExists.FILE;
|
||||
}
|
||||
|
||||
public static final boolean directoryExists(String path) {
|
||||
return AsyncHandlers.fileGetType(db, path) == FileExists.DIRECTORY;
|
||||
}
|
||||
|
||||
public static final boolean pathExists(String path) {
|
||||
return AsyncHandlers.fileExists(db, path).bool;
|
||||
}
|
||||
|
||||
private static final void mkdir(String dir) {
|
||||
if(directoryExists(dir)) {
|
||||
return;
|
||||
}
|
||||
int i = dir.lastIndexOf('/');
|
||||
if(i > 0) {
|
||||
mkdir(dir.substring(0, i));
|
||||
}
|
||||
AsyncHandlers.writeWholeFile(db, dir, true, ArrayBuffer.create(0));
|
||||
}
|
||||
|
||||
public static final void writeFile(String path, byte[] data) {
|
||||
int i = path.lastIndexOf('/');
|
||||
if(i > 0) {
|
||||
mkdir(path.substring(0, i));
|
||||
}
|
||||
Uint8Array arr = Uint8Array.create(data.length);
|
||||
arr.set(data);
|
||||
AsyncHandlers.writeWholeFile(db, path, false, arr.getBuffer());
|
||||
}
|
||||
|
||||
public static final byte[] readFile(String path) {
|
||||
ArrayBuffer arr = AsyncHandlers.readWholeFile(db, path);
|
||||
if(arr == null) {
|
||||
return null;
|
||||
}
|
||||
byte[] data = new byte[arr.getByteLength()];
|
||||
Uint8Array arrr = Uint8Array.create(arr);
|
||||
for(int i = 0; i < data.length; ++i) {
|
||||
data[i] = (byte) arrr.get(i);
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
public static final long getLastModified(String path) {
|
||||
int lm = AsyncHandlers.fileGetLastModified(db, path);
|
||||
return lm == -1 ? -1l : AsyncHandlers.eaglercraftEpoch + lm;
|
||||
}
|
||||
|
||||
public static final int getFileSize(String path) {
|
||||
ArrayBuffer arr = AsyncHandlers.readWholeFile(db, path);
|
||||
if(arr == null) {
|
||||
return -1;
|
||||
}else {
|
||||
return arr.getByteLength();
|
||||
}
|
||||
}
|
||||
|
||||
public static final void renameFile(String oldPath, String newPath) {
|
||||
copyFile(oldPath, newPath);
|
||||
AsyncHandlers.deleteFile(db, oldPath);
|
||||
}
|
||||
|
||||
public static final void copyFile(String oldPath, String newPath) {
|
||||
ArrayBuffer arr = AsyncHandlers.readWholeFile(db, oldPath);
|
||||
int i = newPath.lastIndexOf('/');
|
||||
if(i > 0) {
|
||||
mkdir(newPath.substring(0, i));
|
||||
}
|
||||
AsyncHandlers.writeWholeFile(db, newPath, false, arr);
|
||||
}
|
||||
|
||||
public static final void deleteFile(String path) {
|
||||
AsyncHandlers.deleteFile(db, path);
|
||||
}
|
||||
|
||||
public static final Collection<FileEntry> listFiles(String path, boolean listDirs, boolean recursiveDirs) {
|
||||
LinkedList<FileEntry> lst = new LinkedList<FileEntry>();
|
||||
AsyncHandlers.iterateFiles(db, path, listDirs, recursiveDirs, lst);
|
||||
return lst;
|
||||
}
|
||||
|
||||
protected static class BooleanResult {
|
||||
|
||||
protected static final BooleanResult TRUE = new BooleanResult(true);
|
||||
protected static final BooleanResult FALSE = new BooleanResult(false);
|
||||
|
||||
protected final boolean bool;
|
||||
|
||||
private BooleanResult(boolean b) {
|
||||
bool = b;
|
||||
}
|
||||
|
||||
protected static BooleanResult _new(boolean b) {
|
||||
return b ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected static class DatabaseOpen {
|
||||
|
||||
protected final boolean failedInit;
|
||||
protected final boolean failedLocked;
|
||||
protected final String failedError;
|
||||
|
||||
protected final IDBDatabase database;
|
||||
|
||||
protected DatabaseOpen(boolean init, boolean locked, String error, IDBDatabase db) {
|
||||
failedInit = init;
|
||||
failedLocked = locked;
|
||||
failedError = error;
|
||||
database = db;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected static enum FileExists {
|
||||
FILE, DIRECTORY, FALSE
|
||||
}
|
||||
|
||||
@JSBody(script = "return ((typeof indexedDB) !== 'undefined') ? indexedDB : null;")
|
||||
protected static native IDBFactory createIDBFactory();
|
||||
|
||||
protected static class AsyncHandlers {
|
||||
|
||||
protected static final long eaglercraftEpoch = 1645568542000l;
|
||||
|
||||
@Async
|
||||
protected static native DatabaseOpen openDB(String name);
|
||||
|
||||
private static void openDB(String name, final AsyncCallback<DatabaseOpen> cb) {
|
||||
IDBFactory i = createIDBFactory();
|
||||
if(i == null) {
|
||||
cb.complete(new DatabaseOpen(false, false, "window.indexedDB was null or undefined", null));
|
||||
return;
|
||||
}
|
||||
final IDBOpenDBRequest f = i.open(name, 1);
|
||||
f.setOnBlocked(new EventHandler() {
|
||||
public void handleEvent() {
|
||||
cb.complete(new DatabaseOpen(false, true, null, null));
|
||||
}
|
||||
});
|
||||
f.setOnSuccess(new EventHandler() {
|
||||
public void handleEvent() {
|
||||
cb.complete(new DatabaseOpen(false, false, null, f.getResult()));
|
||||
}
|
||||
});
|
||||
f.setOnError(new EventHandler() {
|
||||
public void handleEvent() {
|
||||
cb.complete(new DatabaseOpen(true, false, "open error", null));
|
||||
}
|
||||
});
|
||||
f.setOnUpgradeNeeded(new EventListener<IDBVersionChangeEvent>() {
|
||||
public void handleEvent(IDBVersionChangeEvent evt) {
|
||||
IDBObjectStorePatched.createObjectStorePatch(f.getResult(), "filesystem", IDBObjectStoreParameters.create().keyPath("path"));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Async
|
||||
protected static native BooleanResult deleteFile(IDBDatabase db, String name);
|
||||
|
||||
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));
|
||||
|
||||
r.setOnSuccess(new EventHandler() {
|
||||
public void handleEvent() {
|
||||
cb.complete(BooleanResult._new(true));
|
||||
}
|
||||
});
|
||||
r.setOnError(new EventHandler() {
|
||||
public void handleEvent() {
|
||||
cb.complete(BooleanResult._new(false));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@JSBody(params = { "obj" }, script = "return (typeof obj === 'undefined') ? null : ((typeof obj.data === 'undefined') ? null : obj.data);")
|
||||
protected static native ArrayBuffer readRow(JSObject obj);
|
||||
|
||||
@JSBody(params = { "obj" }, script = "return (typeof obj === 'undefined') ? false : ((typeof obj.directory === 'undefined') ? false : obj.directory);")
|
||||
protected static native boolean isRowDirectory(JSObject obj);
|
||||
|
||||
@JSBody(params = { "obj" }, script = "return (typeof obj === 'undefined') ? -1 : ((typeof obj.lastModified === 'undefined') ? -1 : obj.lastModified);")
|
||||
protected static native int readLastModified(JSObject obj);
|
||||
|
||||
@JSBody(params = { "obj" }, script = "return [obj];")
|
||||
private static native JSObject makeTheFuckingKeyWork(String k);
|
||||
|
||||
@Async
|
||||
protected static native ArrayBuffer readWholeFile(IDBDatabase db, String name);
|
||||
|
||||
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));
|
||||
r.setOnSuccess(new EventHandler() {
|
||||
public void handleEvent() {
|
||||
cb.complete(isRowDirectory(r.getResult()) ? null : readRow(r.getResult()));
|
||||
}
|
||||
});
|
||||
r.setOnError(new EventHandler() {
|
||||
public void handleEvent() {
|
||||
cb.complete(null);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Async
|
||||
protected static native Integer readLastModified(IDBDatabase db, String name);
|
||||
|
||||
private static void readLastModified(IDBDatabase db, String name, final AsyncCallback<Integer> cb) {
|
||||
IDBTransaction tx = db.transaction("filesystem", "readonly");
|
||||
final IDBGetRequest r = IDBObjectStorePatched.objectStorePatch(tx, "filesystem").get(makeTheFuckingKeyWork(name));
|
||||
r.setOnSuccess(new EventHandler() {
|
||||
public void handleEvent() {
|
||||
cb.complete(readLastModified(r.getResult()));
|
||||
}
|
||||
});
|
||||
r.setOnError(new EventHandler() {
|
||||
public void handleEvent() {
|
||||
cb.complete(-1);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@JSBody(params = { "k" }, script = "return ((typeof k) === \"string\") ? k : (((typeof k) === \"undefined\") ? null : (((typeof k[0]) === \"string\") ? k[0] : null));")
|
||||
private static native String readKey(JSObject k);
|
||||
|
||||
@Async
|
||||
protected static native Integer iterateFiles(IDBDatabase db, final String prefix, final boolean listDirs, final boolean recursiveDirs, final Collection<EaglerAdapterImpl2.FileEntry> lst);
|
||||
|
||||
private static void iterateFiles(IDBDatabase db, final String prefix, final boolean listDirs, final boolean recursiveDirs, final Collection<EaglerAdapterImpl2.FileEntry> lst, final AsyncCallback<Integer> cb) {
|
||||
IDBTransaction tx = db.transaction("filesystem", "readonly");
|
||||
final IDBCursorRequest r = IDBObjectStorePatched.objectStorePatch(tx, "filesystem").openCursor();
|
||||
final int[] res = new int[1];
|
||||
r.setOnSuccess(new EventHandler() {
|
||||
public void handleEvent() {
|
||||
IDBCursor c = r.getResult();
|
||||
if(c == null || c.getKey() == null || c.getValue() == null) {
|
||||
cb.complete(res[0]);
|
||||
return;
|
||||
}
|
||||
String k = readKey(c.getKey());
|
||||
if(k != null) {
|
||||
if(k.startsWith(prefix)) {
|
||||
if(recursiveDirs || k.indexOf('/', prefix.length() + 1) == -1) {
|
||||
boolean dir = isRowDirectory(c.getValue());
|
||||
if(dir) {
|
||||
if(listDirs) {
|
||||
lst.add(new EaglerAdapterImpl2.FileEntry(k, true, -1));
|
||||
}
|
||||
}else {
|
||||
lst.add(new EaglerAdapterImpl2.FileEntry(k, false, eaglercraftEpoch + readLastModified(c.getValue())));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
c.doContinue();
|
||||
}
|
||||
});
|
||||
r.setOnError(new EventHandler() {
|
||||
public void handleEvent() {
|
||||
cb.complete(res[0] > 0 ? res[0] : -1);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Async
|
||||
protected static native BooleanResult fileExists(IDBDatabase db, String name);
|
||||
|
||||
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));
|
||||
r.setOnSuccess(new EventHandler() {
|
||||
public void handleEvent() {
|
||||
cb.complete(BooleanResult._new(r.getResult() > 0));
|
||||
}
|
||||
});
|
||||
r.setOnError(new EventHandler() {
|
||||
public void handleEvent() {
|
||||
cb.complete(BooleanResult._new(false));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Async
|
||||
protected static native Integer fileGetLastModified(IDBDatabase db, String name);
|
||||
|
||||
private static void fileGetLastModified(IDBDatabase db, String name, final AsyncCallback<Integer> cb) {
|
||||
IDBTransaction tx = db.transaction("filesystem", "readonly");
|
||||
final IDBGetRequest r = IDBObjectStorePatched.objectStorePatch(tx, "filesystem").get(makeTheFuckingKeyWork(name));
|
||||
r.setOnSuccess(new EventHandler() {
|
||||
public void handleEvent() {
|
||||
cb.complete(readLastModified(r.getResult()));
|
||||
}
|
||||
});
|
||||
r.setOnError(new EventHandler() {
|
||||
public void handleEvent() {
|
||||
cb.complete(-1);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Async
|
||||
protected static native FileExists fileGetType(IDBDatabase db, String name);
|
||||
|
||||
private static void fileGetType(IDBDatabase db, String name, final AsyncCallback<FileExists> cb) {
|
||||
IDBTransaction tx = db.transaction("filesystem", "readonly");
|
||||
final IDBGetRequest r = IDBObjectStorePatched.objectStorePatch(tx, "filesystem").get(makeTheFuckingKeyWork(name));
|
||||
r.setOnSuccess(new EventHandler() {
|
||||
public void handleEvent() {
|
||||
cb.complete(r.getResult() == null ? FileExists.FALSE : (isRowDirectory(r.getResult()) ? FileExists.DIRECTORY : FileExists.FILE));
|
||||
}
|
||||
});
|
||||
r.setOnError(new EventHandler() {
|
||||
public void handleEvent() {
|
||||
cb.complete(FileExists.FALSE);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@JSBody(params = { "pat", "dir", "lm", "dat" }, script = "return { path: pat, directory: dir, lastModified: lm, data: dat };")
|
||||
protected static native JSObject writeRow(String name, boolean directory, int lm, ArrayBuffer data);
|
||||
|
||||
@Async
|
||||
protected static native BooleanResult writeWholeFile(IDBDatabase db, String name, boolean directory, ArrayBuffer data);
|
||||
|
||||
private static void writeWholeFile(IDBDatabase db, String name, boolean directory, ArrayBuffer data, final AsyncCallback<BooleanResult> cb) {
|
||||
IDBTransaction tx = db.transaction("filesystem", "readwrite");
|
||||
final IDBRequest r = IDBObjectStorePatched.objectStorePatch(tx, "filesystem").put(writeRow(name, directory, (int)(System.currentTimeMillis() - eaglercraftEpoch), data));
|
||||
r.setOnSuccess(new EventHandler() {
|
||||
public void handleEvent() {
|
||||
cb.complete(BooleanResult._new(true));
|
||||
}
|
||||
});
|
||||
r.setOnError(new EventHandler() {
|
||||
public void handleEvent() {
|
||||
cb.complete(BooleanResult._new(false));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -261,116 +261,106 @@ public class Minecraft implements Runnable {
|
|||
|
||||
public void run() {
|
||||
this.running = true;
|
||||
this.startGame();
|
||||
|
||||
try {
|
||||
this.startGame();
|
||||
} catch (Exception var15) {
|
||||
var15.printStackTrace();
|
||||
new UnexpectedThrowable("Failed to start game", var15);
|
||||
return;
|
||||
}
|
||||
long var1 = System.currentTimeMillis();
|
||||
int var3 = 0;
|
||||
|
||||
try {
|
||||
try {
|
||||
long var1 = System.currentTimeMillis();
|
||||
int var3 = 0;
|
||||
while(this.running) {
|
||||
AxisAlignedBB.clearBoundingBoxPool();
|
||||
Vec3D.initialize();
|
||||
|
||||
while(this.running) {
|
||||
AxisAlignedBB.clearBoundingBoxPool();
|
||||
Vec3D.initialize();
|
||||
|
||||
if(this.field_6316_m && this.theWorld != null) {
|
||||
float var4 = this.timer.renderPartialTicks;
|
||||
this.timer.updateTimer();
|
||||
this.timer.renderPartialTicks = var4;
|
||||
} else {
|
||||
this.timer.updateTimer();
|
||||
}
|
||||
|
||||
long var19 = System.nanoTime();
|
||||
|
||||
for(int var6 = 0; var6 < this.timer.elapsedTicks; ++var6) {
|
||||
++this.ticksRan;
|
||||
|
||||
try {
|
||||
this.runTick();
|
||||
} catch (MinecraftException var14) {
|
||||
this.theWorld = null;
|
||||
this.func_6261_a((World)null);
|
||||
this.displayGuiScreen(new GuiConflictWarning());
|
||||
}
|
||||
}
|
||||
|
||||
long var20 = System.nanoTime() - var19;
|
||||
this.checkGLError("Pre render");
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
if(this.theWorld != null) {
|
||||
while(this.theWorld.func_6465_g()) {
|
||||
}
|
||||
}
|
||||
|
||||
if(this.gameSettings.limitFramerate) {
|
||||
Thread.sleep(5L);
|
||||
}
|
||||
|
||||
if(!(Keyboard.getEventKey() == 33 && Keyboard.isKeyDown(8))) {
|
||||
GL11.updateDisplay();
|
||||
}
|
||||
|
||||
if(!this.field_6307_v) {
|
||||
if(this.field_6327_b != null) {
|
||||
this.field_6327_b.func_6467_a(this.timer.renderPartialTicks);
|
||||
}
|
||||
|
||||
this.field_9243_r.func_4136_b(this.timer.renderPartialTicks);
|
||||
}
|
||||
|
||||
if(!GL11.isFocused()) {
|
||||
Thread.sleep(10L);
|
||||
}
|
||||
|
||||
if(Keyboard.getEventKey() == 33 && Keyboard.isKeyDown(4)) {
|
||||
this.func_6238_a(var20);
|
||||
} else {
|
||||
this.field_6290_K = System.nanoTime();
|
||||
}
|
||||
|
||||
Thread.yield();
|
||||
if(Keyboard.getEventKey() == 33 && Keyboard.isKeyDown(8)) {
|
||||
GL11.updateDisplay();
|
||||
}
|
||||
|
||||
if((GL11.getCanvasWidth() != this.displayWidth || GL11.getCanvasHeight() != this.displayHeight)) {
|
||||
this.displayWidth = GL11.getCanvasWidth();
|
||||
this.displayHeight = GL11.getCanvasHeight();
|
||||
if(this.displayWidth <= 0) {
|
||||
this.displayWidth = 1;
|
||||
}
|
||||
|
||||
if(this.displayHeight <= 0) {
|
||||
this.displayHeight = 1;
|
||||
}
|
||||
|
||||
this.resize(this.displayWidth, this.displayHeight);
|
||||
}
|
||||
|
||||
this.checkGLError("Post render");
|
||||
++var3;
|
||||
|
||||
for(this.field_6316_m = true && this.currentScreen != null && this.currentScreen.doesGuiPauseGame(); System.currentTimeMillis() >= var1 + 1000L; var3 = 0) {
|
||||
this.field_6292_I = var3 + " fps, " + WorldRenderer.field_1762_b + " chunk updates";
|
||||
WorldRenderer.field_1762_b = 0;
|
||||
var1 += 1000L;
|
||||
}
|
||||
}
|
||||
} catch (MinecraftError var16) {
|
||||
} catch (Throwable var17) {
|
||||
this.theWorld = null;
|
||||
var17.printStackTrace();
|
||||
new UnexpectedThrowable("Unexpected error", var17);
|
||||
if(this.field_6316_m && this.theWorld != null) {
|
||||
float var4 = this.timer.renderPartialTicks;
|
||||
this.timer.updateTimer();
|
||||
this.timer.renderPartialTicks = var4;
|
||||
} else {
|
||||
this.timer.updateTimer();
|
||||
}
|
||||
|
||||
} finally {
|
||||
long var19 = System.nanoTime();
|
||||
|
||||
for(int var6 = 0; var6 < this.timer.elapsedTicks; ++var6) {
|
||||
++this.ticksRan;
|
||||
|
||||
try {
|
||||
this.runTick();
|
||||
} catch (MinecraftException var14) {
|
||||
this.theWorld = null;
|
||||
this.func_6261_a((World)null);
|
||||
this.displayGuiScreen(new GuiConflictWarning());
|
||||
}
|
||||
}
|
||||
|
||||
long var20 = System.nanoTime() - var19;
|
||||
this.checkGLError("Pre render");
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
if(this.theWorld != null) {
|
||||
while(this.theWorld.func_6465_g()) {
|
||||
}
|
||||
}
|
||||
|
||||
if(this.gameSettings.limitFramerate) {
|
||||
try {
|
||||
Thread.sleep(5L);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
if(!(Keyboard.getEventKey() == 33 && Keyboard.isKeyDown(8))) {
|
||||
GL11.updateDisplay();
|
||||
}
|
||||
|
||||
if(!this.field_6307_v) {
|
||||
if(this.field_6327_b != null) {
|
||||
this.field_6327_b.func_6467_a(this.timer.renderPartialTicks);
|
||||
}
|
||||
|
||||
this.field_9243_r.func_4136_b(this.timer.renderPartialTicks);
|
||||
}
|
||||
|
||||
if(!GL11.isFocused()) {
|
||||
try {
|
||||
Thread.sleep(10L);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
if(Keyboard.getEventKey() == 33 && Keyboard.isKeyDown(4)) {
|
||||
this.func_6238_a(var20);
|
||||
} else {
|
||||
this.field_6290_K = System.nanoTime();
|
||||
}
|
||||
|
||||
Thread.yield();
|
||||
if(Keyboard.getEventKey() == 33 && Keyboard.isKeyDown(8)) {
|
||||
GL11.updateDisplay();
|
||||
}
|
||||
|
||||
if((GL11.getCanvasWidth() != this.displayWidth || GL11.getCanvasHeight() != this.displayHeight)) {
|
||||
this.displayWidth = GL11.getCanvasWidth();
|
||||
this.displayHeight = GL11.getCanvasHeight();
|
||||
if(this.displayWidth <= 0) {
|
||||
this.displayWidth = 1;
|
||||
}
|
||||
|
||||
if(this.displayHeight <= 0) {
|
||||
this.displayHeight = 1;
|
||||
}
|
||||
|
||||
this.resize(this.displayWidth, this.displayHeight);
|
||||
}
|
||||
|
||||
this.checkGLError("Post render");
|
||||
++var3;
|
||||
|
||||
for(this.field_6316_m = true && this.currentScreen != null && this.currentScreen.doesGuiPauseGame(); System.currentTimeMillis() >= var1 + 1000L; var3 = 0) {
|
||||
this.field_6292_I = var3 + " fps, " + WorldRenderer.field_1762_b + " chunk updates";
|
||||
WorldRenderer.field_1762_b = 0;
|
||||
var1 += 1000L;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.*;
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
@ -30,7 +28,7 @@ public class ChunkLoader implements IChunkLoader {
|
|||
try {
|
||||
byte[] data = GL11.readFile(var4);
|
||||
ByteArrayInputStream var5 = new ByteArrayInputStream(data);
|
||||
NBTTagCompound var6 = CompressedStreamTools.func_1138_a(var5);
|
||||
NBTTagCompound var6 = (NBTTagCompound) NBTBase.readTag(new DataInputStream(var5));
|
||||
if(!var6.hasKey("Level")) {
|
||||
System.out.println("Chunk file at " + var2 + "," + var3 + " is missing level data, skipping");
|
||||
return null;
|
||||
|
@ -72,10 +70,16 @@ public class ChunkLoader implements IChunkLoader {
|
|||
NBTTagCompound var7 = new NBTTagCompound();
|
||||
var6.setTag("Level", var7);
|
||||
this.storeChunkInCompound(var2, var1, var7);
|
||||
CompressedStreamTools.writeGzippedCompoundToOutputStream(var6, var5);
|
||||
var5.flush();
|
||||
GL11.writeFile(var4, var5.toByteArray());
|
||||
var5.close();
|
||||
try (DataOutputStream dos = new DataOutputStream(new BufferedOutputStream(var5))) {
|
||||
NBTBase.writeTag(var6, dos);
|
||||
dos.flush();
|
||||
var5.flush();
|
||||
GL11.writeFile(var4, var5.toByteArray());
|
||||
var5.close();
|
||||
} catch(IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if(GL11.readFile(var3) != null) {
|
||||
GL11.deleteFile(var3);
|
||||
}
|
||||
|
|
|
@ -1,78 +1,78 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataInput;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutput;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
import java.util.zip.GZIPOutputStream;
|
||||
|
||||
public class CompressedStreamTools {
|
||||
public static NBTTagCompound func_1138_a(InputStream var0) throws IOException {
|
||||
DataInputStream var1 = new DataInputStream(new GZIPInputStream(var0));
|
||||
|
||||
NBTTagCompound var2;
|
||||
try {
|
||||
var2 = func_1141_a(var1);
|
||||
} finally {
|
||||
var1.close();
|
||||
}
|
||||
|
||||
return var2;
|
||||
}
|
||||
|
||||
public static void writeGzippedCompoundToOutputStream(NBTTagCompound var0, OutputStream var1) throws IOException {
|
||||
DataOutputStream var2 = new DataOutputStream(new GZIPOutputStream(var1));
|
||||
|
||||
try {
|
||||
func_1139_a(var0, var2);
|
||||
} finally {
|
||||
var2.close();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static NBTTagCompound func_1140_a(byte[] var0) throws IOException {
|
||||
DataInputStream var1 = new DataInputStream(new GZIPInputStream(new ByteArrayInputStream(var0)));
|
||||
|
||||
NBTTagCompound var2;
|
||||
try {
|
||||
var2 = func_1141_a(var1);
|
||||
} finally {
|
||||
var1.close();
|
||||
}
|
||||
|
||||
return var2;
|
||||
}
|
||||
|
||||
public static byte[] func_1142_a(NBTTagCompound var0) throws IOException {
|
||||
ByteArrayOutputStream var1 = new ByteArrayOutputStream();
|
||||
DataOutputStream var2 = new DataOutputStream(new GZIPOutputStream(var1));
|
||||
|
||||
try {
|
||||
func_1139_a(var0, var2);
|
||||
} finally {
|
||||
var2.close();
|
||||
}
|
||||
|
||||
return var1.toByteArray();
|
||||
}
|
||||
|
||||
public static NBTTagCompound func_1141_a(DataInput var0) throws IOException {
|
||||
NBTBase var1 = NBTBase.readTag(var0);
|
||||
if(var1 instanceof NBTTagCompound) {
|
||||
return (NBTTagCompound)var1;
|
||||
} else {
|
||||
throw new IOException("Root tag must be a named compound tag");
|
||||
}
|
||||
}
|
||||
|
||||
public static void func_1139_a(NBTTagCompound var0, DataOutput var1) throws IOException {
|
||||
NBTBase.writeTag(var0, var1);
|
||||
}
|
||||
}
|
||||
//package net.minecraft.src;
|
||||
//
|
||||
//import java.io.ByteArrayInputStream;
|
||||
//import java.io.ByteArrayOutputStream;
|
||||
//import java.io.DataInput;
|
||||
//import java.io.DataInputStream;
|
||||
//import java.io.DataOutput;
|
||||
//import java.io.DataOutputStream;
|
||||
//import java.io.IOException;
|
||||
//import java.io.InputStream;
|
||||
//import java.io.OutputStream;
|
||||
//import java.util.zip.GZIPInputStream;
|
||||
//import java.util.zip.GZIPOutputStream;
|
||||
//
|
||||
//public class CompressedStreamTools {
|
||||
// public static NBTTagCompound func_1138_a(InputStream var0) throws IOException {
|
||||
// DataInputStream var1 = new DataInputStream(new GZIPInputStream(var0));
|
||||
//
|
||||
// NBTTagCompound var2;
|
||||
// try {
|
||||
// var2 = func_1141_a(var1);
|
||||
// } finally {
|
||||
// var1.close();
|
||||
// }
|
||||
//
|
||||
// return var2;
|
||||
// }
|
||||
//
|
||||
// public static void writeGzippedCompoundToOutputStream(NBTTagCompound var0, OutputStream var1) throws IOException {
|
||||
// DataOutputStream var2 = new DataOutputStream(new GZIPOutputStream(var1));
|
||||
//
|
||||
// try {
|
||||
// func_1139_a(var0, var2);
|
||||
// } finally {
|
||||
// var2.close();
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//
|
||||
// public static NBTTagCompound func_1140_a(byte[] var0) throws IOException {
|
||||
// DataInputStream var1 = new DataInputStream(new GZIPInputStream(new ByteArrayInputStream(var0)));
|
||||
//
|
||||
// NBTTagCompound var2;
|
||||
// try {
|
||||
// var2 = func_1141_a(var1);
|
||||
// } finally {
|
||||
// var1.close();
|
||||
// }
|
||||
//
|
||||
// return var2;
|
||||
// }
|
||||
//
|
||||
// public static byte[] func_1142_a(NBTTagCompound var0) throws IOException {
|
||||
// ByteArrayOutputStream var1 = new ByteArrayOutputStream();
|
||||
// DataOutputStream var2 = new DataOutputStream(new GZIPOutputStream(var1));
|
||||
//
|
||||
// try {
|
||||
// func_1139_a(var0, var2);
|
||||
// } finally {
|
||||
// var2.close();
|
||||
// }
|
||||
//
|
||||
// return var1.toByteArray();
|
||||
// }
|
||||
//
|
||||
// public static NBTTagCompound func_1141_a(DataInput var0) throws IOException {
|
||||
// NBTBase var1 = NBTBase.readTag(var0);
|
||||
// if(var1 instanceof NBTTagCompound) {
|
||||
// return (NBTTagCompound)var1;
|
||||
// } else {
|
||||
// throw new IOException("Root tag must be a named compound tag");
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public static void func_1139_a(NBTTagCompound var0, DataOutput var1) throws IOException {
|
||||
// NBTBase.writeTag(var0, var1);
|
||||
// }
|
||||
//}
|
||||
|
|
|
@ -31,9 +31,9 @@ public class GuiIngame extends Gui {
|
|||
FontRenderer var8 = this.mc.fontRenderer;
|
||||
this.mc.field_9243_r.func_905_b();
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
if(this.mc.gameSettings.fancyGraphics) {
|
||||
this.func_4064_a(this.mc.thePlayer.getEntityBrightness(var1), var6, var7);
|
||||
}
|
||||
//if(this.mc.gameSettings.fancyGraphics) {
|
||||
//this.func_4064_a(this.mc.thePlayer.getEntityBrightness(var1), var6, var7);
|
||||
//}
|
||||
|
||||
ItemStack var9 = this.mc.thePlayer.inventory.armorItemInSlot(3);
|
||||
if(!this.mc.gameSettings.thirdPersonView && var9 != null && var9.itemID == Block.pumpkin.blockID) {
|
||||
|
@ -255,34 +255,34 @@ public class GuiIngame extends Gui {
|
|||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
private void func_4064_a(float var1, int var2, int var3) {
|
||||
var1 = 1.0F - var1;
|
||||
if(var1 < 0.0F) {
|
||||
var1 = 0.0F;
|
||||
}
|
||||
|
||||
if(var1 > 1.0F) {
|
||||
var1 = 1.0F;
|
||||
}
|
||||
|
||||
this.field_931_c = (float)((double)this.field_931_c + (double)(var1 - this.field_931_c) * 0.01D);
|
||||
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
GL11.glDepthMask(false);
|
||||
GL11.glBlendFunc(GL11.GL_ZERO, GL11.GL_ONE_MINUS_SRC_COLOR);
|
||||
GL11.glColor4f(this.field_931_c, this.field_931_c, this.field_931_c, 1.0F);
|
||||
GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.mc.renderEngine.getTexture("%blur%/misc/vignette.png"));
|
||||
Tessellator var4 = Tessellator.instance;
|
||||
var4.startDrawingQuads();
|
||||
var4.addVertexWithUV(0.0D, (double)var3, -90.0D, 0.0D, 1.0D);
|
||||
var4.addVertexWithUV((double)var2, (double)var3, -90.0D, 1.0D, 1.0D);
|
||||
var4.addVertexWithUV((double)var2, 0.0D, -90.0D, 1.0D, 0.0D);
|
||||
var4.addVertexWithUV(0.0D, 0.0D, -90.0D, 0.0D, 0.0D);
|
||||
var4.draw();
|
||||
GL11.glDepthMask(true);
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
}
|
||||
// private void func_4064_a(float var1, int var2, int var3) {
|
||||
// var1 = 1.0F - var1;
|
||||
// if(var1 < 0.0F) {
|
||||
// var1 = 0.0F;
|
||||
// }
|
||||
//
|
||||
// if(var1 > 1.0F) {
|
||||
// var1 = 1.0F;
|
||||
// }
|
||||
//
|
||||
// this.field_931_c = (float)((double)this.field_931_c + (double)(var1 - this.field_931_c) * 0.01D);
|
||||
// GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
// GL11.glDepthMask(false);
|
||||
// GL11.glBlendFunc(GL11.GL_ZERO, GL11.GL_ONE_MINUS_SRC_COLOR);
|
||||
// GL11.glColor4f(this.field_931_c, this.field_931_c, this.field_931_c, 1.0F);
|
||||
// GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.mc.renderEngine.getTexture("%blur%/misc/vignette.png"));
|
||||
// Tessellator var4 = Tessellator.instance;
|
||||
// var4.startDrawingQuads();
|
||||
// var4.addVertexWithUV(0.0D, (double)var3, -90.0D, 0.0D, 1.0D);
|
||||
// var4.addVertexWithUV((double)var2, (double)var3, -90.0D, 1.0D, 1.0D);
|
||||
// var4.addVertexWithUV((double)var2, 0.0D, -90.0D, 1.0D, 0.0D);
|
||||
// var4.addVertexWithUV(0.0D, 0.0D, -90.0D, 0.0D, 0.0D);
|
||||
// var4.draw();
|
||||
// GL11.glDepthMask(true);
|
||||
// GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
// GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
// GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
// }
|
||||
|
||||
private void func_4065_b(float var1, int var2, int var3) {
|
||||
var1 *= var1;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataInputStream;
|
||||
|
@ -63,7 +64,7 @@ public class World implements IBlockAccess {
|
|||
byte[] data = GL11.readFile("saves/" + var1 + "/level.dat");
|
||||
if(!(data == null)) {
|
||||
try {
|
||||
NBTTagCompound var5 = CompressedStreamTools.func_1138_a(new ByteArrayInputStream(data));
|
||||
NBTTagCompound var5 = (NBTTagCompound) NBTBase.readTag(new DataInputStream(new ByteArrayInputStream(data)));
|
||||
NBTTagCompound var6 = var5.getCompoundTag("Data");
|
||||
return var6;
|
||||
} catch (Exception var7) {
|
||||
|
@ -233,7 +234,7 @@ public class World implements IBlockAccess {
|
|||
byte[] data = GL11.readFile(var18);
|
||||
if(data != null) {
|
||||
try {
|
||||
NBTTagCompound var8 = CompressedStreamTools.func_1138_a(new ByteArrayInputStream(data));
|
||||
NBTTagCompound var8 = (NBTTagCompound) NBTBase.readTag(new DataInputStream(new ByteArrayInputStream(data)));
|
||||
NBTTagCompound var9 = var8.getCompoundTag("Data");
|
||||
this.randomSeed = var9.getLong("RandomSeed");
|
||||
this.spawnX = var9.getInteger("SpawnX");
|
||||
|
@ -367,7 +368,15 @@ public class World implements IBlockAccess {
|
|||
String var5 = field_9432_t + "/level.dat_old";
|
||||
String var6 = field_9432_t + "/level.dat";
|
||||
ByteArrayOutputStream data = new ByteArrayOutputStream();
|
||||
CompressedStreamTools.writeGzippedCompoundToOutputStream(var3, data);
|
||||
try (DataOutputStream dos = new DataOutputStream(new BufferedOutputStream(data))) {
|
||||
NBTBase.writeTag(var3, dos);
|
||||
dos.flush();
|
||||
byte[] file = data.toByteArray();
|
||||
GL11.writeFile(var6, file);
|
||||
} catch(IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
GL11.writeFile(var4, data.toByteArray());
|
||||
|
||||
if(GL11.readFile(var5) != null) {
|
||||
|
@ -1953,6 +1962,9 @@ public class World implements IBlockAccess {
|
|||
public void func_663_l() {
|
||||
try {
|
||||
String var1 = this.field_9432_t + "/session.lock";
|
||||
if(GL11.readFile(var1) == null) {
|
||||
return;
|
||||
}
|
||||
DataInputStream var2 = new DataInputStream(new ByteArrayInputStream(GL11.readFile(var1)));
|
||||
|
||||
try {
|
||||
|
|
|
@ -74,10 +74,6 @@ public class WorldRenderer {
|
|||
}
|
||||
}
|
||||
|
||||
private void func_1203_g() {
|
||||
GL11.glTranslatef((float)this.field_1752_l, (float)this.field_1751_m, (float)this.field_1750_n);
|
||||
}
|
||||
|
||||
public void func_1198_a() {
|
||||
if(this.needsUpdate) {
|
||||
++field_1762_b;
|
||||
|
@ -113,14 +109,8 @@ public class WorldRenderer {
|
|||
if(!var14) {
|
||||
var14 = true;
|
||||
GL11.glNewList(this.field_1744_C + var11, GL11.GL_COMPILE);
|
||||
GL11.glPushMatrix();
|
||||
this.func_1203_g();
|
||||
float var19 = 1.000001F;
|
||||
GL11.glTranslatef((float)(-this.field_1756_h) / 2.0F, (float)(-this.field_1757_g) / 2.0F, (float)(-this.field_1756_h) / 2.0F);
|
||||
GL11.glScalef(var19, var19, var19);
|
||||
GL11.glTranslatef((float)this.field_1756_h / 2.0F, (float)this.field_1757_g / 2.0F, (float)this.field_1756_h / 2.0F);
|
||||
field_1742_D.startDrawingQuads();
|
||||
field_1742_D.setTranslationD((double)(-this.field_1761_c), (double)(-this.field_1760_d), (double)(-this.field_1759_e));
|
||||
field_1742_D.setTranslationD((double) (this.field_1752_l-this.field_1761_c), (double) (this.field_1751_m-this.field_1760_d), (double) (this.field_1750_n-this.field_1759_e));
|
||||
}
|
||||
|
||||
if(var11 == 0 && Block.isBlockContainer[var18]) {
|
||||
|
@ -144,7 +134,6 @@ public class WorldRenderer {
|
|||
|
||||
if(var14) {
|
||||
field_1742_D.draw();
|
||||
GL11.glPopMatrix();
|
||||
GL11.glEndList();
|
||||
field_1742_D.setTranslationD(0.0D, 0.0D, 0.0D);
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue
Block a user