mirror of
https://github.com/Eaglercraft-Archive/Eaglercraftx-1.8.8-src.git
synced 2025-06-28 10:58:15 -05:00
Update #30 - Fixed various client bugs
This commit is contained in:
@ -95,34 +95,66 @@ public class PlatformApplication {
|
||||
private static native void setClipboard0(String str);
|
||||
|
||||
public static void setLocalStorage(String name, byte[] data) {
|
||||
setLocalStorage(name, data, true);
|
||||
}
|
||||
|
||||
public static void setLocalStorage(String name, byte[] data, boolean hooks) {
|
||||
IClientConfigAdapter adapter = PlatformRuntime.getClientConfigAdapter();
|
||||
String eagName = adapter.getLocalStorageNamespace() + "." + name;
|
||||
String b64 = Base64.encodeBase64String(data);
|
||||
try {
|
||||
Storage s = Window.current().getLocalStorage();
|
||||
if(s != null) {
|
||||
if(data != null) {
|
||||
s.setItem("_eaglercraftX." + name, Base64.encodeBase64String(data));
|
||||
s.setItem(eagName, b64);
|
||||
}else {
|
||||
s.removeItem("_eaglercraftX." + name);
|
||||
s.removeItem(eagName);
|
||||
}
|
||||
}
|
||||
}catch(Throwable t) {
|
||||
}
|
||||
if(hooks) {
|
||||
adapter.getHooks().callLocalStorageSavedHook(name, b64);
|
||||
}
|
||||
}
|
||||
|
||||
public static byte[] getLocalStorage(String name) {
|
||||
try {
|
||||
Storage s = Window.current().getLocalStorage();
|
||||
if(s != null) {
|
||||
String str = s.getItem("_eaglercraftX." + name);
|
||||
if(str != null) {
|
||||
return Base64.decodeBase64(str);
|
||||
return getLocalStorage(name, true);
|
||||
}
|
||||
|
||||
public static byte[] getLocalStorage(String name, boolean hooks) {
|
||||
IClientConfigAdapter adapter = PlatformRuntime.getClientConfigAdapter();
|
||||
String eagName = adapter.getLocalStorageNamespace() + "." + name;
|
||||
byte[] hooked = null;
|
||||
if(hooks) {
|
||||
String hookedStr = adapter.getHooks().callLocalStorageLoadHook(eagName);
|
||||
if(hookedStr != null) {
|
||||
try {
|
||||
hooked = Base64.decodeBase64(hookedStr);
|
||||
}catch(Throwable t) {
|
||||
PlatformRuntime.logger.error("Invalid Base64 recieved from local storage hook!");
|
||||
hooked = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(hooked == null) {
|
||||
try {
|
||||
Storage s = Window.current().getLocalStorage();
|
||||
if(s != null) {
|
||||
String str = s.getItem(eagName);
|
||||
if(str != null) {
|
||||
return Base64.decodeBase64(str);
|
||||
}else {
|
||||
return null;
|
||||
}
|
||||
}else {
|
||||
return null;
|
||||
}
|
||||
}else {
|
||||
}catch(Throwable t) {
|
||||
return null;
|
||||
}
|
||||
}catch(Throwable t) {
|
||||
return null;
|
||||
}else {
|
||||
return hooked;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -30,16 +30,18 @@ import net.lax1dude.eaglercraft.v1_8.log4j.Logger;
|
||||
import net.minecraft.util.MathHelper;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2022-2023 LAX1DUDE. All Rights Reserved.
|
||||
* Copyright (c) 2022-2023 lax1dude. All Rights Reserved.
|
||||
*
|
||||
* WITH THE EXCEPTION OF PATCH FILES, MINIFIED JAVASCRIPT, AND ALL FILES
|
||||
* NORMALLY FOUND IN AN UNMODIFIED MINECRAFT RESOURCE PACK, YOU ARE NOT ALLOWED
|
||||
* TO SHARE, DISTRIBUTE, OR REPURPOSE ANY FILE USED BY OR PRODUCED BY THE
|
||||
* SOFTWARE IN THIS REPOSITORY WITHOUT PRIOR PERMISSION FROM THE PROJECT AUTHOR.
|
||||
*
|
||||
* NOT FOR COMMERCIAL OR MALICIOUS USE
|
||||
*
|
||||
* (please read the 'LICENSE' file this repo's root directory for more info)
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
public class PlatformAudio {
|
||||
|
@ -102,8 +102,9 @@ public class PlatformInput {
|
||||
|
||||
public static boolean keyboardLockSupported = false;
|
||||
public static boolean lockKeys = false;
|
||||
|
||||
|
||||
private static boolean vsync = true;
|
||||
private static boolean vsyncSupport = false;
|
||||
|
||||
@JSBody(params = { }, script = "window.onbeforeunload = () => {return false;};")
|
||||
private static native void onBeforeCloseRegister();
|
||||
@ -252,7 +253,18 @@ public class PlatformInput {
|
||||
mouseDY = 0.0D;
|
||||
}
|
||||
});
|
||||
onBeforeCloseRegister();
|
||||
|
||||
try {
|
||||
onBeforeCloseRegister();
|
||||
}catch(Throwable t) {
|
||||
}
|
||||
|
||||
try {
|
||||
asyncRequestAnimationFrame();
|
||||
vsyncSupport = true;
|
||||
}catch(Throwable t) {
|
||||
PlatformRuntime.logger.error("VSync is not supported on this browser!");
|
||||
}
|
||||
|
||||
fullscreenQuery = fullscreenMediaQuery();
|
||||
if (keyboardLockSupported = checkKeyboardLockSupported()) {
|
||||
@ -300,6 +312,9 @@ public class PlatformInput {
|
||||
vsync = enable;
|
||||
}
|
||||
|
||||
@JSBody(params = { "doc" }, script = "return (doc.visibilityState === \"visible\");")
|
||||
private static native boolean getVisibilityState(JSObject doc);
|
||||
|
||||
public static void update() {
|
||||
double r = win.getDevicePixelRatio();
|
||||
int w = PlatformRuntime.parent.getClientWidth();
|
||||
@ -320,10 +335,14 @@ public class PlatformInput {
|
||||
PlatformRuntime.lastFrame = t;
|
||||
}
|
||||
}
|
||||
if(vsync) {
|
||||
asyncRequestAnimationFrame();
|
||||
if(getVisibilityState(win.getDocument())) {
|
||||
if(vsyncSupport && vsync) {
|
||||
asyncRequestAnimationFrame();
|
||||
}else {
|
||||
EagUtils.sleep(0l);
|
||||
}
|
||||
}else {
|
||||
EagUtils.sleep(0l);
|
||||
EagUtils.sleep(50l);
|
||||
}
|
||||
}
|
||||
|
||||
@ -348,6 +367,10 @@ public class PlatformInput {
|
||||
}, 50);
|
||||
}
|
||||
|
||||
public static boolean isVSyncSupported() {
|
||||
return vsyncSupport;
|
||||
}
|
||||
|
||||
static void initFramebuffer(WebGL2RenderingContext ctx, WebGLFramebuffer fbo, int sw, int sh) {
|
||||
context = ctx;
|
||||
mainFramebuffer = fbo;
|
||||
@ -599,7 +622,7 @@ public class PlatformInput {
|
||||
keyEvents.clear();
|
||||
}
|
||||
|
||||
@JSBody(params = {}, script = "return window.matchMedia('(display-mode: fullscreen)');")
|
||||
@JSBody(params = {}, script = "return window.matchMedia(\"(display-mode: fullscreen)\");")
|
||||
private static native JSObject fullscreenMediaQuery();
|
||||
|
||||
@JSBody(params = { "mediaQuery" }, script = "return mediaQuery.matches;")
|
||||
|
@ -9,6 +9,7 @@ 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.core.JSArrayReader;
|
||||
import org.teavm.jso.core.JSError;
|
||||
import org.teavm.jso.dom.css.CSSStyleDeclaration;
|
||||
import org.teavm.jso.dom.html.HTMLCanvasElement;
|
||||
@ -21,7 +22,6 @@ import net.lax1dude.eaglercraft.v1_8.EaglercraftVersion;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.PlatformApplication;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.PlatformRuntime;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.teavm.opts.JSEaglercraftXOptsAssetsURI;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.teavm.opts.JSEaglercraftXOptsAssetsURIsArray;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.teavm.opts.JSEaglercraftXOptsRoot;
|
||||
import net.lax1dude.eaglercraft.v1_8.log4j.ILogRedirector;
|
||||
import net.lax1dude.eaglercraft.v1_8.log4j.LogManager;
|
||||
@ -87,7 +87,7 @@ public class ClientMain {
|
||||
if(epkSingleURL != null) {
|
||||
configEPKFiles = new EPKFileEntry[] { new EPKFileEntry(epkSingleURL, "") };
|
||||
}else {
|
||||
JSEaglercraftXOptsAssetsURIsArray epkURLs = eaglercraftOpts.getAssetsURIArray();
|
||||
JSArrayReader<JSEaglercraftXOptsAssetsURI> epkURLs = eaglercraftOpts.getAssetsURIArray();
|
||||
int len = epkURLs.getLength();
|
||||
if(len == 0) {
|
||||
throw new JSONException("assetsURI array cannot be empty!");
|
||||
|
@ -13,6 +13,7 @@ import org.teavm.jso.dom.html.HTMLDocument;
|
||||
import org.teavm.jso.dom.html.HTMLElement;
|
||||
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.PlatformApplication;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.PlatformRuntime;
|
||||
import net.lax1dude.eaglercraft.v1_8.log4j.LogManager;
|
||||
|
||||
/**
|
||||
@ -63,13 +64,13 @@ public class DebugConsoleWindow {
|
||||
destroyWindow();
|
||||
}
|
||||
});
|
||||
if("true".equals(parent.getLocalStorage().getItem("_eaglercraftX.showDebugConsole"))) {
|
||||
if("true".equals(parent.getLocalStorage().getItem(PlatformRuntime.getClientConfigAdapter().getLocalStorageNamespace() + ".showDebugConsole"))) {
|
||||
showDebugConsole0();
|
||||
}
|
||||
}
|
||||
|
||||
public static void showDebugConsole() {
|
||||
parent.getLocalStorage().setItem("_eaglercraftX.showDebugConsole", "true");
|
||||
parent.getLocalStorage().setItem(PlatformRuntime.getClientConfigAdapter().getLocalStorageNamespace() + ".showDebugConsole", "true");
|
||||
showDebugConsole0();
|
||||
}
|
||||
|
||||
|
@ -10,13 +10,14 @@ import net.lax1dude.eaglercraft.v1_8.sp.relay.RelayManager;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
import org.teavm.jso.JSObject;
|
||||
import org.teavm.jso.core.JSArrayReader;
|
||||
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.IClientConfigAdapter;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.IClientConfigAdapterHooks;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.teavm.opts.JSEaglercraftXOptsHooks;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.teavm.opts.JSEaglercraftXOptsRelay;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.teavm.opts.JSEaglercraftXOptsRelaysArray;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.teavm.opts.JSEaglercraftXOptsRoot;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.teavm.opts.JSEaglercraftXOptsServer;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.teavm.opts.JSEaglercraftXOptsServersArray;
|
||||
import net.lax1dude.eaglercraft.v1_8.sp.relay.RelayEntry;
|
||||
|
||||
/**
|
||||
@ -56,6 +57,9 @@ public class TeaVMClientConfigAdapter implements IClientConfigAdapter {
|
||||
private boolean checkRelaysForUpdates = false;
|
||||
private boolean enableSignatureBadge = false;
|
||||
private boolean allowVoiceClient = true;
|
||||
private boolean allowFNAWSkins = true;
|
||||
private String localStorageNamespace = "_eaglercraftX";
|
||||
private final TeaVMClientConfigAdapterHooks hooks = new TeaVMClientConfigAdapterHooks();
|
||||
|
||||
public void loadNative(JSObject jsObject) {
|
||||
integratedServerOpts = new JSONObject();
|
||||
@ -75,6 +79,12 @@ public class TeaVMClientConfigAdapter implements IClientConfigAdapter {
|
||||
logInvalidCerts = EaglercraftVersion.enableUpdateService && !demoMode && eaglercraftXOpts.getLogInvalidCerts(false);
|
||||
enableSignatureBadge = eaglercraftXOpts.getEnableSignatureBadge(false);
|
||||
allowVoiceClient = eaglercraftXOpts.getAllowVoiceClient(true);
|
||||
allowFNAWSkins = eaglercraftXOpts.getAllowFNAWSkins(true);
|
||||
localStorageNamespace = eaglercraftXOpts.getLocalStorageNamespace(EaglercraftVersion.localStorageNamespace);
|
||||
JSEaglercraftXOptsHooks hooksObj = eaglercraftXOpts.getHooks();
|
||||
if(hooksObj != null) {
|
||||
hooks.loadHooks(hooksObj);
|
||||
}
|
||||
|
||||
integratedServerOpts.put("worldsDB", worldsDB);
|
||||
integratedServerOpts.put("demoMode", demoMode);
|
||||
@ -82,8 +92,9 @@ public class TeaVMClientConfigAdapter implements IClientConfigAdapter {
|
||||
integratedServerOpts.put("allowUpdateSvc", isAllowUpdateSvc);
|
||||
integratedServerOpts.put("allowUpdateDL", isAllowUpdateDL);
|
||||
integratedServerOpts.put("allowVoiceClient", allowVoiceClient);
|
||||
integratedServerOpts.put("allowFNAWSkins", allowFNAWSkins);
|
||||
|
||||
JSEaglercraftXOptsServersArray serversArray = eaglercraftXOpts.getServers();
|
||||
JSArrayReader<JSEaglercraftXOptsServer> serversArray = eaglercraftXOpts.getServers();
|
||||
if(serversArray != null) {
|
||||
for(int i = 0, l = serversArray.getLength(); i < l; ++i) {
|
||||
JSEaglercraftXOptsServer serverEntry = serversArray.get(i);
|
||||
@ -95,7 +106,7 @@ public class TeaVMClientConfigAdapter implements IClientConfigAdapter {
|
||||
}
|
||||
}
|
||||
|
||||
JSEaglercraftXOptsRelaysArray relaysArray = eaglercraftXOpts.getRelays();
|
||||
JSArrayReader<JSEaglercraftXOptsRelay> relaysArray = eaglercraftXOpts.getRelays();
|
||||
if(relaysArray != null) {
|
||||
boolean gotAPrimary = false;
|
||||
for(int i = 0, l = relaysArray.getLength(); i < l; ++i) {
|
||||
@ -162,6 +173,8 @@ public class TeaVMClientConfigAdapter implements IClientConfigAdapter {
|
||||
logInvalidCerts = EaglercraftVersion.enableUpdateService && !demoMode && eaglercraftOpts.optBoolean("logInvalidCerts", false);
|
||||
enableSignatureBadge = eaglercraftOpts.optBoolean("enableSignatureBadge", false);
|
||||
allowVoiceClient = eaglercraftOpts.optBoolean("allowVoiceClient", true);
|
||||
allowFNAWSkins = eaglercraftOpts.optBoolean("allowFNAWSkins", true);
|
||||
localStorageNamespace = eaglercraftOpts.optString("localStorageNamespace", EaglercraftVersion.localStorageNamespace);
|
||||
JSONArray serversArray = eaglercraftOpts.optJSONArray("servers");
|
||||
if(serversArray != null) {
|
||||
for(int i = 0, l = serversArray.length(); i < l; ++i) {
|
||||
@ -309,6 +322,21 @@ public class TeaVMClientConfigAdapter implements IClientConfigAdapter {
|
||||
return allowVoiceClient;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAllowFNAWSkins() {
|
||||
return allowFNAWSkins;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLocalStorageNamespace() {
|
||||
return localStorageNamespace;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IClientConfigAdapterHooks getHooks() {
|
||||
return hooks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
@ -327,6 +355,8 @@ public class TeaVMClientConfigAdapter implements IClientConfigAdapter {
|
||||
jsonObject.put("checkRelaysForUpdates", checkRelaysForUpdates);
|
||||
jsonObject.put("enableSignatureBadge", enableSignatureBadge);
|
||||
jsonObject.put("allowVoiceClient", allowVoiceClient);
|
||||
jsonObject.put("allowFNAWSkins", allowFNAWSkins);
|
||||
jsonObject.put("localStorageNamespace", localStorageNamespace);
|
||||
JSONArray serversArr = new JSONArray();
|
||||
for(int i = 0, l = defaultServers.size(); i < l; ++i) {
|
||||
DefaultServer srv = defaultServers.get(i);
|
||||
|
@ -0,0 +1,100 @@
|
||||
package net.lax1dude.eaglercraft.v1_8.internal.teavm;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import org.teavm.interop.Async;
|
||||
import org.teavm.interop.AsyncCallback;
|
||||
import org.teavm.jso.JSFunctor;
|
||||
import org.teavm.jso.JSObject;
|
||||
import org.teavm.jso.browser.Window;
|
||||
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.IClientConfigAdapterHooks;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.teavm.opts.JSEaglercraftXOptsHooks;
|
||||
import net.lax1dude.eaglercraft.v1_8.log4j.LogManager;
|
||||
import net.lax1dude.eaglercraft.v1_8.log4j.Logger;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2024 lax1dude. All Rights Reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
public class TeaVMClientConfigAdapterHooks implements IClientConfigAdapterHooks {
|
||||
|
||||
private static final Logger logger = LogManager.getLogger("TeaVMClientConfigAdapterHooks");
|
||||
|
||||
private LocalStorageSaveHook saveHook = null;
|
||||
private LocalStorageLoadHook loadHook = null;
|
||||
|
||||
@JSFunctor
|
||||
private static interface LocalStorageSaveHook extends JSObject {
|
||||
void call(String key, String base64);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void callLocalStorageSavedHook(String key, String base64) {
|
||||
if(saveHook != null) {
|
||||
callHookSafe("localStorageSaved", () -> {
|
||||
saveHook.call(key, base64);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@JSFunctor
|
||||
private static interface LocalStorageLoadHook extends JSObject {
|
||||
String call(String key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String callLocalStorageLoadHook(String key) {
|
||||
if(loadHook != null) {
|
||||
return (String)callHookSafeWithReturn("localStorageLoaded", () -> {
|
||||
return loadHook.call(key);
|
||||
});
|
||||
}else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static void callHookSafe(String identifer, Runnable hooker) {
|
||||
Window.setTimeout(() -> {
|
||||
try {
|
||||
hooker.run();
|
||||
}catch(Throwable t) {
|
||||
logger.error("Caught exception while invoking eaglercraftXOpts \"{}\" hook!", identifer);
|
||||
logger.error(t);
|
||||
}
|
||||
}, 0);
|
||||
}
|
||||
|
||||
@Async
|
||||
private static native Object callHookSafeWithReturn(String identifer, Supplier<Object> hooker);
|
||||
|
||||
private static void callHookSafeWithReturn(String identifer, Supplier<Object> hooker, final AsyncCallback<Object> cb) {
|
||||
Window.setTimeout(() -> {
|
||||
Object res = null;
|
||||
try {
|
||||
res = hooker.get();
|
||||
}catch(Throwable t) {
|
||||
logger.error("Caught exception while invoking eaglercraftXOpts \"{}\" hook!", identifer);
|
||||
logger.error(t);
|
||||
}finally {
|
||||
cb.complete(res);
|
||||
}
|
||||
}, 0);
|
||||
}
|
||||
|
||||
public void loadHooks(JSEaglercraftXOptsHooks hooks) {
|
||||
saveHook = (LocalStorageSaveHook)hooks.getLocalStorageSavedHook();
|
||||
loadHook = (LocalStorageLoadHook)hooks.getLocalStorageLoadedHook();
|
||||
}
|
||||
}
|
@ -1,8 +1,7 @@
|
||||
package net.lax1dude.eaglercraft.v1_8.internal.teavm.opts;
|
||||
|
||||
import org.teavm.jso.JSIndexer;
|
||||
import org.teavm.jso.JSBody;
|
||||
import org.teavm.jso.JSObject;
|
||||
import org.teavm.jso.JSProperty;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2024 lax1dude. All Rights Reserved.
|
||||
@ -19,12 +18,12 @@ import org.teavm.jso.JSProperty;
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
public interface JSEaglercraftXOptsAssetsURIsArray extends JSObject {
|
||||
public abstract class JSEaglercraftXOptsHooks implements JSObject {
|
||||
|
||||
@JSIndexer
|
||||
JSEaglercraftXOptsAssetsURI get(int idx);
|
||||
@JSBody(script = "return (typeof this.localStorageSaved === \"function\") ? this.localStorageSaved : null;")
|
||||
public native JSObject getLocalStorageSavedHook();
|
||||
|
||||
@JSProperty
|
||||
int getLength();
|
||||
@JSBody(script = "return (typeof this.localStorageLoaded === \"function\") ? this.localStorageLoaded : null;")
|
||||
public native JSObject getLocalStorageLoadedHook();
|
||||
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
package net.lax1dude.eaglercraft.v1_8.internal.teavm.opts;
|
||||
|
||||
import org.teavm.jso.JSIndexer;
|
||||
import org.teavm.jso.JSObject;
|
||||
import org.teavm.jso.JSProperty;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2024 lax1dude. All Rights Reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
public interface JSEaglercraftXOptsRelaysArray extends JSObject {
|
||||
|
||||
@JSIndexer
|
||||
JSEaglercraftXOptsRelay get(int idx);
|
||||
|
||||
@JSProperty
|
||||
int getLength();
|
||||
|
||||
}
|
@ -2,6 +2,7 @@ package net.lax1dude.eaglercraft.v1_8.internal.teavm.opts;
|
||||
|
||||
import org.teavm.jso.JSBody;
|
||||
import org.teavm.jso.JSObject;
|
||||
import org.teavm.jso.core.JSArrayReader;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2024 lax1dude. All Rights Reserved.
|
||||
@ -27,7 +28,7 @@ public abstract class JSEaglercraftXOptsRoot implements JSObject {
|
||||
public native String getAssetsURI();
|
||||
|
||||
@JSBody(script = "return (typeof this.assetsURI === \"object\") ? this.assetsURI : null;")
|
||||
public native JSEaglercraftXOptsAssetsURIsArray getAssetsURIArray();
|
||||
public native JSArrayReader<JSEaglercraftXOptsAssetsURI> getAssetsURIArray();
|
||||
|
||||
@JSBody(params = { "def" }, script = "return (typeof this.lang === \"string\") ? this.lang : def;")
|
||||
public native String getLang(String defaultValue);
|
||||
@ -48,10 +49,10 @@ public abstract class JSEaglercraftXOptsRoot implements JSObject {
|
||||
public native boolean getDemoMode(boolean defaultValue);
|
||||
|
||||
@JSBody(script = "return (typeof this.servers === \"object\") ? this.servers : null;")
|
||||
public native JSEaglercraftXOptsServersArray getServers();
|
||||
public native JSArrayReader<JSEaglercraftXOptsServer> getServers();
|
||||
|
||||
@JSBody(script = "return (typeof this.relays === \"object\") ? this.relays : null;")
|
||||
public native JSEaglercraftXOptsRelaysArray getRelays();
|
||||
public native JSArrayReader<JSEaglercraftXOptsRelay> getRelays();
|
||||
|
||||
@JSBody(params = { "def" }, script = "return (typeof this.checkShaderGLErrors === \"boolean\") ? this.checkShaderGLErrors : def;")
|
||||
public native boolean getCheckShaderGLErrors(boolean defaultValue);
|
||||
@ -83,4 +84,13 @@ public abstract class JSEaglercraftXOptsRoot implements JSObject {
|
||||
@JSBody(params = { "def" }, script = "return (typeof this.allowVoiceClient === \"boolean\") ? this.allowVoiceClient : def;")
|
||||
public native boolean getAllowVoiceClient(boolean defaultValue);
|
||||
|
||||
@JSBody(params = { "def" }, script = "return (typeof this.allowFNAWSkins === \"boolean\") ? this.allowFNAWSkins : def;")
|
||||
public native boolean getAllowFNAWSkins(boolean defaultValue);
|
||||
|
||||
@JSBody(script = "return (typeof this.hooks === \"object\") ? this.hooks : null;")
|
||||
public native JSEaglercraftXOptsHooks getHooks();
|
||||
|
||||
@JSBody(params = { "def" }, script = "return (typeof this.localStorageNamespace === \"string\") ? this.localStorageNamespace : def;")
|
||||
public native String getLocalStorageNamespace(String defaultValue);
|
||||
|
||||
}
|
||||
|
@ -1,30 +0,0 @@
|
||||
package net.lax1dude.eaglercraft.v1_8.internal.teavm.opts;
|
||||
|
||||
import org.teavm.jso.JSIndexer;
|
||||
import org.teavm.jso.JSObject;
|
||||
import org.teavm.jso.JSProperty;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2024 lax1dude. All Rights Reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
public interface JSEaglercraftXOptsServersArray extends JSObject {
|
||||
|
||||
@JSIndexer
|
||||
JSEaglercraftXOptsServer get(int idx);
|
||||
|
||||
@JSProperty
|
||||
int getLength();
|
||||
|
||||
}
|
Reference in New Issue
Block a user