u36
This commit is contained in:
parent
a863b8a73f
commit
26fd32615c
|
@ -1,4 +1,5 @@
|
|||
"use strict";
|
||||
${classes_js}
|
||||
|
||||
// %%%%%%%%% launch options %%%%%%%%%%%%
|
||||
|
||||
|
@ -26,8 +27,6 @@ if(typeof window !== "undefined") {
|
|||
|
||||
// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
${classes_js}
|
||||
|
||||
if(typeof window !== "undefined") { window.eaglercraftXOpts.enableSignatureBadge = true; window.eaglercraftXOpts.assetsURI = ${assets_epk}; }
|
||||
|
||||
if(typeof window !== "undefined") setTimeout(() => {
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 841 B |
Binary file not shown.
After Width: | Height: | Size: 860 B |
Binary file not shown.
After Width: | Height: | Size: 855 B |
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
Binary file not shown.
After Width: | Height: | Size: 689 B |
|
@ -1,7 +1,7 @@
|
|||
#line 2
|
||||
|
||||
/*
|
||||
* Copyright (c) 2023 lax1dude. All Rights Reserved.
|
||||
* Copyright (c) 2023 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
|
||||
|
@ -45,8 +45,8 @@ uniform float u_blockConstant1f;
|
|||
#endif
|
||||
#define DO_COMPILE_STATE_WAVING_BLOCKS
|
||||
#define FAKE_SIN(valueIn, valueOut)\
|
||||
valueOut = abs(1.0 - fract(valueIn * 0.159155) * 2.0);\
|
||||
valueOut = valueOut * valueOut * (3.0 - 2.0 * valueOut) * 2.0 - 1.0;
|
||||
valueOut = abs(1.0 - fract(valueIn * 0.159155) * 2.0);\
|
||||
valueOut = valueOut * valueOut * (6.0 - 4.0 * valueOut) - 1.0;
|
||||
#define LIB_INCLUDE_WAVING_BLOCKS_FUNCTION
|
||||
#endif
|
||||
|
||||
|
@ -68,49 +68,47 @@ uniform mat4 u_projectionMat4f;
|
|||
#define TEX_MAT3(mat4In) mat3(mat4In[0].xyw,mat4In[1].xyw,mat4In[3].xyw)
|
||||
|
||||
void main() {
|
||||
|
||||
#ifdef COMPILE_TEXTURE_ATTRIB
|
||||
vec3 v_textureTmp3f = TEX_MAT3(u_textureMat4f01) * vec3(a_texture2f, 1.0);
|
||||
v_texture2f = v_textureTmp3f.xy / v_textureTmp3f.z;
|
||||
vec3 v_textureTmp3f = TEX_MAT3(u_textureMat4f01) * vec3(a_texture2f, 1.0);
|
||||
v_texture2f = v_textureTmp3f.xy / v_textureTmp3f.z;
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef COMPILE_COLOR_ATTRIB
|
||||
v_color4f = a_color4f;
|
||||
v_color4f = a_color4f;
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef COMPILE_NORMAL_ATTRIB
|
||||
v_normal3f = normalize(mat3(u_modelviewMat4f) * a_normal4f.xyz);
|
||||
float blockId = v_block1f = floor((a_normal4f.w + 1.0) * 127.0 + 0.5);
|
||||
v_normal3f = normalize(mat3(u_modelviewMat4f) * a_normal4f.xyz);
|
||||
float blockId = v_block1f = floor((a_normal4f.w + 1.0) * 127.0 + 0.5);
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef COMPILE_LIGHTMAP_ATTRIB
|
||||
vec3 v_lightmapTmp3f = TEX_MAT3(u_textureMat4f02) * vec3(a_lightmap2f, 1.0);
|
||||
v_lightmap2f = v_lightmapTmp3f.xy / v_lightmapTmp3f.z;
|
||||
vec3 v_lightmapTmp3f = TEX_MAT3(u_textureMat4f02) * vec3(a_lightmap2f, 1.0);
|
||||
v_lightmap2f = v_lightmapTmp3f.xy / v_lightmapTmp3f.z;
|
||||
#endif
|
||||
|
||||
vec4 pos = vec4(a_position3f, 1.0);
|
||||
|
||||
|
||||
vec4 pos = vec4(a_position3f, 1.0);
|
||||
|
||||
#ifdef DO_COMPILE_STATE_WAVING_BLOCKS
|
||||
#ifndef COMPILE_NORMAL_ATTRIB
|
||||
float blockId = u_blockConstant1f;
|
||||
float blockId = u_blockConstant1f;
|
||||
#endif
|
||||
#ifdef COMPILE_LIGHTMAP_ATTRIB
|
||||
if(v_lightmap2f.y > 0.33) {
|
||||
COMPUTE_WAVING_BLOCKS(pos, min(v_lightmap2f.y * 3.0 - 1.0, 1.0), 24.0, blockId, u_modelMatrix4f, u_viewMatrix4f, u_modelviewMat4f, u_wavingBlockOffset3f, u_wavingBlockParam4f)
|
||||
}else {
|
||||
pos = u_modelviewMat4f * pos;
|
||||
}
|
||||
if(v_lightmap2f.y > 0.33) {
|
||||
COMPUTE_WAVING_BLOCKS(pos, min(v_lightmap2f.y * 3.0 - 1.0, 1.0), 24.0, blockId, u_modelMatrix4f, u_viewMatrix4f, u_modelviewMat4f, u_wavingBlockOffset3f, u_wavingBlockParam4f)
|
||||
}else {
|
||||
pos = u_modelviewMat4f * pos;
|
||||
}
|
||||
#else
|
||||
COMPUTE_WAVING_BLOCKS(pos, 1.0, 32.0, blockId, u_modelMatrix4f, u_viewMatrix4f, u_modelviewMat4f, u_wavingBlockOffset3f, u_wavingBlockParam4f)
|
||||
COMPUTE_WAVING_BLOCKS(pos, 1.0, 32.0, blockId, u_modelMatrix4f, u_viewMatrix4f, u_modelviewMat4f, u_wavingBlockOffset3f, u_wavingBlockParam4f)
|
||||
#endif
|
||||
#else
|
||||
pos = u_modelviewMat4f * pos;
|
||||
pos = u_modelviewMat4f * pos;
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef COMPILE_NORMAL_MATERIAL_TEXTURE
|
||||
v_viewdir3f = pos.xyz / pos.w;
|
||||
v_viewdir3f = pos.xyz / pos.w;
|
||||
#endif
|
||||
|
||||
gl_Position = u_projectionMat4f * pos;
|
||||
|
||||
|
||||
gl_Position = u_projectionMat4f * pos;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#line 2
|
||||
|
||||
/*
|
||||
* Copyright (c) 2023 lax1dude. All Rights Reserved.
|
||||
* Copyright (c) 2023 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
|
||||
|
@ -52,8 +52,8 @@ uniform vec3 u_wavingBlockOffset3f;
|
|||
uniform vec4 u_wavingBlockParam4f;
|
||||
#define DO_COMPILE_STATE_WAVING_BLOCKS
|
||||
#define FAKE_SIN(valueIn, valueOut)\
|
||||
valueOut = abs(1.0 - fract(valueIn * 0.159155) * 2.0);\
|
||||
valueOut = valueOut * valueOut * (3.0 - 2.0 * valueOut) * 2.0 - 1.0;
|
||||
valueOut = abs(1.0 - fract(valueIn * 0.159155) * 2.0);\
|
||||
valueOut = valueOut * valueOut * (6.0 - 4.0 * valueOut) - 1.0;
|
||||
#define LIB_INCLUDE_WAVING_BLOCKS_FUNCTION
|
||||
#endif
|
||||
|
||||
|
@ -64,40 +64,39 @@ uniform vec4 u_wavingBlockParam4f;
|
|||
void main() {
|
||||
#ifdef DO_SHADOW_ALPHA_TEST
|
||||
#ifdef COMPILE_TEXTURE_ATTRIB
|
||||
vec3 v_textureTmp3f = TEX_MAT3(u_textureMat4f01) * vec3(a_texture2f, 1.0);
|
||||
v_texture2f = v_textureTmp3f.xy / v_textureTmp3f.z;
|
||||
vec3 v_textureTmp3f = TEX_MAT3(u_textureMat4f01) * vec3(a_texture2f, 1.0);
|
||||
v_texture2f = v_textureTmp3f.xy / v_textureTmp3f.z;
|
||||
#endif
|
||||
#endif
|
||||
#ifdef DO_COMPILE_STATE_WAVING_BLOCKS
|
||||
vec4 pos = vec4(a_position3f, 1.0);
|
||||
vec4 pos = vec4(a_position3f, 1.0);
|
||||
#ifdef COMPILE_NORMAL_ATTRIB
|
||||
float blockId = floor((a_normal4f.w + 1.0) * 127.0 + 0.5);
|
||||
float blockId = floor((a_normal4f.w + 1.0) * 127.0 + 0.5);
|
||||
#else
|
||||
float blockId = u_blockConstant1f;
|
||||
float blockId = u_blockConstant1f;
|
||||
#endif
|
||||
#ifdef COMPILE_ENABLE_LIGHTMAP
|
||||
#ifdef COMPILE_LIGHTMAP_ATTRIB
|
||||
mat4x2 texMat4x2 = mat4x2(
|
||||
u_textureMat4f02[0].yw,
|
||||
u_textureMat4f02[1].yw,
|
||||
u_textureMat4f02[2].yw,
|
||||
u_textureMat4f02[3].yw
|
||||
);
|
||||
vec2 v_lightmapTmp2f = texMat4x2 * vec4(a_lightmap2f, 0.0, 1.0);
|
||||
v_lightmapTmp2f.x = v_lightmapTmp2f.x / v_lightmapTmp2f.y;
|
||||
mat4x2 texMat4x2 = mat4x2(
|
||||
u_textureMat4f02[0].yw,
|
||||
u_textureMat4f02[1].yw,
|
||||
u_textureMat4f02[2].yw,
|
||||
u_textureMat4f02[3].yw);
|
||||
vec2 v_lightmapTmp2f = texMat4x2 * vec4(a_lightmap2f, 0.0, 1.0);
|
||||
v_lightmapTmp2f.x = v_lightmapTmp2f.x / v_lightmapTmp2f.y;
|
||||
#else
|
||||
vec2 v_lightmapTmp2f = vec2(u_textureCoords02.y, 0.0);
|
||||
vec2 v_lightmapTmp2f = vec2(u_textureCoords02.y, 0.0);
|
||||
#endif
|
||||
if(v_lightmapTmp2f.x > 0.33) {
|
||||
COMPUTE_WAVING_BLOCKS(pos, min(v_lightmapTmp2f.x * 3.0 - 1.0, 1.0), 24.0, blockId, u_modelMatrix4f, u_viewMatrix4f, u_modelviewProjMat4f, u_wavingBlockOffset3f, u_wavingBlockParam4f)
|
||||
}else {
|
||||
pos = u_modelviewProjMat4f * pos;
|
||||
}
|
||||
if(v_lightmapTmp2f.x > 0.33) {
|
||||
COMPUTE_WAVING_BLOCKS(pos, min(v_lightmapTmp2f.x * 3.0 - 1.0, 1.0), 24.0, blockId, u_modelMatrix4f, u_viewMatrix4f, u_modelviewProjMat4f, u_wavingBlockOffset3f, u_wavingBlockParam4f)
|
||||
}else {
|
||||
pos = u_modelviewProjMat4f * pos;
|
||||
}
|
||||
#else
|
||||
COMPUTE_WAVING_BLOCKS(pos, 1.0, 32.0, blockId, u_modelMatrix4f, u_viewMatrix4f, u_modelviewProjMat4f, u_wavingBlockOffset3f, u_wavingBlockParam4f)
|
||||
COMPUTE_WAVING_BLOCKS(pos, 1.0, 32.0, blockId, u_modelMatrix4f, u_viewMatrix4f, u_modelviewProjMat4f, u_wavingBlockOffset3f, u_wavingBlockParam4f)
|
||||
#endif
|
||||
gl_Position = pos;
|
||||
gl_Position = pos;
|
||||
#else
|
||||
gl_Position = u_modelviewProjMat4f * vec4(a_position3f, 1.0);
|
||||
gl_Position = u_modelviewProjMat4f * vec4(a_position3f, 1.0);
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#line 2
|
||||
|
||||
/*
|
||||
* Copyright (c) 2023 lax1dude. All Rights Reserved.
|
||||
* Copyright (c) 2023 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
|
||||
|
@ -38,30 +38,30 @@ uniform float u_aspectRatio1f;
|
|||
uniform float u_baseScale1f;
|
||||
|
||||
#define FAKE_SIN(valueIn, valueOut)\
|
||||
valueOut = abs(1.0 - fract(valueIn * 0.159155) * 2.0);\
|
||||
valueOut = valueOut * valueOut * (3.0 - 2.0 * valueOut) * 2.0 - 1.0;
|
||||
valueOut = abs(1.0 - fract(valueIn * 0.159155) * 2.0);\
|
||||
valueOut = valueOut * valueOut * (6.0 - 4.0 * valueOut) - 1.0;
|
||||
|
||||
void main() {
|
||||
v_occlusion1f = max(textureLod(u_sunOcclusionValue, vec2(0.5, 0.5), 0.0).r * 1.5 - 0.5, 0.0);
|
||||
if(v_occlusion1f == 0.0) {
|
||||
gl_Position = vec4(-10.0, -10.0, -10.0, 1.0);
|
||||
return;
|
||||
}
|
||||
|
||||
v_texcoord2f = e_elementTexture4f.xy + (a_position2f * 0.5 + 0.5) * e_elementTexture4f.zw;
|
||||
|
||||
float r = textureLod(u_exposureValue, vec2(0.5, 0.5), 0.0).r * 7.5;
|
||||
|
||||
mat2 rotationMatrix;
|
||||
FAKE_SIN(vec2(r + 1.570795, r), rotationMatrix[0])
|
||||
rotationMatrix[1].x = -rotationMatrix[0].y;
|
||||
rotationMatrix[1].y = rotationMatrix[0].x;
|
||||
|
||||
vec2 transformedVertex = rotationMatrix * (a_position2f * u_baseScale1f * e_elementOffsetScale.y / (4.0 + r * 0.75));
|
||||
transformedVertex.x *= u_aspectRatio1f;
|
||||
transformedVertex += u_sunPosition2f * (1.0 - e_elementOffsetScale.x);
|
||||
|
||||
v_color3f = e_elementColor3f * (0.05 + dot(u_sunPosition2f, u_sunPosition2f));
|
||||
|
||||
gl_Position = vec4(transformedVertex, 0.0, 1.0);
|
||||
v_occlusion1f = max(textureLod(u_sunOcclusionValue, vec2(0.5, 0.5), 0.0).r * 1.5 - 0.5, 0.0);
|
||||
if(v_occlusion1f == 0.0) {
|
||||
gl_Position = vec4(-10.0, -10.0, -10.0, 1.0);
|
||||
return;
|
||||
}
|
||||
|
||||
v_texcoord2f = e_elementTexture4f.xy + (a_position2f * 0.5 + 0.5) * e_elementTexture4f.zw;
|
||||
|
||||
float r = textureLod(u_exposureValue, vec2(0.5, 0.5), 0.0).r * 7.5;
|
||||
|
||||
mat2 rotationMatrix;
|
||||
FAKE_SIN(vec2(r + 1.570795, r), rotationMatrix[0])
|
||||
rotationMatrix[1].x = -rotationMatrix[0].y;
|
||||
rotationMatrix[1].y = rotationMatrix[0].x;
|
||||
|
||||
vec2 transformedVertex = rotationMatrix * (a_position2f * u_baseScale1f * e_elementOffsetScale.y / (4.0 + r * 0.75));
|
||||
transformedVertex.x *= u_aspectRatio1f;
|
||||
transformedVertex += u_sunPosition2f * (1.0 - e_elementOffsetScale.x);
|
||||
|
||||
v_color3f = e_elementColor3f * (0.05 + dot(u_sunPosition2f, u_sunPosition2f));
|
||||
|
||||
gl_Position = vec4(transformedVertex, 0.0, 1.0);
|
||||
}
|
||||
|
|
|
@ -279,7 +279,11 @@ public class PlatformApplication {
|
|||
}
|
||||
|
||||
public static void showDebugConsole() {
|
||||
|
||||
}
|
||||
|
||||
public static void setMCServerWindowGlobal(String str) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -81,7 +81,7 @@ public class PlatformAssets {
|
|||
if (!a) {
|
||||
j = j | 0xFF000000;
|
||||
}
|
||||
pixels[i] = (j & 0xFF00FF00) | ((j & 0x00FF0000) >> 16) |
|
||||
pixels[i] = (j & 0xFF00FF00) | ((j & 0x00FF0000) >>> 16) |
|
||||
((j & 0x000000FF) << 16);
|
||||
}
|
||||
return new ImageData(w, h, pixels, a);
|
||||
|
|
|
@ -148,9 +148,9 @@ public class PlatformRuntime {
|
|||
|
||||
int[] px = new int[w * h];
|
||||
windowIcons[i].getRGB(0, 0, w, h, px, 0, w);
|
||||
|
||||
for (int j = 0; j < px.length; ++j) {
|
||||
px[j] = (px[j] & 0xFF00FF00) | ((px[j] >> 16) & 0xFF) | ((px[j] & 0xFF) << 16); // swap R/B
|
||||
|
||||
for(int j = 0; j < px.length; ++j) {
|
||||
px[j] = (px[j] & 0xFF00FF00) | ((px[j] >>> 16) & 0xFF) | ((px[j] & 0xFF) << 16); // swap R/B
|
||||
}
|
||||
|
||||
java.nio.ByteBuffer iconBuffer = st.malloc(w * h * 4);
|
||||
|
|
|
@ -1,170 +1,176 @@
|
|||
package net.lax1dude.eaglercraft.v1_8.internal.lwjgl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
import net.lax1dude.eaglercraft.v1_8.EaglercraftRandom;
|
||||
import net.lax1dude.eaglercraft.v1_8.EaglercraftVersion;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.IClientConfigAdapter;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.IClientConfigAdapterHooks;
|
||||
import net.lax1dude.eaglercraft.v1_8.sp.relay.RelayEntry;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2022 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 DesktopClientConfigAdapter implements IClientConfigAdapter {
|
||||
|
||||
public static final IClientConfigAdapter instance = new DesktopClientConfigAdapter();
|
||||
|
||||
public final List<DefaultServer> defaultServers = new ArrayList();
|
||||
|
||||
private final DesktopClientConfigAdapterHooks hooks = new DesktopClientConfigAdapterHooks();
|
||||
|
||||
@Override
|
||||
public String getDefaultLocale() {
|
||||
return "en_US";
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DefaultServer> getDefaultServerList() {
|
||||
return defaultServers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getServerToJoin() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getWorldsDB() {
|
||||
return "desktop";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getResourcePacksDB() {
|
||||
return "desktop";
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject getIntegratedServerOpts() {
|
||||
return new JSONObject("{\"container\":null,\"worldsDB\":\"desktop\"}");
|
||||
}
|
||||
|
||||
private final List<RelayEntry> relays = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
public List<RelayEntry> getRelays() {
|
||||
if (relays.isEmpty()) {
|
||||
int relayId = (new EaglercraftRandom()).nextInt(3);
|
||||
relays.add(new RelayEntry("wss://relay.deev.is/", "lax1dude relay #1", relayId == 0));
|
||||
relays.add(new RelayEntry("wss://relay.lax1dude.net/", "lax1dude relay #2", relayId == 1));
|
||||
relays.add(new RelayEntry("wss://relay.shhnowisnottheti.me/", "ayunami relay #1", relayId == 2));
|
||||
}
|
||||
return relays;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCheckShaderGLErrors() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDemo() {
|
||||
return EaglercraftVersion.forceDemoMode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean allowUpdateSvc() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean allowUpdateDL() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnableDownloadOfflineButton() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDownloadOfflineButtonLink() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean useSpecialCursors() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLogInvalidCerts() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCheckRelaysForUpdates() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnableSignatureBadge() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAllowVoiceClient() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAllowFNAWSkins() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLocalStorageNamespace() {
|
||||
return EaglercraftVersion.localStorageNamespace;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IClientConfigAdapterHooks getHooks() {
|
||||
return hooks;
|
||||
}
|
||||
|
||||
private static class DesktopClientConfigAdapterHooks implements IClientConfigAdapterHooks {
|
||||
|
||||
@Override
|
||||
public void callLocalStorageSavedHook(String key, String base64) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String callLocalStorageLoadHook(String key) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
package net.lax1dude.eaglercraft.v1_8.internal.lwjgl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
import net.lax1dude.eaglercraft.v1_8.EaglercraftRandom;
|
||||
import net.lax1dude.eaglercraft.v1_8.EaglercraftVersion;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.IClientConfigAdapter;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.IClientConfigAdapterHooks;
|
||||
import net.lax1dude.eaglercraft.v1_8.sp.relay.RelayEntry;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2022 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 DesktopClientConfigAdapter implements IClientConfigAdapter {
|
||||
|
||||
public static final IClientConfigAdapter instance = new DesktopClientConfigAdapter();
|
||||
|
||||
public final List<DefaultServer> defaultServers = new ArrayList();
|
||||
|
||||
private final DesktopClientConfigAdapterHooks hooks = new DesktopClientConfigAdapterHooks();
|
||||
|
||||
@Override
|
||||
public String getDefaultLocale() {
|
||||
return "en_US";
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DefaultServer> getDefaultServerList() {
|
||||
return defaultServers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getServerToJoin() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getWorldsDB() {
|
||||
return "desktop";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getResourcePacksDB() {
|
||||
return "desktop";
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject getIntegratedServerOpts() {
|
||||
return new JSONObject("{\"container\":null,\"worldsDB\":\"desktop\"}");
|
||||
}
|
||||
|
||||
private final List<RelayEntry> relays = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
public List<RelayEntry> getRelays() {
|
||||
if (relays.isEmpty()) {
|
||||
int relayId = (new EaglercraftRandom()).nextInt(3);
|
||||
relays.add(new RelayEntry("wss://relay.deev.is/", "lax1dude relay #1", relayId == 0));
|
||||
relays.add(new RelayEntry("wss://relay.lax1dude.net/", "lax1dude relay #2", relayId == 1));
|
||||
relays.add(new RelayEntry("wss://relay.shhnowisnottheti.me/", "ayunami relay #1", relayId == 2));
|
||||
}
|
||||
return relays;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCheckShaderGLErrors() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDemo() {
|
||||
return EaglercraftVersion.forceDemoMode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean allowUpdateSvc() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean allowUpdateDL() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnableDownloadOfflineButton() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDownloadOfflineButtonLink() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean useSpecialCursors() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLogInvalidCerts() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCheckRelaysForUpdates() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnableSignatureBadge() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAllowVoiceClient() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAllowFNAWSkins() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLocalStorageNamespace() {
|
||||
return EaglercraftVersion.localStorageNamespace;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IClientConfigAdapterHooks getHooks() {
|
||||
return hooks;
|
||||
}
|
||||
|
||||
private static class DesktopClientConfigAdapterHooks implements IClientConfigAdapterHooks {
|
||||
|
||||
@Override
|
||||
public void callLocalStorageSavedHook(String key, String base64) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String callLocalStorageLoadHook(String key) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void callCrashReportHook(String crashReport, Consumer<String> customMessageCB) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -237,6 +237,9 @@ public class EagRuntime {
|
|||
return PlatformRuntime.maxMemory();
|
||||
}
|
||||
|
||||
/**
|
||||
* Note to skids: This doesn't do anything in TeaVM runtime!
|
||||
*/
|
||||
public static long totalMemory() {
|
||||
return PlatformRuntime.totalMemory();
|
||||
}
|
||||
|
@ -333,4 +336,8 @@ public class EagRuntime {
|
|||
input.setCalendar(getLocaleCalendar());
|
||||
return input;
|
||||
}
|
||||
|
||||
public static void setMCServerWindowGlobal(String url) {
|
||||
PlatformApplication.setMCServerWindowGlobal(url);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,9 +19,9 @@ public class EaglercraftVersion {
|
|||
|
||||
public static final String projectOriginName = "EaglercraftX";
|
||||
public static final String projectOriginAuthor = "lax1dude";
|
||||
public static final String projectOriginRevision = "1.9.4";
|
||||
public static final String projectOriginVersion = "u35";
|
||||
|
||||
public static final String projectOriginRevision = "1.8";
|
||||
public static final String projectOriginVersion = "u36";
|
||||
|
||||
public static final String projectOriginURL = "https://gitlab.com/lax1dude/eaglercraftx-1.8"; // rest in peace
|
||||
|
||||
// Updating configuration
|
||||
|
@ -34,7 +34,7 @@ public class EaglercraftVersion {
|
|||
"https://update.hoosiertransfer.xyz/cert");
|
||||
|
||||
public static final String updateBundlePackageName = "net.lax1dude.eaglercraft.v1_8.client";
|
||||
public static final int updateBundlePackageVersionInt = 2;
|
||||
public static final int updateBundlePackageVersionInt = 3;
|
||||
|
||||
public static final String updateLatestLocalStorageKey = "latestUpdate_" + updateBundlePackageName;
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package net.lax1dude.eaglercraft.v1_8.internal;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2024 lax1dude. All Rights Reserved.
|
||||
*
|
||||
|
@ -28,4 +30,6 @@ public interface IClientConfigAdapterHooks {
|
|||
|
||||
String callLocalStorageLoadHook(String key);
|
||||
|
||||
void callCrashReportHook(String crashReport, Consumer<String> customMessageCB);
|
||||
|
||||
}
|
||||
|
|
|
@ -77,7 +77,7 @@ public class AcceleratedEffectRenderer implements IAcceleratedParticleEngine {
|
|||
int lightMapData, int texSize, float particleSize, float r, float g, float b, float a) {
|
||||
if (!Config.renderParticles()) return;
|
||||
InstancedParticleRenderer.appendParticle(posX, posY, posZ, particleIndexX, particleIndexY, lightMapData & 0xFF,
|
||||
(lightMapData >> 16) & 0xFF, (int)(particleSize * 16.0f), texSize, r, g, b, a);
|
||||
(lightMapData >>> 16) & 0xFF, (int)(particleSize * 16.0f), texSize, r, g, b, a);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -85,7 +85,7 @@ public class AcceleratedEffectRenderer implements IAcceleratedParticleEngine {
|
|||
int lightMapData, int texSize, float particleSize, int rgba) {
|
||||
if (!Config.renderParticles()) return;
|
||||
InstancedParticleRenderer.appendParticle(posX, posY, posZ, particleIndexX, particleIndexY, lightMapData & 0xFF,
|
||||
(lightMapData >> 16) & 0xFF, (int)(particleSize * 16.0f), texSize, rgba);
|
||||
(lightMapData >>> 16) & 0xFF, (int)(particleSize * 16.0f), texSize, rgba);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -47,10 +47,10 @@ public class EaglerFontRenderer extends FontRenderer {
|
|||
if ((color & 0xFC000000) == 0) {
|
||||
color |= 0xFF000000;
|
||||
}
|
||||
this.red = (float) (color >> 16 & 255) / 255.0F;
|
||||
this.blue = (float) (color >> 8 & 255) / 255.0F;
|
||||
this.red = (float) (color >>> 16 & 255) / 255.0F;
|
||||
this.blue = (float) (color >>> 8 & 255) / 255.0F;
|
||||
this.green = (float) (color & 255) / 255.0F;
|
||||
this.alpha = (float) (color >> 24 & 255) / 255.0F;
|
||||
this.alpha = (float) (color >>> 24 & 255) / 255.0F;
|
||||
this.posX = x;
|
||||
this.posY = y;
|
||||
this.textColor = color;
|
||||
|
|
|
@ -72,8 +72,8 @@ public class ByteBufEaglercraftImpl extends AbstractByteBuf {
|
|||
|
||||
@Override
|
||||
protected void _setMedium(int index, int value) {
|
||||
internal.put(index, (byte)((value >> 16) & 0xFF));
|
||||
internal.put(index + 1, (byte)((value >> 8) & 0xFF));
|
||||
internal.put(index, (byte)((value >>> 16) & 0xFF));
|
||||
internal.put(index + 1, (byte)((value >>> 8) & 0xFF));
|
||||
internal.put(index + 2, (byte)(value & 0xFF));
|
||||
}
|
||||
|
||||
|
|
|
@ -118,14 +118,14 @@ public class ImageData {
|
|||
if((spx & 0xFF000000) == 0xFF000000 || (dpx & 0xFF000000) == 0) {
|
||||
pixels[di] = spx;
|
||||
}else {
|
||||
int sa = (spx >> 24) & 0xFF;
|
||||
int da = (dpx >> 24) & 0xFF;
|
||||
int r = ((spx >> 16) & 0xFF) * sa / 255;
|
||||
int g = ((spx >> 8) & 0xFF) * sa / 255;
|
||||
int sa = (spx >>> 24) & 0xFF;
|
||||
int da = (dpx >>> 24) & 0xFF;
|
||||
int r = ((spx >>> 16) & 0xFF) * sa / 255;
|
||||
int g = ((spx >>> 8) & 0xFF) * sa / 255;
|
||||
int b = (spx & 0xFF) * sa / 255;
|
||||
int aa = (255 - sa) * da;
|
||||
r += ((dpx >> 16) & 0xFF) * aa / 65025;
|
||||
g += ((dpx >> 8) & 0xFF) * aa / 65025;
|
||||
r += ((dpx >>> 16) & 0xFF) * aa / 65025;
|
||||
g += ((dpx >>> 8) & 0xFF) * aa / 65025;
|
||||
b += (dpx & 0xFF) * aa / 65025;
|
||||
sa += da;
|
||||
if(sa > 0xFF) sa = 0xFF;
|
||||
|
@ -138,14 +138,14 @@ public class ImageData {
|
|||
public ImageData swapRB() {
|
||||
for(int i = 0; i < pixels.length; ++i) {
|
||||
int j = pixels[i];
|
||||
pixels[i] = (j & 0xFF00FF00) | ((j & 0x00FF0000) >> 16) |
|
||||
pixels[i] = (j & 0xFF00FF00) | ((j & 0x00FF0000) >>> 16) |
|
||||
((j & 0x000000FF) << 16);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public static int swapRB(int c) {
|
||||
return (c & 0xFF00FF00) | ((c & 0x00FF0000) >> 16) | ((c & 0x000000FF) << 16);
|
||||
return (c & 0xFF00FF00) | ((c & 0x00FF0000) >>> 16) | ((c & 0x000000FF) << 16);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -413,7 +413,7 @@ public class InstancedFontRenderer {
|
|||
buf.putShort((short)y);
|
||||
buf.put((byte)cx);
|
||||
buf.put((byte)cy);
|
||||
color = ((color >> 1) & 0x7F000000) | (color & 0xFFFFFF);
|
||||
color = ((color >>> 1) & 0x7F000000) | (color & 0xFFFFFF);
|
||||
if(italic) {
|
||||
color |= 0x80000000;
|
||||
}
|
||||
|
@ -438,7 +438,7 @@ public class InstancedFontRenderer {
|
|||
buf.putShort((short)y);
|
||||
buf.put((byte)cx);
|
||||
buf.put((byte)cy);
|
||||
color = ((color >> 1) & 0x7F000000) | (color & 0xFFFFFF);
|
||||
color = ((color >>> 1) & 0x7F000000) | (color & 0xFFFFFF);
|
||||
if(italic) {
|
||||
color |= 0x80000000;
|
||||
}
|
||||
|
|
|
@ -275,8 +275,8 @@ public class WorldRenderer {
|
|||
if (!this.needsUpdate) {
|
||||
j = this.intBuffer.get(i);
|
||||
int k = (int) ((float) (j & 255) * red);
|
||||
int l = (int) ((float) (j >> 8 & 255) * green);
|
||||
int i1 = (int) ((float) (j >> 16 & 255) * blue);
|
||||
int l = (int) ((float) (j >>> 8 & 255) * green);
|
||||
int i1 = (int) ((float) (j >>> 16 & 255) * blue);
|
||||
j = j & -16777216;
|
||||
j = j | i1 << 16 | l << 8 | k;
|
||||
}
|
||||
|
@ -288,10 +288,10 @@ public class WorldRenderer {
|
|||
*/
|
||||
private void putColor(int argb, int parInt2) {
|
||||
int i = this.getColorIndex(parInt2);
|
||||
int j = argb >> 16 & 255;
|
||||
int k = argb >> 8 & 255;
|
||||
int j = argb >>> 16 & 255;
|
||||
int k = argb >>> 8 & 255;
|
||||
int l = argb & 255;
|
||||
int i1 = argb >> 24 & 255;
|
||||
int i1 = argb >>> 24 & 255;
|
||||
this.putColorRGBA(i, j, k, l, i1);
|
||||
}
|
||||
|
||||
|
|
|
@ -63,8 +63,8 @@ public class CapePackets {
|
|||
}
|
||||
|
||||
public static byte[] writeMyCapePreset(int capeId) {
|
||||
return new byte[] { (byte) PACKET_MY_CAPE_PRESET, (byte) (capeId >> 24), (byte) (capeId >> 16),
|
||||
(byte) (capeId >> 8), (byte) (capeId & 0xFF) };
|
||||
return new byte[] { (byte) PACKET_MY_CAPE_PRESET, (byte) (capeId >>> 24), (byte) (capeId >>> 16),
|
||||
(byte) (capeId >>> 8), (byte) (capeId & 0xFF) };
|
||||
}
|
||||
|
||||
public static byte[] writeMyCapeCustom(CustomCape customCape) {
|
||||
|
|
|
@ -1,75 +1,80 @@
|
|||
package net.lax1dude.eaglercraft.v1_8.profile;
|
||||
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
/**
|
||||
* 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 enum DefaultCapes {
|
||||
|
||||
NO_CAPE(0, "No Cape", null),
|
||||
MINECON_2011(1, "Minecon 2011", new ResourceLocation("eagler:capes/01.minecon_2011.png")),
|
||||
MINECON_2012(2, "Minecon 2012", new ResourceLocation("eagler:capes/02.minecon_2012.png")),
|
||||
MINECON_2013(3, "Minecon 2013", new ResourceLocation("eagler:capes/03.minecon_2013.png")),
|
||||
MINECON_2015(4, "Minecon 2015", new ResourceLocation("eagler:capes/04.minecon_2015.png")),
|
||||
MINECON_2016(5, "Minecon 2016", new ResourceLocation("eagler:capes/05.minecon_2016.png")),
|
||||
MICROSOFT_ACCOUNT(6, "Microsoft Account", new ResourceLocation("eagler:capes/06.microsoft_account.png")),
|
||||
MAPMAKER(7, "Realms Mapmaker", new ResourceLocation("eagler:capes/07.mapmaker.png")),
|
||||
MOJANG_OLD(8, "Mojang Old", new ResourceLocation("eagler:capes/08.mojang_old.png")),
|
||||
MOJANG_NEW(9, "Mojang New", new ResourceLocation("eagler:capes/09.mojang_new.png")),
|
||||
JIRA_MOD(10, "Jira Moderator", new ResourceLocation("eagler:capes/10.jira_mod.png")),
|
||||
MOJANG_VERY_OLD(11, "Mojang Very Old", new ResourceLocation("eagler:capes/11.mojang_very_old.png")),
|
||||
SCROLLS(12, "Scrolls", new ResourceLocation("eagler:capes/12.scrolls.png")),
|
||||
COBALT(13, "Cobalt", new ResourceLocation("eagler:capes/13.cobalt.png")),
|
||||
TRANSLATOR(14, "Lang Translator", new ResourceLocation("eagler:capes/14.translator.png")),
|
||||
MILLIONTH_ACCOUNT(15, "Millionth Player", new ResourceLocation("eagler:capes/15.millionth_account.png")),
|
||||
PRISMARINE(16, "Prismarine", new ResourceLocation("eagler:capes/16.prismarine.png")),
|
||||
SNOWMAN(17, "Snowman", new ResourceLocation("eagler:capes/17.snowman.png")),
|
||||
SPADE(18, "Spade", new ResourceLocation("eagler:capes/18.spade.png")),
|
||||
BIRTHDAY(19, "Birthday", new ResourceLocation("eagler:capes/19.birthday.png")),
|
||||
DB(20, "dB", new ResourceLocation("eagler:capes/20.db.png"));
|
||||
|
||||
public static final DefaultCapes[] defaultCapesMap = new DefaultCapes[21];
|
||||
|
||||
public final int id;
|
||||
public final String name;
|
||||
public final ResourceLocation location;
|
||||
|
||||
private DefaultCapes(int id, String name, ResourceLocation location) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.location = location;
|
||||
}
|
||||
|
||||
public static DefaultCapes getCapeFromId(int id) {
|
||||
DefaultCapes e = null;
|
||||
if(id >= 0 && id < defaultCapesMap.length) {
|
||||
e = defaultCapesMap[id];
|
||||
}
|
||||
if(e != null) {
|
||||
return e;
|
||||
}else {
|
||||
return NO_CAPE;
|
||||
}
|
||||
}
|
||||
|
||||
static {
|
||||
DefaultCapes[] capes = values();
|
||||
for(int i = 0; i < capes.length; ++i) {
|
||||
defaultCapesMap[capes[i].id] = capes[i];
|
||||
}
|
||||
}
|
||||
|
||||
package net.lax1dude.eaglercraft.v1_8.profile;
|
||||
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
/**
|
||||
* 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 enum DefaultCapes {
|
||||
|
||||
NO_CAPE(0, "No Cape", null),
|
||||
MINECON_2011(1, "Minecon 2011", new ResourceLocation("eagler:capes/01.minecon_2011.png")),
|
||||
MINECON_2012(2, "Minecon 2012", new ResourceLocation("eagler:capes/02.minecon_2012.png")),
|
||||
MINECON_2013(3, "Minecon 2013", new ResourceLocation("eagler:capes/03.minecon_2013.png")),
|
||||
MINECON_2015(4, "Minecon 2015", new ResourceLocation("eagler:capes/04.minecon_2015.png")),
|
||||
MINECON_2016(5, "Minecon 2016", new ResourceLocation("eagler:capes/05.minecon_2016.png")),
|
||||
MICROSOFT_ACCOUNT(6, "Microsoft Account", new ResourceLocation("eagler:capes/06.microsoft_account.png")),
|
||||
MAPMAKER(7, "Realms Mapmaker", new ResourceLocation("eagler:capes/07.mapmaker.png")),
|
||||
MOJANG_OLD(8, "Mojang Old", new ResourceLocation("eagler:capes/08.mojang_old.png")),
|
||||
MOJANG_NEW(9, "Mojang New", new ResourceLocation("eagler:capes/09.mojang_new.png")),
|
||||
JIRA_MOD(10, "Jira Moderator", new ResourceLocation("eagler:capes/10.jira_mod.png")),
|
||||
MOJANG_VERY_OLD(11, "Mojang Very Old", new ResourceLocation("eagler:capes/11.mojang_very_old.png")),
|
||||
SCROLLS(12, "Scrolls", new ResourceLocation("eagler:capes/12.scrolls.png")),
|
||||
COBALT(13, "Cobalt", new ResourceLocation("eagler:capes/13.cobalt.png")),
|
||||
TRANSLATOR(14, "Lang Translator", new ResourceLocation("eagler:capes/14.translator.png")),
|
||||
MILLIONTH_ACCOUNT(15, "Millionth Player", new ResourceLocation("eagler:capes/15.millionth_account.png")),
|
||||
PRISMARINE(16, "Prismarine", new ResourceLocation("eagler:capes/16.prismarine.png")),
|
||||
SNOWMAN(17, "Snowman", new ResourceLocation("eagler:capes/17.snowman.png")),
|
||||
SPADE(18, "Spade", new ResourceLocation("eagler:capes/18.spade.png")),
|
||||
BIRTHDAY(19, "Birthday", new ResourceLocation("eagler:capes/19.birthday.png")),
|
||||
DB(20, "dB", new ResourceLocation("eagler:capes/20.db.png")),
|
||||
_15TH_ANNIVERSARY(21, "15th Anniversary", new ResourceLocation("eagler:capes/21.15th_anniversary.png")),
|
||||
VANILLA(22, "Vanilla", new ResourceLocation("eagler:capes/22.vanilla.png")),
|
||||
TIKTOK(23, "TikTok", new ResourceLocation("eagler:capes/23.tiktok.png")),
|
||||
PURPLE_HEART(24, "Purple Heart", new ResourceLocation("eagler:capes/24.purple_heart.png")),
|
||||
CHERRY_BLOSSOM(25, "Cherry Blossom", new ResourceLocation("eagler:capes/25.cherry_blossom.png"));
|
||||
|
||||
public static final DefaultCapes[] defaultCapesMap = new DefaultCapes[26];
|
||||
|
||||
public final int id;
|
||||
public final String name;
|
||||
public final ResourceLocation location;
|
||||
|
||||
private DefaultCapes(int id, String name, ResourceLocation location) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.location = location;
|
||||
}
|
||||
|
||||
public static DefaultCapes getCapeFromId(int id) {
|
||||
DefaultCapes e = null;
|
||||
if(id >= 0 && id < defaultCapesMap.length) {
|
||||
e = defaultCapesMap[id];
|
||||
}
|
||||
if(e != null) {
|
||||
return e;
|
||||
}else {
|
||||
return NO_CAPE;
|
||||
}
|
||||
}
|
||||
|
||||
static {
|
||||
DefaultCapes[] capes = values();
|
||||
for(int i = 0; i < capes.length; ++i) {
|
||||
defaultCapesMap[capes[i].id] = capes[i];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -363,10 +363,10 @@ public class GuiScreenEditProfile extends GuiScreen {
|
|||
for (int i = 0, j, k; i < 4096; ++i) {
|
||||
j = i << 2;
|
||||
k = loadedSkin.pixels[i];
|
||||
rawSkin[j] = (byte) (k >> 24);
|
||||
rawSkin[j + 1] = (byte) (k >> 16);
|
||||
rawSkin[j + 2] = (byte) (k >> 8);
|
||||
rawSkin[j + 3] = (byte) (k & 0xFF);
|
||||
rawSkin[j] = (byte)(k >>> 24);
|
||||
rawSkin[j + 1] = (byte)(k >>> 16);
|
||||
rawSkin[j + 2] = (byte)(k >>> 8);
|
||||
rawSkin[j + 3] = (byte)(k & 0xFF);
|
||||
}
|
||||
for (int y = 20; y < 32; ++y) {
|
||||
for (int x = 16; x < 40; ++x) {
|
||||
|
|
|
@ -68,7 +68,7 @@ public class ProfileExporter {
|
|||
+ (doExportServers ? "servers " : "") + (doExportResourcePacks ? "resourcePacks" : "") + "\n\n")
|
||||
.getBytes(StandardCharsets.UTF_8);
|
||||
|
||||
osb.write((comment.length >> 8) & 255);
|
||||
osb.write((comment.length >>> 8) & 255);
|
||||
osb.write(comment.length & 255);
|
||||
osb.write(comment);
|
||||
|
||||
|
@ -181,11 +181,11 @@ public class ProfileExporter {
|
|||
|
||||
byte[] ret = osb.toByteArray();
|
||||
|
||||
ret[lengthIntegerOffset] = (byte) ((fileCount >> 24) & 0xFF);
|
||||
ret[lengthIntegerOffset + 1] = (byte) ((fileCount >> 16) & 0xFF);
|
||||
ret[lengthIntegerOffset + 2] = (byte) ((fileCount >> 8) & 0xFF);
|
||||
ret[lengthIntegerOffset + 3] = (byte) (fileCount & 0xFF);
|
||||
|
||||
ret[lengthIntegerOffset] = (byte)((fileCount >>> 24) & 0xFF);
|
||||
ret[lengthIntegerOffset + 1] = (byte)((fileCount >>> 16) & 0xFF);
|
||||
ret[lengthIntegerOffset + 2] = (byte)((fileCount >>> 8) & 0xFF);
|
||||
ret[lengthIntegerOffset + 3] = (byte)(fileCount & 0xFF);
|
||||
|
||||
logger.info("Export complete!");
|
||||
|
||||
EagRuntime.downloadFileWithName(EaglerProfile.getName() + "-backup.epk", ret);
|
||||
|
|
|
@ -49,11 +49,11 @@ public class SkinConverter {
|
|||
for (int x = 0; x < 22; ++x) {
|
||||
i = (y * 23 + x) * 3;
|
||||
j = skinIn.pixels[y * skinIn.width + x];
|
||||
if ((j & 0xFF000000) != 0) {
|
||||
skinOut[i] = (byte) (j >> 16);
|
||||
skinOut[i + 1] = (byte) (j >> 8);
|
||||
skinOut[i + 2] = (byte) (j & 0xFF);
|
||||
} else {
|
||||
if((j & 0xFF000000) != 0) {
|
||||
skinOut[i] = (byte)(j >>> 16);
|
||||
skinOut[i + 1] = (byte)(j >>> 8);
|
||||
skinOut[i + 2] = (byte)(j & 0xFF);
|
||||
}else {
|
||||
skinOut[i] = skinOut[i + 1] = skinOut[i + 2] = 0;
|
||||
}
|
||||
}
|
||||
|
@ -61,11 +61,11 @@ public class SkinConverter {
|
|||
for (int y = 0; y < 11; ++y) {
|
||||
i = ((y + 6) * 23 + 22) * 3;
|
||||
j = skinIn.pixels[(y + 11) * skinIn.width + 22];
|
||||
if ((j & 0xFF000000) != 0) {
|
||||
skinOut[i] = (byte) (j >> 16);
|
||||
skinOut[i + 1] = (byte) (j >> 8);
|
||||
skinOut[i + 2] = (byte) (j & 0xFF);
|
||||
} else {
|
||||
if((j & 0xFF000000) != 0) {
|
||||
skinOut[i] = (byte)(j >>> 16);
|
||||
skinOut[i + 1] = (byte)(j >>> 8);
|
||||
skinOut[i + 2] = (byte)(j & 0xFF);
|
||||
}else {
|
||||
skinOut[i] = skinOut[i + 1] = skinOut[i + 2] = 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -91,8 +91,8 @@ public class SkinPackets {
|
|||
}
|
||||
|
||||
public static byte[] writeMySkinPreset(int skinId) {
|
||||
return new byte[] { (byte) PACKET_MY_SKIN_PRESET, (byte) (skinId >> 24), (byte) (skinId >> 16),
|
||||
(byte) (skinId >> 8), (byte) (skinId & 0xFF) };
|
||||
return new byte[] { (byte) PACKET_MY_SKIN_PRESET, (byte) (skinId >>> 24), (byte) (skinId >>> 16),
|
||||
(byte) (skinId >>> 8), (byte) (skinId & 0xFF) };
|
||||
}
|
||||
|
||||
public static byte[] writeMySkinCustom(CustomSkin customSkin) {
|
||||
|
|
|
@ -205,14 +205,14 @@ public class ConnectionHandshake {
|
|||
SHA256Digest digest = new SHA256Digest();
|
||||
|
||||
int passLen = password.length();
|
||||
|
||||
digest.update((byte) ((passLen >> 8) & 0xFF));
|
||||
digest.update((byte) (passLen & 0xFF));
|
||||
|
||||
for (int i = 0; i < passLen; ++i) {
|
||||
|
||||
digest.update((byte)((passLen >>> 8) & 0xFF));
|
||||
digest.update((byte)(passLen & 0xFF));
|
||||
|
||||
for(int i = 0; i < passLen; ++i) {
|
||||
char codePoint = password.charAt(i);
|
||||
digest.update((byte) ((codePoint >> 8) & 0xFF));
|
||||
digest.update((byte) (codePoint & 0xFF));
|
||||
digest.update((byte)((codePoint >>> 8) & 0xFF));
|
||||
digest.update((byte)(codePoint & 0xFF));
|
||||
}
|
||||
|
||||
digest.update(HandshakePacketTypes.EAGLER_SHA256_SALT_SAVE, 0, 32);
|
||||
|
|
|
@ -57,9 +57,9 @@ public class SkullCommand {
|
|||
for(int i = 0, j, k; i < 4096; ++i) {
|
||||
j = i << 2;
|
||||
k = loaded.pixels[i];
|
||||
rawSkin[j] = (byte)(k >> 24);
|
||||
rawSkin[j + 1] = (byte)(k >> 16);
|
||||
rawSkin[j + 2] = (byte)(k >> 8);
|
||||
rawSkin[j] = (byte)(k >>> 24);
|
||||
rawSkin[j + 1] = (byte)(k >>> 16);
|
||||
rawSkin[j + 2] = (byte)(k >>> 8);
|
||||
rawSkin[j + 3] = (byte)(k & 0xFF);
|
||||
}
|
||||
mc.thePlayer.sendQueue.addToSendQueue(new C17PacketCustomPayload("EAG|Skins-1.8", SkinPackets.writeCreateCustomSkull(rawSkin)));
|
||||
|
|
|
@ -8,8 +8,10 @@ import net.lax1dude.eaglercraft.v1_8.sp.relay.RelayServer;
|
|||
import net.lax1dude.eaglercraft.v1_8.sp.relay.RelayServerSocket;
|
||||
import net.lax1dude.eaglercraft.v1_8.sp.socket.NetHandlerSingleplayerLogin;
|
||||
import net.minecraft.client.LoadingScreenRenderer;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiDisconnected;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.multiplayer.ServerData;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.network.EnumConnectionState;
|
||||
import net.minecraft.network.login.client.C00PacketLoginStart;
|
||||
|
@ -62,6 +64,7 @@ public class GuiScreenLANConnecting extends GuiScreen {
|
|||
this.parent = parent;
|
||||
this.code = code;
|
||||
this.relay = relay;
|
||||
Minecraft.getMinecraft().setServerData(new ServerData("Shared World", "shared:" + relay.address, false));
|
||||
}
|
||||
|
||||
public boolean doesGuiPauseGame() {
|
||||
|
|
|
@ -40,7 +40,7 @@ import net.lax1dude.eaglercraft.v1_8.sp.relay.pkt.*;
|
|||
*/
|
||||
public class LANServerController {
|
||||
|
||||
public static final Logger logger = LogManager.getLogger("IntegratedServerLAN");
|
||||
public static final Logger logger = LogManager.getLogger("LANServerController");
|
||||
|
||||
public static final List<String> currentICEServers = new ArrayList();
|
||||
|
||||
|
|
|
@ -154,7 +154,7 @@ public class IPacket {
|
|||
is.write(0);
|
||||
}else {
|
||||
int l = txt.length();
|
||||
is.write((l >> 8) & 0xFF);
|
||||
is.write((l >>> 8) & 0xFF);
|
||||
is.write(l & 0xFF);
|
||||
for(int i = 0; i < l; ++i) {
|
||||
is.write((int)txt.charAt(i));
|
||||
|
|
|
@ -42,8 +42,8 @@ public class EaglerChunkLoader extends AnvilChunkLoader {
|
|||
|
||||
char[] path = new char[12];
|
||||
for(int i = 5; i >= 0; --i) {
|
||||
path[i] = hex.charAt((unsignedX >> (i * 4)) & 0xF);
|
||||
path[i + 6] = hex.charAt((unsignedZ >> (i * 4)) & 0xF);
|
||||
path[i] = hex.charAt((unsignedX >>> (i << 2)) & 0xF);
|
||||
path[i + 6] = hex.charAt((unsignedZ >>> (i << 2)) & 0xF);
|
||||
}
|
||||
|
||||
return new String(path);
|
||||
|
|
|
@ -49,7 +49,7 @@ public class EPKCompiler {
|
|||
EagRuntime.fixDateFormat(new SimpleDateFormat("hh:mm:ss aa")).format(d) + "\n\n # world name: " + name + "\n\n")
|
||||
.getBytes(StandardCharsets.UTF_8);
|
||||
|
||||
os.write((comment.length >> 8) & 255);
|
||||
os.write((comment.length >>> 8) & 255);
|
||||
os.write(comment.length & 255);
|
||||
os.write(comment);
|
||||
|
||||
|
@ -134,9 +134,9 @@ public class EPKCompiler {
|
|||
|
||||
byte[] ret = os.toByteArray();
|
||||
|
||||
ret[lengthIntegerOffset] = (byte)((totalFileCount >> 24) & 0xFF);
|
||||
ret[lengthIntegerOffset + 1] = (byte)((totalFileCount >> 16) & 0xFF);
|
||||
ret[lengthIntegerOffset + 2] = (byte)((totalFileCount >> 8) & 0xFF);
|
||||
ret[lengthIntegerOffset] = (byte)(totalFileCount >>> 24);
|
||||
ret[lengthIntegerOffset + 1] = (byte)(totalFileCount >>> 16);
|
||||
ret[lengthIntegerOffset + 2] = (byte)(totalFileCount >>> 8);
|
||||
ret[lengthIntegerOffset + 3] = (byte)(totalFileCount & 0xFF);
|
||||
|
||||
return ret;
|
||||
|
@ -147,21 +147,21 @@ public class EPKCompiler {
|
|||
}
|
||||
|
||||
public static void writeInt(int i, OutputStream os) throws IOException {
|
||||
os.write((i >> 24) & 0xFF);
|
||||
os.write((i >> 16) & 0xFF);
|
||||
os.write((i >> 8) & 0xFF);
|
||||
os.write((i >>> 24) & 0xFF);
|
||||
os.write((i >>> 16) & 0xFF);
|
||||
os.write((i >>> 8) & 0xFF);
|
||||
os.write(i & 0xFF);
|
||||
}
|
||||
|
||||
public static void writeLong(long i, OutputStream os) throws IOException {
|
||||
os.write((int)((i >> 56) & 0xFF));
|
||||
os.write((int)((i >> 48) & 0xFF));
|
||||
os.write((int)((i >> 40) & 0xFF));
|
||||
os.write((int)((i >> 32) & 0xFF));
|
||||
os.write((int)((i >> 24) & 0xFF));
|
||||
os.write((int)((i >> 16) & 0xFF));
|
||||
os.write((int)((i >> 8) & 0xFF));
|
||||
os.write((int)(i & 0xFF));
|
||||
os.write((int)((i >>> 56l) & 0xFFl));
|
||||
os.write((int)((i >>> 48l) & 0xFFl));
|
||||
os.write((int)((i >>> 40l) & 0xFFl));
|
||||
os.write((int)((i >>> 32l) & 0xFFl));
|
||||
os.write((int)((i >>> 24l) & 0xFFl));
|
||||
os.write((int)((i >>> 16l) & 0xFFl));
|
||||
os.write((int)((i >>> 8l) & 0xFFl));
|
||||
os.write((int)(i & 0xFFl));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -89,9 +89,9 @@ public class IntegratedCapePackets {
|
|||
byte[] ret = new byte[1 + 16 + 4];
|
||||
ret[0] = (byte)PACKET_OTHER_CAPE_PRESET;
|
||||
IntegratedSkinPackets.UUIDToBytes(uuid, ret, 1);
|
||||
ret[17] = (byte)(presetId >> 24);
|
||||
ret[18] = (byte)(presetId >> 16);
|
||||
ret[19] = (byte)(presetId >> 8);
|
||||
ret[17] = (byte)(presetId >>> 24);
|
||||
ret[18] = (byte)(presetId >>> 16);
|
||||
ret[19] = (byte)(presetId >>> 8);
|
||||
ret[20] = (byte)(presetId & 0xFF);
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -143,9 +143,9 @@ public class IntegratedSkinPackets {
|
|||
byte[] ret = new byte[1 + 16 + 4];
|
||||
ret[0] = (byte)PACKET_OTHER_SKIN_PRESET;
|
||||
UUIDToBytes(uuid, ret, 1);
|
||||
ret[17] = (byte)(presetId >> 24);
|
||||
ret[18] = (byte)(presetId >> 16);
|
||||
ret[19] = (byte)(presetId >> 8);
|
||||
ret[17] = (byte)(presetId >>> 24);
|
||||
ret[18] = (byte)(presetId >>> 16);
|
||||
ret[19] = (byte)(presetId >>> 8);
|
||||
ret[20] = (byte)(presetId & 0xFF);
|
||||
return ret;
|
||||
}
|
||||
|
@ -197,21 +197,21 @@ public class IntegratedSkinPackets {
|
|||
public static void UUIDToBytes(EaglercraftUUID uuid, byte[] bytes, int off) {
|
||||
long msb = uuid.getMostSignificantBits();
|
||||
long lsb = uuid.getLeastSignificantBits();
|
||||
bytes[off] = (byte)(msb >> 56l);
|
||||
bytes[off + 1] = (byte)(msb >> 48l);
|
||||
bytes[off + 2] = (byte)(msb >> 40l);
|
||||
bytes[off + 3] = (byte)(msb >> 32l);
|
||||
bytes[off + 4] = (byte)(msb >> 24l);
|
||||
bytes[off + 5] = (byte)(msb >> 16l);
|
||||
bytes[off + 6] = (byte)(msb >> 8l);
|
||||
bytes[off] = (byte)(msb >>> 56l);
|
||||
bytes[off + 1] = (byte)(msb >>> 48l);
|
||||
bytes[off + 2] = (byte)(msb >>> 40l);
|
||||
bytes[off + 3] = (byte)(msb >>> 32l);
|
||||
bytes[off + 4] = (byte)(msb >>> 24l);
|
||||
bytes[off + 5] = (byte)(msb >>> 16l);
|
||||
bytes[off + 6] = (byte)(msb >>> 8l);
|
||||
bytes[off + 7] = (byte)(msb & 0xFFl);
|
||||
bytes[off + 8] = (byte)(lsb >> 56l);
|
||||
bytes[off + 9] = (byte)(lsb >> 48l);
|
||||
bytes[off + 10] = (byte)(lsb >> 40l);
|
||||
bytes[off + 11] = (byte)(lsb >> 32l);
|
||||
bytes[off + 12] = (byte)(lsb >> 24l);
|
||||
bytes[off + 13] = (byte)(lsb >> 16l);
|
||||
bytes[off + 14] = (byte)(lsb >> 8l);
|
||||
bytes[off + 8] = (byte)(lsb >>> 56l);
|
||||
bytes[off + 9] = (byte)(lsb >>> 48l);
|
||||
bytes[off + 10] = (byte)(lsb >>> 40l);
|
||||
bytes[off + 11] = (byte)(lsb >>> 32l);
|
||||
bytes[off + 12] = (byte)(lsb >>> 24l);
|
||||
bytes[off + 13] = (byte)(lsb >>> 16l);
|
||||
bytes[off + 14] = (byte)(lsb >>> 8l);
|
||||
bytes[off + 15] = (byte)(lsb & 0xFFl);
|
||||
}
|
||||
|
||||
|
|
|
@ -253,9 +253,9 @@ public class IntegratedServerPlayerNetworkManager {
|
|||
byte[] compressedData;
|
||||
try {
|
||||
temporaryOutputStream.write(2);
|
||||
temporaryOutputStream.write((len >> 24) & 0xFF);
|
||||
temporaryOutputStream.write((len >> 16) & 0xFF);
|
||||
temporaryOutputStream.write((len >> 8) & 0xFF);
|
||||
temporaryOutputStream.write((len >>> 24) & 0xFF);
|
||||
temporaryOutputStream.write((len >>> 16) & 0xFF);
|
||||
temporaryOutputStream.write((len >>> 8) & 0xFF);
|
||||
temporaryOutputStream.write(len & 0xFF);
|
||||
try (OutputStream os = EaglerZLIB.newDeflaterOutputStream(temporaryOutputStream)) {
|
||||
temporaryBuffer.readBytes(os, len);
|
||||
|
|
|
@ -127,13 +127,13 @@ public class GuiUpdateVersionSlot extends GuiSlot {
|
|||
if(strs.size() > 2 && screen.mx > xx + iconSize && screen.my > yy + 8 && screen.mx < xx + getListWidth() - 5 && screen.my < yy + 25) {
|
||||
screen.tooltip = cert.bundleVersionComment;
|
||||
}
|
||||
char[] hexStr1 = new char[] { hexChars[(cert.bundleDataHash[0] >> 4) & 0xF],
|
||||
hexChars[cert.bundleDataHash[1] & 0xF], hexChars[(cert.bundleDataHash[1] >> 4) & 0xF],
|
||||
hexChars[cert.bundleDataHash[1] & 0xF], hexChars[(cert.bundleDataHash[2] >> 4) & 0xF],
|
||||
char[] hexStr1 = new char[] { hexChars[(cert.bundleDataHash[0] >>> 4) & 0xF],
|
||||
hexChars[cert.bundleDataHash[1] & 0xF], hexChars[(cert.bundleDataHash[1] >>> 4) & 0xF],
|
||||
hexChars[cert.bundleDataHash[1] & 0xF], hexChars[(cert.bundleDataHash[2] >>> 4) & 0xF],
|
||||
hexChars[cert.bundleDataHash[2] & 0xF] };
|
||||
char[] hexStr2 = new char[] { hexChars[(cert.bundleDataHash[29] >> 4) & 0xF],
|
||||
hexChars[cert.bundleDataHash[29] & 0xF], hexChars[(cert.bundleDataHash[30] >> 4) & 0xF],
|
||||
hexChars[cert.bundleDataHash[30] & 0xF], hexChars[(cert.bundleDataHash[31] >> 4) & 0xF],
|
||||
char[] hexStr2 = new char[] { hexChars[(cert.bundleDataHash[29] >>> 4) & 0xF],
|
||||
hexChars[cert.bundleDataHash[29] & 0xF], hexChars[(cert.bundleDataHash[30] >>> 4) & 0xF],
|
||||
hexChars[cert.bundleDataHash[30] & 0xF], hexChars[(cert.bundleDataHash[31] >>> 4) & 0xF],
|
||||
hexChars[cert.bundleDataHash[31] & 0xF] };
|
||||
screen.drawString(mc.fontRendererObj,
|
||||
"Author: " + EnumChatFormatting.GRAY + cert.bundleAuthorName + EnumChatFormatting.WHITE + " Hash: "
|
||||
|
|
|
@ -152,13 +152,12 @@ public class UpdateCertificate {
|
|||
(byte) 88, (byte) 215, (byte) 216, (byte) 253, (byte) 235, (byte) 7, (byte) 60 }, 0, 32);
|
||||
sha256.update(signaturePayload, 0, signaturePayload.length);
|
||||
sha256.doFinal(hash2048, 96);
|
||||
|
||||
hash2048[0] = (byte) ((signaturePayload.length >> 8) & 0xFF);
|
||||
hash2048[1] = (byte) (signaturePayload.length & 0xFF);
|
||||
|
||||
if (!Arrays.equals(hash2048, rsa2048sumDec)) {
|
||||
UpdateService.logger.error("SHA256 checksum of signature payload is invalid!");
|
||||
return null;
|
||||
|
||||
hash2048[0] = (byte)((signaturePayload.length >>> 8) & 0xFF);
|
||||
hash2048[1] = (byte)(signaturePayload.length & 0xFF);
|
||||
|
||||
if(!Arrays.equals(hash2048, rsa2048sumDec)) {
|
||||
throw new CertificateInvalidException("SHA256 checksum of signature payload is invalid!");
|
||||
}
|
||||
|
||||
UpdateCertificate cert;
|
||||
|
|
|
@ -615,9 +615,9 @@ public class GuiVoiceMenu extends Gui {
|
|||
}
|
||||
|
||||
public static int attenuate(int cin, float r, float g, float b, float a) {
|
||||
float var10 = (float) (cin >> 24 & 255) / 255.0F;
|
||||
float var6 = (float) (cin >> 16 & 255) / 255.0F;
|
||||
float var7 = (float) (cin >> 8 & 255) / 255.0F;
|
||||
float var10 = (float) (cin >>> 24 & 255) / 255.0F;
|
||||
float var6 = (float) (cin >>> 16 & 255) / 255.0F;
|
||||
float var7 = (float) (cin >>> 8 & 255) / 255.0F;
|
||||
float var8 = (float) (cin & 255) / 255.0F;
|
||||
var10 *= a;
|
||||
var6 *= r;
|
||||
|
|
|
@ -1827,6 +1827,7 @@ public class Minecraft implements IThreadListener {
|
|||
session.reset();
|
||||
SingleplayerServerController.launchEaglercraftServer(folderName, gameSettings.difficulty.getDifficultyId(),
|
||||
Math.max(gameSettings.renderDistanceChunks, 2), worldSettingsIn);
|
||||
EagRuntime.setMCServerWindowGlobal("singleplayer");
|
||||
this.displayGuiScreen(new GuiScreenIntegratedServerBusy(
|
||||
new GuiScreenSingleplayerConnecting(new GuiMainMenu(), "Connecting to " + folderName),
|
||||
"singleplayer.busy.startingIntegratedServer", "singleplayer.failed.startingIntegratedServer",
|
||||
|
@ -2115,6 +2116,22 @@ public class Minecraft implements IThreadListener {
|
|||
+ EaglercraftGPU.glGetString(7936);
|
||||
}
|
||||
});
|
||||
theCrash.getCategory().addCrashSectionCallable("Is Eagler Shaders", new Callable<String>() {
|
||||
public String call() throws Exception {
|
||||
return Minecraft.this.gameSettings.shaders ? "Yes" : "No";
|
||||
}
|
||||
});
|
||||
theCrash.getCategory().addCrashSectionCallable("Is Dynamic Lights", new Callable<String>() {
|
||||
public String call() throws Exception {
|
||||
return !Minecraft.this.gameSettings.shaders && Minecraft.this.gameSettings.enableDynamicLights ? "Yes"
|
||||
: "No";
|
||||
}
|
||||
});
|
||||
theCrash.getCategory().addCrashSectionCallable("In Ext. Pipeline", new Callable<String>() {
|
||||
public String call() throws Exception {
|
||||
return GlStateManager.isExtensionPipeline() ? "Yes" : "No";
|
||||
}
|
||||
});
|
||||
theCrash.getCategory().addCrashSectionCallable("Is Modded", new Callable<String>() {
|
||||
public String call() throws Exception {
|
||||
return "Definitely Not; You're an eagler";
|
||||
|
@ -2197,6 +2214,7 @@ public class Minecraft implements IThreadListener {
|
|||
*/
|
||||
public void setServerData(ServerData serverDataIn) {
|
||||
this.currentServerData = serverDataIn;
|
||||
EagRuntime.setMCServerWindowGlobal(serverDataIn != null ? serverDataIn.serverIP : null);
|
||||
}
|
||||
|
||||
public ServerData getCurrentServerData() {
|
||||
|
|
|
@ -598,8 +598,10 @@ public class GuiMainMenu extends GuiScreen implements GuiYesNoCallback {
|
|||
short short1 = 274;
|
||||
int k = this.width / 2 - short1 / 2;
|
||||
byte b0 = 30;
|
||||
this.drawGradientRect(0, 0, this.width, this.height, -2130706433, 16777215);
|
||||
this.drawGradientRect(0, 0, this.width, this.height, 0, Integer.MIN_VALUE);
|
||||
if (enableBlur) {
|
||||
this.drawGradientRect(0, 0, this.width, this.height, -2130706433, 16777215);
|
||||
this.drawGradientRect(0, 0, this.width, this.height, 0, Integer.MIN_VALUE);
|
||||
}
|
||||
this.mc.getTextureManager().bindTexture(minecraftTitleTextures);
|
||||
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
boolean minc = (double) this.updateCounter < 1.0E-4D;
|
||||
|
|
|
@ -129,7 +129,7 @@ public class MapItemRenderer {
|
|||
} else {
|
||||
c = MapColor.mapColorArray[j / 4].func_151643_b(j & 3);
|
||||
}
|
||||
this.mapTextureData[i] = (c & 0xFF00FF00) | ((c & 0x00FF0000) >> 16) | ((c & 0x000000FF) << 16);
|
||||
this.mapTextureData[i] = (c & 0xFF00FF00) | ((c & 0x00FF0000) >>> 16) | ((c & 0x000000FF) << 16);
|
||||
}
|
||||
|
||||
this.mapTexture.updateDynamicTexture();
|
||||
|
|
|
@ -366,9 +366,9 @@ public abstract class RendererLivingEntity<T extends EntityLivingBase> extends R
|
|||
return false;
|
||||
} else {
|
||||
GlStateManager.enableShaderBlendAdd();
|
||||
float f1 = 1.0F - (float) (i >> 24 & 255) / 255.0F;
|
||||
float f2 = (float) (i >> 16 & 255) / 255.0F;
|
||||
float f3 = (float) (i >> 8 & 255) / 255.0F;
|
||||
float f1 = 1.0F - (float) (i >>> 24 & 255) / 255.0F;
|
||||
float f2 = (float) (i >>> 16 & 255) / 255.0F;
|
||||
float f3 = (float) (i >>> 8 & 255) / 255.0F;
|
||||
float f4 = (float) (i & 255) / 255.0F;
|
||||
GlStateManager.setShaderBlendSrc(f1, f1, f1, 1.0F);
|
||||
GlStateManager.setShaderBlendAdd(f2 * f1 + 0.4F, f3 * f1, f4 * f1, 0.0f);
|
||||
|
|
|
@ -320,4 +320,7 @@ public class PlatformApplication {
|
|||
public static boolean isShowingDebugConsole() {
|
||||
return DebugConsoleWindow.isShowingDebugConsole();
|
||||
}
|
||||
|
||||
@JSBody(params = { "str" }, script = "window.minecraftServer = str;")
|
||||
public static native void setMCServerWindowGlobal(String str);
|
||||
}
|
||||
|
|
|
@ -630,6 +630,10 @@ public class PlatformInput {
|
|||
Window.clearTimeout(mouseUngrabTimeout);
|
||||
mouseUngrabTimeout = -1;
|
||||
}
|
||||
try {
|
||||
win.getDocument().exitPointerLock();
|
||||
}catch(Throwable t) {
|
||||
}
|
||||
}
|
||||
|
||||
public static void pressAnyKeyScreen() {
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -348,11 +348,11 @@ public class EaglerArrayByteBuffer implements ByteBuffer {
|
|||
@Override
|
||||
public ByteBuffer putLong(long value) {
|
||||
if(position + 8 > limit) throw new ArrayIndexOutOfBoundsException(position);
|
||||
dataView.setUint32(position, (int) (value & 0xFFFFFFFF), true);
|
||||
dataView.setUint8(position + 4, (short) ((value >> 32) & 0xFF));
|
||||
dataView.setUint8(position + 5, (short) ((value >> 40) & 0xFF));
|
||||
dataView.setUint8(position + 6, (short) ((value >> 48) & 0xFF));
|
||||
dataView.setUint8(position + 7, (short) ((value >> 56) & 0xFF));
|
||||
dataView.setUint32(position, (int) (value & 0xFFFFFFFFl), true);
|
||||
dataView.setUint8(position + 4, (short) ((value >>> 32l) & 0xFFl));
|
||||
dataView.setUint8(position + 5, (short) ((value >>> 40l) & 0xFFl));
|
||||
dataView.setUint8(position + 6, (short) ((value >>> 48l) & 0xFFl));
|
||||
dataView.setUint8(position + 7, (short) ((value >>> 56l) & 0xFFl));
|
||||
position += 8;
|
||||
return this;
|
||||
}
|
||||
|
@ -368,11 +368,11 @@ public class EaglerArrayByteBuffer implements ByteBuffer {
|
|||
@Override
|
||||
public ByteBuffer putLong(int index, long value) {
|
||||
if(index + 8 > limit) throw new ArrayIndexOutOfBoundsException(index);
|
||||
dataView.setUint32(index, (int) (value & 0xFFFFFFFF), true);
|
||||
dataView.setUint8(index + 4, (short) ((value >> 32) & 0xFF));
|
||||
dataView.setUint8(index + 5, (short) ((value >> 40) & 0xFF));
|
||||
dataView.setUint8(index + 6, (short) ((value >> 48) & 0xFF));
|
||||
dataView.setUint8(index + 7, (short) ((value >> 56) & 0xFF));
|
||||
dataView.setUint32(index, (int) (value & 0xFFFFFFFFl), true);
|
||||
dataView.setUint8(index + 4, (short) ((value >>> 32l) & 0xFFl));
|
||||
dataView.setUint8(index + 5, (short) ((value >>> 40l) & 0xFFl));
|
||||
dataView.setUint8(index + 6, (short) ((value >>> 48l) & 0xFFl));
|
||||
dataView.setUint8(index + 7, (short) ((value >>> 56l) & 0xFFl));
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -71,15 +71,15 @@ public class DebugConsoleWindow {
|
|||
destroyWindow();
|
||||
}
|
||||
});
|
||||
if ("true".equals(parent.getLocalStorage()
|
||||
.getItem(PlatformRuntime.getClientConfigAdapter().getLocalStorageNamespace() + ".showDebugConsole"))) {
|
||||
if(parent.getLocalStorage() != null && "true".equals(parent.getLocalStorage().getItem(PlatformRuntime.getClientConfigAdapter().getLocalStorageNamespace() + ".showDebugConsole"))) {
|
||||
showDebugConsole0();
|
||||
}
|
||||
}
|
||||
|
||||
public static void showDebugConsole() {
|
||||
parent.getLocalStorage().setItem(
|
||||
PlatformRuntime.getClientConfigAdapter().getLocalStorageNamespace() + ".showDebugConsole", "true");
|
||||
if(parent.getLocalStorage() != null) {
|
||||
parent.getLocalStorage().setItem(PlatformRuntime.getClientConfigAdapter().getLocalStorageNamespace() + ".showDebugConsole", "true");
|
||||
}
|
||||
showDebugConsole0();
|
||||
}
|
||||
|
||||
|
@ -120,7 +120,9 @@ public class DebugConsoleWindow {
|
|||
public void handleEvent(Event evt) {
|
||||
if (logger != null) {
|
||||
logger = null;
|
||||
parent.getLocalStorage().setItem("_eaglercraftX.showDebugConsole", "false");
|
||||
if(parent.getLocalStorage() != null) {
|
||||
parent.getLocalStorage().setItem(PlatformRuntime.getClientConfigAdapter().getLocalStorageNamespace() + ".showDebugConsole", "false");
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -68,6 +68,7 @@ public class TeaVMClientConfigAdapter implements IClientConfigAdapter {
|
|||
private String localStorageNamespace = "_eaglercraftX";
|
||||
private final TeaVMClientConfigAdapterHooks hooks = new TeaVMClientConfigAdapterHooks();
|
||||
private boolean enableMinceraft = true;
|
||||
private boolean crashOnUncaughtExceptions = false;
|
||||
|
||||
public void loadNative(JSObject jsObject) {
|
||||
integratedServerOpts = new JSONObject();
|
||||
|
@ -93,6 +94,7 @@ public class TeaVMClientConfigAdapter implements IClientConfigAdapter {
|
|||
allowFNAWSkins = !demoMode && eaglercraftXOpts.getAllowFNAWSkins(true);
|
||||
localStorageNamespace = eaglercraftXOpts.getLocalStorageNamespace(EaglercraftVersion.localStorageNamespace);
|
||||
enableMinceraft = eaglercraftXOpts.getEnableMinceraft(true);
|
||||
crashOnUncaughtExceptions = eaglercraftXOpts.getCrashOnUncaughtExceptions(false);
|
||||
JSEaglercraftXOptsHooks hooksObj = eaglercraftXOpts.getHooks();
|
||||
if (hooksObj != null) {
|
||||
hooks.loadHooks(hooksObj);
|
||||
|
@ -105,7 +107,8 @@ public class TeaVMClientConfigAdapter implements IClientConfigAdapter {
|
|||
integratedServerOpts.put("allowUpdateDL", isAllowUpdateDL);
|
||||
integratedServerOpts.put("allowVoiceClient", allowVoiceClient);
|
||||
integratedServerOpts.put("allowFNAWSkins", allowFNAWSkins);
|
||||
|
||||
integratedServerOpts.put("crashOnUncaughtExceptions", crashOnUncaughtExceptions);
|
||||
|
||||
JSArrayReader<JSEaglercraftXOptsServer> serversArray = eaglercraftXOpts.getServers();
|
||||
if (serversArray != null) {
|
||||
for (int i = 0, l = serversArray.getLength(); i < l; ++i) {
|
||||
|
@ -194,6 +197,7 @@ public class TeaVMClientConfigAdapter implements IClientConfigAdapter {
|
|||
localStorageNamespace = eaglercraftOpts.optString("localStorageNamespace",
|
||||
EaglercraftVersion.localStorageNamespace);
|
||||
enableMinceraft = eaglercraftOpts.optBoolean("enableMinceraft", true);
|
||||
crashOnUncaughtExceptions = eaglercraftOpts.optBoolean("crashOnUncaughtExceptions", false);
|
||||
JSONArray serversArray = eaglercraftOpts.optJSONArray("servers");
|
||||
if (serversArray != null) {
|
||||
for (int i = 0, l = serversArray.length(); i < l; ++i) {
|
||||
|
@ -384,6 +388,7 @@ public class TeaVMClientConfigAdapter implements IClientConfigAdapter {
|
|||
jsonObject.put("allowFNAWSkins", allowFNAWSkins);
|
||||
jsonObject.put("localStorageNamespace", localStorageNamespace);
|
||||
jsonObject.put("enableMinceraft", enableMinceraft);
|
||||
jsonObject.put("crashOnUncaughtExceptions", crashOnUncaughtExceptions);
|
||||
JSONArray serversArr = new JSONArray();
|
||||
for (int i = 0, l = defaultServers.size(); i < l; ++i) {
|
||||
DefaultServer srv = defaultServers.get(i);
|
||||
|
|
|
@ -1,108 +1,146 @@
|
|||
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();
|
||||
}
|
||||
}
|
||||
package net.lax1dude.eaglercraft.v1_8.internal.teavm;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
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;
|
||||
private CrashReportHook crashHook = 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;
|
||||
}
|
||||
}
|
||||
|
||||
@JSFunctor
|
||||
private static interface CrashReportHook extends JSObject {
|
||||
void call(String crashReport, CustomMessageCB customMessageCB);
|
||||
}
|
||||
|
||||
@JSFunctor
|
||||
private static interface CustomMessageCB extends JSObject {
|
||||
void call(String msg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void callCrashReportHook(String crashReport, Consumer<String> customMessageCB) {
|
||||
if(crashHook != null) {
|
||||
callHookSafeSync("crashReportShow", () -> {
|
||||
crashHook.call(crashReport, (msg) -> customMessageCB.accept(msg));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
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 void callHookSafeSync(String identifer, Runnable hooker);
|
||||
|
||||
private static void callHookSafeSync(String identifer, Runnable hooker, final AsyncCallback<Void> cb) {
|
||||
Window.setTimeout(() -> {
|
||||
try {
|
||||
hooker.run();
|
||||
}catch(Throwable t) {
|
||||
logger.error("Caught exception while invoking eaglercraftXOpts \"{}\" hook!", identifer);
|
||||
logger.error(t);
|
||||
}finally {
|
||||
cb.complete(null);
|
||||
}
|
||||
}, 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();
|
||||
crashHook = (CrashReportHook)hooks.getCrashReportHook();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,4 +33,7 @@ public abstract class JSEaglercraftXOptsHooks implements JSObject {
|
|||
@JSBody(script = "return (typeof this.localStorageLoaded === \"function\") ? this.localStorageLoaded : null;")
|
||||
public native JSObject getLocalStorageLoadedHook();
|
||||
|
||||
@JSBody(script = "return (typeof this.crashReportShow === \"function\") ? this.crashReportShow : null;")
|
||||
public native JSObject getCrashReportHook();
|
||||
|
||||
}
|
||||
|
|
|
@ -117,4 +117,7 @@ public abstract class JSEaglercraftXOptsRoot implements JSObject {
|
|||
"def" }, script = "return (typeof this.enableMinceraft === \"boolean\") ? this.enableMinceraft : def;")
|
||||
public native boolean getEnableMinceraft(boolean defaultValue);
|
||||
|
||||
@JSBody(params = { "def" }, script = "return (typeof this.crashOnUncaughtExceptions === \"boolean\") ? this.crashOnUncaughtExceptions : def;")
|
||||
public native boolean getCrashOnUncaughtExceptions(boolean defaultValue);
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue