u35
This commit is contained in:
parent
16648bc6c8
commit
0bb03a581b
|
@ -170,7 +170,7 @@ void main() {
|
||||||
|
|
||||||
#ifdef COMPILE_ENABLE_FOG
|
#ifdef COMPILE_ENABLE_FOG
|
||||||
vec3 fogPos = v_position4f.xyz / v_position4f.w;
|
vec3 fogPos = v_position4f.xyz / v_position4f.w;
|
||||||
float dist = sqrt(dot(fogPos, fogPos));
|
float dist = length(fogPos);
|
||||||
float fogDensity = u_fogParameters4f.y;
|
float fogDensity = u_fogParameters4f.y;
|
||||||
float fogStart = u_fogParameters4f.z;
|
float fogStart = u_fogParameters4f.z;
|
||||||
float fogEnd = u_fogParameters4f.w;
|
float fogEnd = u_fogParameters4f.w;
|
||||||
|
|
|
@ -69,7 +69,7 @@ void main() {
|
||||||
fragPos4f.xyz /= fragPos4f.w;
|
fragPos4f.xyz /= fragPos4f.w;
|
||||||
fragPos4f.w = 1.0;
|
fragPos4f.w = 1.0;
|
||||||
|
|
||||||
float l = sqrt(dot(fragPos4f.xyz, fragPos4f.xyz));
|
float l = length(fragPos4f.xyz);
|
||||||
#ifdef COMPILE_FOG_LINEAR
|
#ifdef COMPILE_FOG_LINEAR
|
||||||
float f = (l - u_linearFogParam2f.x) / (u_linearFogParam2f.y - u_linearFogParam2f.x);
|
float f = (l - u_linearFogParam2f.x) / (u_linearFogParam2f.y - u_linearFogParam2f.x);
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -431,7 +431,7 @@ void main() {
|
||||||
float type = u_fogParameters4f.x - atmos;
|
float type = u_fogParameters4f.x - atmos;
|
||||||
fogBlend4f = mix(u_fogColorLight4f, u_fogColorDark4f, lightmapCoords2f.g);
|
fogBlend4f = mix(u_fogColorLight4f, u_fogColorDark4f, lightmapCoords2f.g);
|
||||||
|
|
||||||
float l = sqrt(dot(v_position4f.xyz, v_position4f.xyz));
|
float l = length(v_position4f.xyz);
|
||||||
if(type == 1.0) {
|
if(type == 1.0) {
|
||||||
f = (l - u_fogParameters4f.z) / (u_fogParameters4f.w - u_fogParameters4f.z);
|
f = (l - u_fogParameters4f.z) / (u_fogParameters4f.w - u_fogParameters4f.z);
|
||||||
}else {
|
}else {
|
||||||
|
|
|
@ -292,7 +292,7 @@ void main() {
|
||||||
fogFade = mix(u_fogColorDark4f.a, u_fogColorLight4f.a, lightmapCoords2f.g);
|
fogFade = mix(u_fogColorDark4f.a, u_fogColorLight4f.a, lightmapCoords2f.g);
|
||||||
|
|
||||||
float f;
|
float f;
|
||||||
float l = sqrt(dot(v_position4f.xyz, v_position4f.xyz));
|
float l = length(v_position4f.xyz);
|
||||||
if(type == 1.0) {
|
if(type == 1.0) {
|
||||||
f = (l - u_fogParameters4f.z) / (u_fogParameters4f.w - u_fogParameters4f.z);
|
f = (l - u_fogParameters4f.z) / (u_fogParameters4f.w - u_fogParameters4f.z);
|
||||||
}else {
|
}else {
|
||||||
|
|
|
@ -397,7 +397,7 @@ void main() {
|
||||||
float type = u_fogParameters4f.x - atmos;
|
float type = u_fogParameters4f.x - atmos;
|
||||||
fogBlend4f = mix(u_fogColorLight4f, u_fogColorDark4f, lightmapCoords2f.g);
|
fogBlend4f = mix(u_fogColorLight4f, u_fogColorDark4f, lightmapCoords2f.g);
|
||||||
|
|
||||||
float f, l = sqrt(dot(v_position4f.xyz, v_position4f.xyz));
|
float f, l = length(v_position4f.xyz);
|
||||||
if(type == 1.0) {
|
if(type == 1.0) {
|
||||||
f = (l - u_fogParameters4f.z) / (u_fogParameters4f.w - u_fogParameters4f.z);
|
f = (l - u_fogParameters4f.z) / (u_fogParameters4f.w - u_fogParameters4f.z);
|
||||||
}else {
|
}else {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "§eHigh Performance PBR",
|
"name": "§eHigh Performance PBR",
|
||||||
"desc": "Pack made from scratch specifically for this client, designed to give what I call the best balance between quality and performance possible in a browser but obviously that's just my opinion",
|
"desc": "Pack made from scratch specifically for this client, designed to give what I call the best balance between quality and performance possible in a browser but obviously that's just my opinion",
|
||||||
"vers": "1.2.0",
|
"vers": "1.2.1",
|
||||||
"author": "lax1dude",
|
"author": "lax1dude",
|
||||||
"api_vers": 1,
|
"api_vers": 1,
|
||||||
"features": [
|
"features": [
|
||||||
|
|
|
@ -48,7 +48,9 @@ void main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
vec4 light;
|
vec4 light;
|
||||||
|
float blockLight = v_lightmap2f.x;
|
||||||
float diffuse = 0.0;
|
float diffuse = 0.0;
|
||||||
|
float len;
|
||||||
if(u_dynamicLightCount1i > 0) {
|
if(u_dynamicLightCount1i > 0) {
|
||||||
vec4 worldPosition4f = u_inverseViewMatrix4f * v_position4f;
|
vec4 worldPosition4f = u_inverseViewMatrix4f * v_position4f;
|
||||||
worldPosition4f.xyz /= worldPosition4f.w;
|
worldPosition4f.xyz /= worldPosition4f.w;
|
||||||
|
@ -57,11 +59,13 @@ void main() {
|
||||||
for(int i = 0; i < safeLightCount; ++i) {
|
for(int i = 0; i < safeLightCount; ++i) {
|
||||||
light = u_dynamicLightArray[i];
|
light = u_dynamicLightArray[i];
|
||||||
light.xyz = light.xyz - worldPosition4f.xyz;
|
light.xyz = light.xyz - worldPosition4f.xyz;
|
||||||
diffuse += max(dot(normalize(light.xyz), normalVector3f) * 0.8 + 0.2, 0.0) * max(light.w - sqrt(dot(light.xyz, light.xyz)), 0.0);
|
len = length(light.xyz);
|
||||||
|
diffuse += max(dot(light.xyz / len, normalVector3f) * 0.8 + 0.2, 0.0) * max(light.w - len, 0.0);
|
||||||
}
|
}
|
||||||
|
blockLight = min(blockLight + diffuse * 0.066667, 1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
color *= texture(u_lightmapTexture, vec2(min(v_lightmap2f.x + diffuse * 0.066667, 1.0), v_lightmap2f.y));
|
color *= texture(u_lightmapTexture, vec2(blockLight, v_lightmap2f.y));
|
||||||
|
|
||||||
output4f = color;
|
output4f = color;
|
||||||
}
|
}
|
||||||
|
|
|
@ -152,6 +152,12 @@ void main() {
|
||||||
|
|
||||||
#ifdef COMPILE_ENABLE_LIGHTMAP
|
#ifdef COMPILE_ENABLE_LIGHTMAP
|
||||||
float diffuse = 0.0;
|
float diffuse = 0.0;
|
||||||
|
#ifdef COMPILE_LIGHTMAP_ATTRIB
|
||||||
|
float blockLight = v_lightmap2f.x;
|
||||||
|
#else
|
||||||
|
float blockLight = u_textureCoords02.x;
|
||||||
|
#endif
|
||||||
|
float len;
|
||||||
vec4 light;
|
vec4 light;
|
||||||
if(u_dynamicLightCount1i > 0) {
|
if(u_dynamicLightCount1i > 0) {
|
||||||
vec4 worldPosition4f = u_inverseViewMatrix4f * v_position4f;
|
vec4 worldPosition4f = u_inverseViewMatrix4f * v_position4f;
|
||||||
|
@ -161,13 +167,15 @@ void main() {
|
||||||
for(int i = 0; i < safeLightCount; ++i) {
|
for(int i = 0; i < safeLightCount; ++i) {
|
||||||
light = u_dynamicLightArray[i];
|
light = u_dynamicLightArray[i];
|
||||||
light.xyz = light.xyz - worldPosition4f.xyz;
|
light.xyz = light.xyz - worldPosition4f.xyz;
|
||||||
diffuse += max(dot(normalize(light.xyz), normalVector3f) * 0.8 + 0.2, 0.0) * max(light.w - sqrt(dot(light.xyz, light.xyz)), 0.0);
|
len = length(light.xyz);
|
||||||
|
diffuse += max(dot(light.xyz / len, normalVector3f) * 0.8 + 0.2, 0.0) * max(light.w - len, 0.0);
|
||||||
}
|
}
|
||||||
|
blockLight = min(blockLight + diffuse * 0.066667, 1.0);
|
||||||
}
|
}
|
||||||
#ifdef COMPILE_LIGHTMAP_ATTRIB
|
#ifdef COMPILE_LIGHTMAP_ATTRIB
|
||||||
color *= texture(u_samplerLightmap, vec2(min(v_lightmap2f.x + diffuse * 0.066667, 1.0), v_lightmap2f.y));
|
color *= texture(u_samplerLightmap, vec2(blockLight, v_lightmap2f.y));
|
||||||
#else
|
#else
|
||||||
color *= texture(u_samplerLightmap, vec2(min(u_textureCoords02.x + diffuse * 0.066667, 1.0), u_textureCoords02.y));
|
color *= texture(u_samplerLightmap, vec2(blockLight, u_textureCoords02.y));
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
# Change to 0 to disable blur
|
||||||
|
enable_blur=1
|
Binary file not shown.
|
@ -1 +1 @@
|
||||||
{"pluginName":"EaglercraftXBungee","pluginVersion":"1.2.5","pluginButton":"Download \"EaglerXBungee-1.2.5.jar\"","pluginFilename":"EaglerXBungee.zip"}
|
{"pluginName":"EaglercraftXBungee","pluginVersion":"1.2.6","pluginButton":"Download \"EaglerXBungee-1.2.6.jar\"","pluginFilename":"EaglerXBungee.zip"}
|
|
@ -142,6 +142,11 @@ public class DesktopClientConfigAdapter implements IClientConfigAdapter {
|
||||||
return EaglercraftVersion.localStorageNamespace;
|
return EaglercraftVersion.localStorageNamespace;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isEnableMinceraft() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IClientConfigAdapterHooks getHooks() {
|
public IClientConfigAdapterHooks getHooks() {
|
||||||
return hooks;
|
return hooks;
|
||||||
|
|
|
@ -121,6 +121,7 @@ public class EaglerInputStream extends InputStream {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static byte[] inputStreamToBytes(InputStream is) throws IOException {
|
public static byte[] inputStreamToBytes(InputStream is) throws IOException {
|
||||||
|
try {
|
||||||
if (is instanceof EaglerInputStream) {
|
if (is instanceof EaglerInputStream) {
|
||||||
return ((EaglerInputStream) is).getAsArray();
|
return ((EaglerInputStream) is).getAsArray();
|
||||||
} else if (is instanceof ByteArrayInputStream) {
|
} else if (is instanceof ByteArrayInputStream) {
|
||||||
|
@ -136,6 +137,9 @@ public class EaglerInputStream extends InputStream {
|
||||||
}
|
}
|
||||||
return os.toByteArray();
|
return os.toByteArray();
|
||||||
}
|
}
|
||||||
|
}finally {
|
||||||
|
is.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] getAsArray() {
|
public byte[] getAsArray() {
|
||||||
|
|
|
@ -10,7 +10,7 @@ public class EaglercraftVersion {
|
||||||
/// Customize these to fit your fork:
|
/// Customize these to fit your fork:
|
||||||
|
|
||||||
public static final String projectForkName = "EaglercraftX";
|
public static final String projectForkName = "EaglercraftX";
|
||||||
public static final String projectForkVersion = "u34";
|
public static final String projectForkVersion = "u35";
|
||||||
public static final String projectForkVendor = "lax1dude";
|
public static final String projectForkVendor = "lax1dude";
|
||||||
|
|
||||||
public static final String projectForkURL = "https://gitlab.com/lax1dude/eaglercraftx-1.8";
|
public static final String projectForkURL = "https://gitlab.com/lax1dude/eaglercraftx-1.8";
|
||||||
|
@ -20,7 +20,7 @@ public class EaglercraftVersion {
|
||||||
public static final String projectOriginName = "EaglercraftX";
|
public static final String projectOriginName = "EaglercraftX";
|
||||||
public static final String projectOriginAuthor = "lax1dude";
|
public static final String projectOriginAuthor = "lax1dude";
|
||||||
public static final String projectOriginRevision = "1.8";
|
public static final String projectOriginRevision = "1.8";
|
||||||
public static final String projectOriginVersion = "u34";
|
public static final String projectOriginVersion = "u35";
|
||||||
|
|
||||||
public static final String projectOriginURL = "https://gitlab.com/lax1dude/eaglercraftx-1.8"; // rest in peace
|
public static final String projectOriginURL = "https://gitlab.com/lax1dude/eaglercraftx-1.8"; // rest in peace
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ public class EaglercraftVersion {
|
||||||
public static final boolean enableUpdateService = true;
|
public static final boolean enableUpdateService = true;
|
||||||
|
|
||||||
public static final String updateBundlePackageName = "net.lax1dude.eaglercraft.v1_8.client";
|
public static final String updateBundlePackageName = "net.lax1dude.eaglercraft.v1_8.client";
|
||||||
public static final int updateBundlePackageVersionInt = 34;
|
public static final int updateBundlePackageVersionInt = 35;
|
||||||
|
|
||||||
public static final String updateLatestLocalStorageKey = "latestUpdate_" + updateBundlePackageName;
|
public static final String updateLatestLocalStorageKey = "latestUpdate_" + updateBundlePackageName;
|
||||||
|
|
||||||
|
|
|
@ -74,6 +74,8 @@ public interface IClientConfigAdapter {
|
||||||
|
|
||||||
String getLocalStorageNamespace();
|
String getLocalStorageNamespace();
|
||||||
|
|
||||||
|
boolean isEnableMinceraft();
|
||||||
|
|
||||||
IClientConfigAdapterHooks getHooks();
|
IClientConfigAdapterHooks getHooks();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,7 +66,6 @@ import static net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.ExtGLEnums.*;
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
|
@ -3,6 +3,7 @@ package net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.texture;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
|
||||||
|
import net.lax1dude.eaglercraft.v1_8.IOUtils;
|
||||||
import net.lax1dude.eaglercraft.v1_8.opengl.ImageData;
|
import net.lax1dude.eaglercraft.v1_8.opengl.ImageData;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -75,4 +76,15 @@ public class EaglerBitwisePackedTexture {
|
||||||
return img;
|
return img;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static ImageData loadTextureSafe(InputStream is, int alpha) throws IOException {
|
||||||
|
ImageData bufferedimage;
|
||||||
|
try {
|
||||||
|
bufferedimage = loadTexture(is, alpha);
|
||||||
|
} finally {
|
||||||
|
IOUtils.closeQuietly(is);
|
||||||
|
}
|
||||||
|
|
||||||
|
return bufferedimage;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,7 +73,7 @@ public class PBRTextureMapUtils {
|
||||||
}catch(Throwable t) {
|
}catch(Throwable t) {
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
return EaglerBitwisePackedTexture.loadTexture(resMgr.getResource(new ResourceLocation("eagler:glsl/deferred/assets_pbr/" + fname + ".ebp")).getInputStream(), 255);
|
return EaglerBitwisePackedTexture.loadTextureSafe(resMgr.getResource(new ResourceLocation("eagler:glsl/deferred/assets_pbr/" + fname + ".ebp")).getInputStream(), 255);
|
||||||
}catch(Throwable t) {
|
}catch(Throwable t) {
|
||||||
// dead code because teavm
|
// dead code because teavm
|
||||||
t.toString();
|
t.toString();
|
||||||
|
|
|
@ -4,7 +4,6 @@ import static net.lax1dude.eaglercraft.v1_8.internal.PlatformOpenGL.*;
|
||||||
import static net.lax1dude.eaglercraft.v1_8.opengl.RealOpenGLEnums.*;
|
import static net.lax1dude.eaglercraft.v1_8.opengl.RealOpenGLEnums.*;
|
||||||
import static net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.ExtGLEnums.*;
|
import static net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.ExtGLEnums.*;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
|
@ -17,30 +17,21 @@ package net.lax1dude.eaglercraft.v1_8.opengl.ext.dynamiclights;
|
||||||
*/
|
*/
|
||||||
class DynamicLightInstance {
|
class DynamicLightInstance {
|
||||||
|
|
||||||
public final String lightName;
|
|
||||||
long lastCacheHit = 0l;
|
|
||||||
|
|
||||||
double posX;
|
double posX;
|
||||||
double posY;
|
double posY;
|
||||||
double posZ;
|
double posZ;
|
||||||
float radius;
|
float radius;
|
||||||
|
|
||||||
public DynamicLightInstance(String lightName) {
|
public DynamicLightInstance() {
|
||||||
this.lightName = lightName;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateLight(double posX, double posY, double posZ, float radius) {
|
public void updateLight(double posX, double posY, double posZ, float radius) {
|
||||||
this.lastCacheHit = System.currentTimeMillis();
|
|
||||||
this.posX = posX;
|
this.posX = posX;
|
||||||
this.posY = posY;
|
this.posY = posY;
|
||||||
this.posZ = posZ;
|
this.posZ = posZ;
|
||||||
this.radius = radius;
|
this.radius = radius;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void destroy() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public float getRadiusInWorld() {
|
public float getRadiusInWorld() {
|
||||||
return radius;
|
return radius;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,6 @@ import net.lax1dude.eaglercraft.v1_8.opengl.FixedFunctionShader.FixedFunctionSta
|
||||||
import net.lax1dude.eaglercraft.v1_8.opengl.IExtPipelineCompiler;
|
import net.lax1dude.eaglercraft.v1_8.opengl.IExtPipelineCompiler;
|
||||||
import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.program.ShaderSource;
|
import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.program.ShaderSource;
|
||||||
import net.lax1dude.eaglercraft.v1_8.opengl.ext.dynamiclights.program.DynamicLightsExtPipelineShader;
|
import net.lax1dude.eaglercraft.v1_8.opengl.ext.dynamiclights.program.DynamicLightsExtPipelineShader;
|
||||||
import net.lax1dude.eaglercraft.v1_8.vector.Matrix4f;
|
|
||||||
import net.minecraft.client.renderer.GLAllocation;
|
import net.minecraft.client.renderer.GLAllocation;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
package net.lax1dude.eaglercraft.v1_8.opengl.ext.dynamiclights;
|
package net.lax1dude.eaglercraft.v1_8.opengl.ext.dynamiclights;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.ArrayList;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import net.lax1dude.eaglercraft.v1_8.opengl.FixedFunctionPipeline;
|
import net.lax1dude.eaglercraft.v1_8.opengl.FixedFunctionPipeline;
|
||||||
import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
|
import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
|
||||||
|
@ -31,14 +30,15 @@ import net.minecraft.util.MathHelper;
|
||||||
public class DynamicLightsStateManager {
|
public class DynamicLightsStateManager {
|
||||||
|
|
||||||
static final DynamicLightsPipelineCompiler deferredExtPipeline = new DynamicLightsPipelineCompiler();
|
static final DynamicLightsPipelineCompiler deferredExtPipeline = new DynamicLightsPipelineCompiler();
|
||||||
static final Map<String, DynamicLightInstance> lightRenderers = new HashMap();
|
private static List<DynamicLightInstance> lightInstancePool = new ArrayList();
|
||||||
|
private static int instancePoolIndex = 0;
|
||||||
|
private static int maxListLengthTracker = 0;
|
||||||
static final List<DynamicLightInstance> lightRenderList = new LinkedList();
|
static final List<DynamicLightInstance> lightRenderList = new LinkedList();
|
||||||
static final Matrix4f inverseViewMatrix = new Matrix4f();
|
static final Matrix4f inverseViewMatrix = new Matrix4f();
|
||||||
static int inverseViewMatrixSerial = 0;
|
static int inverseViewMatrixSerial = 0;
|
||||||
static DynamicLightBucketLoader bucketLoader = null;
|
static DynamicLightBucketLoader bucketLoader = null;
|
||||||
static DynamicLightsAcceleratedEffectRenderer accelParticleRenderer = null;
|
static DynamicLightsAcceleratedEffectRenderer accelParticleRenderer = null;
|
||||||
static int lastTotal = 0;
|
static int lastTotal = 0;
|
||||||
static long renderTimeout = 5000l;
|
|
||||||
private static long lastTick = 0l;
|
private static long lastTick = 0l;
|
||||||
|
|
||||||
public static final void enableDynamicLightsRender() {
|
public static final void enableDynamicLightsRender() {
|
||||||
|
@ -52,6 +52,9 @@ public class DynamicLightsStateManager {
|
||||||
accelParticleRenderer = new DynamicLightsAcceleratedEffectRenderer();
|
accelParticleRenderer = new DynamicLightsAcceleratedEffectRenderer();
|
||||||
accelParticleRenderer.initialize();
|
accelParticleRenderer.initialize();
|
||||||
}
|
}
|
||||||
|
lightRenderList.clear();
|
||||||
|
instancePoolIndex = 0;
|
||||||
|
maxListLengthTracker = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final void bindAcceleratedEffectRenderer(EffectRenderer renderer) {
|
public static final void bindAcceleratedEffectRenderer(EffectRenderer renderer) {
|
||||||
|
@ -72,6 +75,8 @@ public class DynamicLightsStateManager {
|
||||||
}
|
}
|
||||||
destroyAll();
|
destroyAll();
|
||||||
lightRenderList.clear();
|
lightRenderList.clear();
|
||||||
|
instancePoolIndex = 0;
|
||||||
|
maxListLengthTracker = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final boolean isDynamicLightsRender() {
|
public static final boolean isDynamicLightsRender() {
|
||||||
|
@ -99,21 +104,27 @@ public class DynamicLightsStateManager {
|
||||||
|
|
||||||
public static final void renderDynamicLight(String lightName, double posX, double posY, double posZ, float radius) {
|
public static final void renderDynamicLight(String lightName, double posX, double posY, double posZ, float radius) {
|
||||||
if(bucketLoader != null) {
|
if(bucketLoader != null) {
|
||||||
DynamicLightInstance dl = lightRenderers.get(lightName);
|
DynamicLightInstance dl;
|
||||||
if(dl == null) {
|
if(instancePoolIndex < lightInstancePool.size()) {
|
||||||
lightRenderers.put(lightName, dl = new DynamicLightInstance(lightName));
|
dl = lightInstancePool.get(instancePoolIndex);
|
||||||
|
}else {
|
||||||
|
lightInstancePool.add(dl = new DynamicLightInstance());
|
||||||
}
|
}
|
||||||
|
++instancePoolIndex;
|
||||||
dl.updateLight(posX, posY, posZ, radius);
|
dl.updateLight(posX, posY, posZ, radius);
|
||||||
lightRenderList.add(dl);
|
lightRenderList.add(dl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final void clearRenderList() {
|
public static final void clearRenderList() {
|
||||||
|
if(instancePoolIndex > maxListLengthTracker) {
|
||||||
|
maxListLengthTracker = instancePoolIndex;
|
||||||
|
}
|
||||||
lightRenderList.clear();
|
lightRenderList.clear();
|
||||||
|
instancePoolIndex = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final void commitLightSourceBuckets(double renderPosX, double renderPosY, double renderPosZ) {
|
public static final void commitLightSourceBuckets(double renderPosX, double renderPosY, double renderPosZ) {
|
||||||
updateTimers();
|
|
||||||
lastTotal = lightRenderList.size();
|
lastTotal = lightRenderList.size();
|
||||||
if(bucketLoader != null) {
|
if(bucketLoader != null) {
|
||||||
bucketLoader.clearBuckets();
|
bucketLoader.clearBuckets();
|
||||||
|
@ -131,7 +142,8 @@ public class DynamicLightsStateManager {
|
||||||
bucketLoader.setRenderPos(renderPosX, renderPosY, renderPosZ);
|
bucketLoader.setRenderPos(renderPosX, renderPosY, renderPosZ);
|
||||||
bucketLoader.truncateOverflowingBuffers();
|
bucketLoader.truncateOverflowingBuffers();
|
||||||
}
|
}
|
||||||
lightRenderList.clear();
|
updateTimers();
|
||||||
|
clearRenderList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final void setupInverseViewMatrix() {
|
public static final void setupInverseViewMatrix() {
|
||||||
|
@ -141,25 +153,21 @@ public class DynamicLightsStateManager {
|
||||||
|
|
||||||
private static final void updateTimers() {
|
private static final void updateTimers() {
|
||||||
long millis = System.currentTimeMillis();
|
long millis = System.currentTimeMillis();
|
||||||
if(millis - lastTick > 1000l) {
|
if(millis - lastTick > 5000l) {
|
||||||
lastTick = millis;
|
lastTick = millis;
|
||||||
Iterator<DynamicLightInstance> itr = lightRenderers.values().iterator();
|
if(maxListLengthTracker < (lightInstancePool.size() >> 1)) {
|
||||||
while(itr.hasNext()) {
|
List<DynamicLightInstance> newPool = new ArrayList(Math.max(maxListLengthTracker, 16));
|
||||||
DynamicLightInstance dl = itr.next();
|
for(int i = 0; i < maxListLengthTracker; ++i) {
|
||||||
if(millis - dl.lastCacheHit > renderTimeout) {
|
newPool.add(lightInstancePool.get(i));
|
||||||
dl.destroy();
|
|
||||||
itr.remove();
|
|
||||||
}
|
}
|
||||||
|
lightInstancePool = newPool;
|
||||||
}
|
}
|
||||||
|
maxListLengthTracker = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final void destroyAll() {
|
public static final void destroyAll() {
|
||||||
Iterator<DynamicLightInstance> itr = lightRenderers.values().iterator();
|
lightInstancePool = new ArrayList();
|
||||||
while(itr.hasNext()) {
|
|
||||||
itr.next().destroy();
|
|
||||||
}
|
|
||||||
lightRenderers.clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getF3String() {
|
public static String getF3String() {
|
||||||
|
|
|
@ -1,11 +1,7 @@
|
||||||
package net.lax1dude.eaglercraft.v1_8.opengl.ext.dynamiclights.program;
|
package net.lax1dude.eaglercraft.v1_8.opengl.ext.dynamiclights.program;
|
||||||
|
|
||||||
import static net.lax1dude.eaglercraft.v1_8.internal.PlatformOpenGL.*;
|
import static net.lax1dude.eaglercraft.v1_8.internal.PlatformOpenGL.*;
|
||||||
import static net.lax1dude.eaglercraft.v1_8.opengl.RealOpenGLEnums.GL_FRAGMENT_SHADER;
|
import static net.lax1dude.eaglercraft.v1_8.opengl.RealOpenGLEnums.*;
|
||||||
import static net.lax1dude.eaglercraft.v1_8.opengl.RealOpenGLEnums.GL_VERTEX_SHADER;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import net.lax1dude.eaglercraft.v1_8.internal.IProgramGL;
|
import net.lax1dude.eaglercraft.v1_8.internal.IProgramGL;
|
||||||
import net.lax1dude.eaglercraft.v1_8.internal.IShaderGL;
|
import net.lax1dude.eaglercraft.v1_8.internal.IShaderGL;
|
||||||
|
|
|
@ -586,6 +586,7 @@ public class Minecraft implements IThreadListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
ShaderSource.clearCache();
|
ShaderSource.clearCache();
|
||||||
|
GuiMainMenu.doResourceReloadHack();
|
||||||
|
|
||||||
this.mcLanguageManager.parseLanguageMetadata(arraylist);
|
this.mcLanguageManager.parseLanguageMetadata(arraylist);
|
||||||
if (this.renderGlobal != null) {
|
if (this.renderGlobal != null) {
|
||||||
|
|
|
@ -5,12 +5,14 @@ import static net.lax1dude.eaglercraft.v1_8.opengl.RealOpenGLEnums.*;
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
import net.lax1dude.eaglercraft.v1_8.EagRuntime;
|
import net.lax1dude.eaglercraft.v1_8.EagRuntime;
|
||||||
|
import net.lax1dude.eaglercraft.v1_8.EagUtils;
|
||||||
import net.lax1dude.eaglercraft.v1_8.EaglerInputStream;
|
import net.lax1dude.eaglercraft.v1_8.EaglerInputStream;
|
||||||
import net.lax1dude.eaglercraft.v1_8.EaglercraftRandom;
|
import net.lax1dude.eaglercraft.v1_8.EaglercraftRandom;
|
||||||
import net.lax1dude.eaglercraft.v1_8.EaglercraftVersion;
|
import net.lax1dude.eaglercraft.v1_8.EaglercraftVersion;
|
||||||
|
@ -19,7 +21,6 @@ import net.lax1dude.eaglercraft.v1_8.Mouse;
|
||||||
import com.google.common.base.Charsets;
|
import com.google.common.base.Charsets;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
import net.lax1dude.eaglercraft.v1_8.crypto.MD5Digest;
|
|
||||||
import net.lax1dude.eaglercraft.v1_8.crypto.SHA1Digest;
|
import net.lax1dude.eaglercraft.v1_8.crypto.SHA1Digest;
|
||||||
import net.lax1dude.eaglercraft.v1_8.internal.EnumCursorType;
|
import net.lax1dude.eaglercraft.v1_8.internal.EnumCursorType;
|
||||||
import net.lax1dude.eaglercraft.v1_8.log4j.LogManager;
|
import net.lax1dude.eaglercraft.v1_8.log4j.LogManager;
|
||||||
|
@ -72,8 +73,6 @@ public class GuiMainMenu extends GuiScreen implements GuiYesNoCallback {
|
||||||
private float updateCounter;
|
private float updateCounter;
|
||||||
private boolean isDefault;
|
private boolean isDefault;
|
||||||
private static final int lendef = 5987;
|
private static final int lendef = 5987;
|
||||||
private static final byte[] md5def = new byte[] { -61, -53, -36, 27, 24, 27, 103, -31, -58, -116, 113, -60, -67, -8,
|
|
||||||
-77, 30 };
|
|
||||||
private static final byte[] sha1def = new byte[] { -107, 77, 108, 49, 11, -100, -8, -119, -1, -100, -85, -55, 18,
|
private static final byte[] sha1def = new byte[] { -107, 77, 108, 49, 11, -100, -8, -119, -1, -100, -85, -55, 18,
|
||||||
-69, -107, 113, -93, -101, -79, 32 };
|
-69, -107, 113, -93, -101, -79, 32 };
|
||||||
private String splashText;
|
private String splashText;
|
||||||
|
@ -90,6 +89,8 @@ public class GuiMainMenu extends GuiScreen implements GuiYesNoCallback {
|
||||||
private static final ResourceLocation splashTexts = new ResourceLocation("texts/splashes.txt");
|
private static final ResourceLocation splashTexts = new ResourceLocation("texts/splashes.txt");
|
||||||
private static final ResourceLocation minecraftTitleTextures = new ResourceLocation(
|
private static final ResourceLocation minecraftTitleTextures = new ResourceLocation(
|
||||||
"textures/gui/title/minecraft.png");
|
"textures/gui/title/minecraft.png");
|
||||||
|
private static final ResourceLocation minecraftTitleBlurFlag = new ResourceLocation(
|
||||||
|
"textures/gui/title/background/enable_blur.txt");
|
||||||
private static final ResourceLocation eaglerGuiTextures = new ResourceLocation("eagler:gui/eagler_gui.png");
|
private static final ResourceLocation eaglerGuiTextures = new ResourceLocation("eagler:gui/eagler_gui.png");
|
||||||
/**+
|
/**+
|
||||||
* An array of all the paths to the panorama pictures.
|
* An array of all the paths to the panorama pictures.
|
||||||
|
@ -110,8 +111,13 @@ public class GuiMainMenu extends GuiScreen implements GuiYesNoCallback {
|
||||||
private static ResourceLocation backgroundTexture = null;
|
private static ResourceLocation backgroundTexture = null;
|
||||||
private GuiUpdateCheckerOverlay updateCheckerOverlay;
|
private GuiUpdateCheckerOverlay updateCheckerOverlay;
|
||||||
private GuiButton downloadOfflineButton;
|
private GuiButton downloadOfflineButton;
|
||||||
|
private boolean enableBlur = true;
|
||||||
|
private boolean shouldReload = false;
|
||||||
|
|
||||||
|
private static GuiMainMenu instance = null;
|
||||||
|
|
||||||
public GuiMainMenu() {
|
public GuiMainMenu() {
|
||||||
|
instance = this;
|
||||||
this.splashText = "missingno";
|
this.splashText = "missingno";
|
||||||
updateCheckerOverlay = new GuiUpdateCheckerOverlay(false, this);
|
updateCheckerOverlay = new GuiUpdateCheckerOverlay(false, this);
|
||||||
BufferedReader bufferedreader = null;
|
BufferedReader bufferedreader = null;
|
||||||
|
@ -153,23 +159,25 @@ public class GuiMainMenu extends GuiScreen implements GuiYesNoCallback {
|
||||||
|
|
||||||
this.updateCounter = RANDOM.nextFloat();
|
this.updateCounter = RANDOM.nextFloat();
|
||||||
|
|
||||||
|
reloadResourceFlags();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void reloadResourceFlags() {
|
||||||
if (Minecraft.getMinecraft().isDemo()) {
|
if (Minecraft.getMinecraft().isDemo()) {
|
||||||
this.isDefault = false;
|
this.isDefault = false;
|
||||||
} else {
|
} else {
|
||||||
MD5Digest md5 = new MD5Digest();
|
if (!EagRuntime.getConfiguration().isEnableMinceraft()) {
|
||||||
SHA1Digest sha1 = new SHA1Digest();
|
this.isDefault = false;
|
||||||
byte[] md5out = new byte[16];
|
} else {
|
||||||
byte[] sha1out = new byte[20];
|
|
||||||
try {
|
try {
|
||||||
byte[] bytes = EaglerInputStream.inputStreamToBytesQuiet(Minecraft.getMinecraft().getResourceManager()
|
byte[] bytes = EaglerInputStream.inputStreamToBytesQuiet(Minecraft.getMinecraft()
|
||||||
.getResource(minecraftTitleTextures).getInputStream());
|
.getResourceManager().getResource(minecraftTitleTextures).getInputStream());
|
||||||
if (bytes != null) {
|
if (bytes != null && bytes.length == lendef) {
|
||||||
md5.update(bytes, 0, bytes.length);
|
SHA1Digest sha1 = new SHA1Digest();
|
||||||
|
byte[] sha1out = new byte[20];
|
||||||
sha1.update(bytes, 0, bytes.length);
|
sha1.update(bytes, 0, bytes.length);
|
||||||
md5.doFinal(md5out, 0);
|
|
||||||
sha1.doFinal(sha1out, 0);
|
sha1.doFinal(sha1out, 0);
|
||||||
this.isDefault = bytes.length == lendef && Arrays.equals(md5out, md5def)
|
this.isDefault = Arrays.equals(sha1out, sha1def);
|
||||||
&& Arrays.equals(sha1out, sha1def);
|
|
||||||
} else {
|
} else {
|
||||||
this.isDefault = false;
|
this.isDefault = false;
|
||||||
}
|
}
|
||||||
|
@ -179,6 +187,33 @@ public class GuiMainMenu extends GuiScreen implements GuiYesNoCallback {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.enableBlur = true;
|
||||||
|
|
||||||
|
try {
|
||||||
|
byte[] bytes = EaglerInputStream.inputStreamToBytesQuiet(
|
||||||
|
Minecraft.getMinecraft().getResourceManager().getResource(minecraftTitleBlurFlag).getInputStream());
|
||||||
|
if (bytes != null) {
|
||||||
|
String[] blurCfg = EagUtils.linesArray(new String(bytes, StandardCharsets.UTF_8));
|
||||||
|
for (int i = 0; i < blurCfg.length; ++i) {
|
||||||
|
String s = blurCfg[i];
|
||||||
|
if (s.startsWith("enable_blur=")) {
|
||||||
|
s = s.substring(12).trim();
|
||||||
|
this.enableBlur = s.equals("1") || s.equals("true");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void doResourceReloadHack() {
|
||||||
|
if (instance != null) {
|
||||||
|
instance.shouldReload = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**+
|
/**+
|
||||||
* Called from the main game loop to update the screen.
|
* Called from the main game loop to update the screen.
|
||||||
*/
|
*/
|
||||||
|
@ -187,6 +222,10 @@ public class GuiMainMenu extends GuiScreen implements GuiYesNoCallback {
|
||||||
if (downloadOfflineButton != null) {
|
if (downloadOfflineButton != null) {
|
||||||
downloadOfflineButton.enabled = !UpdateService.shouldDisableDownloadButton();
|
downloadOfflineButton.enabled = !UpdateService.shouldDisableDownloadButton();
|
||||||
}
|
}
|
||||||
|
if (shouldReload) {
|
||||||
|
reloadResourceFlags();
|
||||||
|
shouldReload = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**+
|
/**+
|
||||||
|
@ -372,19 +411,25 @@ public class GuiMainMenu extends GuiScreen implements GuiYesNoCallback {
|
||||||
GlStateManager.matrixMode(GL_PROJECTION);
|
GlStateManager.matrixMode(GL_PROJECTION);
|
||||||
GlStateManager.pushMatrix();
|
GlStateManager.pushMatrix();
|
||||||
GlStateManager.loadIdentity();
|
GlStateManager.loadIdentity();
|
||||||
|
if (enableBlur) {
|
||||||
GlStateManager.gluPerspective(120.0F, 1.0F, 0.05F, 10.0F);
|
GlStateManager.gluPerspective(120.0F, 1.0F, 0.05F, 10.0F);
|
||||||
|
} else {
|
||||||
|
GlStateManager.gluPerspective(85.0F, (float) width / (float) height, 0.05F, 10.0F);
|
||||||
|
}
|
||||||
GlStateManager.matrixMode(GL_MODELVIEW);
|
GlStateManager.matrixMode(GL_MODELVIEW);
|
||||||
GlStateManager.pushMatrix();
|
GlStateManager.pushMatrix();
|
||||||
GlStateManager.loadIdentity();
|
GlStateManager.loadIdentity();
|
||||||
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
GlStateManager.rotate(180.0F, 1.0F, 0.0F, 0.0F);
|
GlStateManager.rotate(180.0F, 1.0F, 0.0F, 0.0F);
|
||||||
|
if (enableBlur) {
|
||||||
GlStateManager.rotate(90.0F, 0.0F, 0.0F, 1.0F);
|
GlStateManager.rotate(90.0F, 0.0F, 0.0F, 1.0F);
|
||||||
|
}
|
||||||
GlStateManager.enableBlend();
|
GlStateManager.enableBlend();
|
||||||
GlStateManager.disableAlpha();
|
GlStateManager.disableAlpha();
|
||||||
GlStateManager.disableCull();
|
GlStateManager.disableCull();
|
||||||
GlStateManager.depthMask(false);
|
GlStateManager.depthMask(false);
|
||||||
GlStateManager.tryBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, 1, 0);
|
GlStateManager.tryBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, 1, 0);
|
||||||
byte b0 = 8;
|
byte b0 = enableBlur ? (byte) 8 : (byte) 1;
|
||||||
|
|
||||||
for (int i = 0; i < b0 * b0; ++i) {
|
for (int i = 0; i < b0 * b0; ++i) {
|
||||||
GlStateManager.pushMatrix();
|
GlStateManager.pushMatrix();
|
||||||
|
@ -521,7 +566,11 @@ public class GuiMainMenu extends GuiScreen implements GuiYesNoCallback {
|
||||||
*/
|
*/
|
||||||
public void drawScreen(int i, int j, float f) {
|
public void drawScreen(int i, int j, float f) {
|
||||||
GlStateManager.disableAlpha();
|
GlStateManager.disableAlpha();
|
||||||
|
if (enableBlur) {
|
||||||
this.renderSkybox(i, j, f);
|
this.renderSkybox(i, j, f);
|
||||||
|
} else {
|
||||||
|
this.drawPanorama(i, j, f);
|
||||||
|
}
|
||||||
GlStateManager.enableAlpha();
|
GlStateManager.enableAlpha();
|
||||||
short short1 = 274;
|
short short1 = 274;
|
||||||
int k = this.width / 2 - short1 / 2;
|
int k = this.width / 2 - short1 / 2;
|
||||||
|
@ -530,7 +579,11 @@ public class GuiMainMenu extends GuiScreen implements GuiYesNoCallback {
|
||||||
this.drawGradientRect(0, 0, this.width, this.height, 0, Integer.MIN_VALUE);
|
this.drawGradientRect(0, 0, this.width, this.height, 0, Integer.MIN_VALUE);
|
||||||
this.mc.getTextureManager().bindTexture(minecraftTitleTextures);
|
this.mc.getTextureManager().bindTexture(minecraftTitleTextures);
|
||||||
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
if (this.isDefault || (double) this.updateCounter < 1.0E-4D) {
|
boolean minc = (double) this.updateCounter < 1.0E-4D;
|
||||||
|
if (this.isDefault) {
|
||||||
|
minc = !minc;
|
||||||
|
}
|
||||||
|
if (minc) {
|
||||||
this.drawTexturedModalRect(k + 0, b0 + 0, 0, 0, 99, 44);
|
this.drawTexturedModalRect(k + 0, b0 + 0, 0, 0, 99, 44);
|
||||||
this.drawTexturedModalRect(k + 99, b0 + 0, 129, 0, 27, 44);
|
this.drawTexturedModalRect(k + 99, b0 + 0, 129, 0, 27, 44);
|
||||||
this.drawTexturedModalRect(k + 99 + 26, b0 + 0, 126, 0, 3, 44);
|
this.drawTexturedModalRect(k + 99 + 26, b0 + 0, 126, 0, 3, 44);
|
||||||
|
|
|
@ -174,7 +174,12 @@ public class ServerData {
|
||||||
this.serverMOTD = motd.length() > 0
|
this.serverMOTD = motd.length() > 0
|
||||||
? (motd.length() > 1 ? motd.getString(0) + "\n" + motd.getString(1) : motd.getString(0))
|
? (motd.length() > 1 ? motd.getString(0) + "\n" + motd.getString(1) : motd.getString(0))
|
||||||
: "";
|
: "";
|
||||||
this.populationInfo = "" + motdData.getInt("online") + "/" + motdData.getInt("max");
|
int max = motdData.getInt("max");
|
||||||
|
if (max > 0) {
|
||||||
|
this.populationInfo = "" + motdData.getInt("online") + "/" + max;
|
||||||
|
} else {
|
||||||
|
this.populationInfo = "" + motdData.getInt("online");
|
||||||
|
}
|
||||||
this.playerList = null;
|
this.playerList = null;
|
||||||
JSONArray players = motdData.optJSONArray("players");
|
JSONArray players = motdData.optJSONArray("players");
|
||||||
if (players.length() > 0) {
|
if (players.length() > 0) {
|
||||||
|
|
|
@ -19,7 +19,6 @@ import org.teavm.jso.dom.html.HTMLCanvasElement;
|
||||||
import org.teavm.jso.dom.html.HTMLDocument;
|
import org.teavm.jso.dom.html.HTMLDocument;
|
||||||
import org.teavm.jso.dom.html.HTMLInputElement;
|
import org.teavm.jso.dom.html.HTMLInputElement;
|
||||||
import org.teavm.jso.typedarrays.ArrayBuffer;
|
import org.teavm.jso.typedarrays.ArrayBuffer;
|
||||||
import org.teavm.jso.typedarrays.Uint8Array;
|
|
||||||
|
|
||||||
import net.lax1dude.eaglercraft.v1_8.Base64;
|
import net.lax1dude.eaglercraft.v1_8.Base64;
|
||||||
import net.lax1dude.eaglercraft.v1_8.EagRuntime;
|
import net.lax1dude.eaglercraft.v1_8.EagRuntime;
|
||||||
|
@ -200,7 +199,7 @@ public class PlatformApplication {
|
||||||
if(name == null) {
|
if(name == null) {
|
||||||
fileChooserResultObject = null;
|
fileChooserResultObject = null;
|
||||||
}else {
|
}else {
|
||||||
fileChooserResultObject = new FileChooserResult(name, TeaVMUtils.wrapUnsignedByteArray(Uint8Array.create(buffer)));
|
fileChooserResultObject = new FileChooserResult(name, TeaVMUtils.wrapByteArrayBuffer(buffer));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -296,7 +295,7 @@ public class PlatformApplication {
|
||||||
private static final native void downloadBytesImpl(String str, ArrayBuffer buf);
|
private static final native void downloadBytesImpl(String str, ArrayBuffer buf);
|
||||||
|
|
||||||
public static final void downloadFileWithName(String str, byte[] dat) {
|
public static final void downloadFileWithName(String str, byte[] dat) {
|
||||||
downloadBytesImpl(str, TeaVMUtils.unwrapUnsignedByteArray(dat).getBuffer());
|
downloadBytesImpl(str, TeaVMUtils.unwrapArrayBuffer(dat));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void showDebugConsole() {
|
public static void showDebugConsole() {
|
||||||
|
|
|
@ -16,7 +16,6 @@ import org.teavm.jso.dom.html.HTMLCanvasElement;
|
||||||
import org.teavm.jso.dom.html.HTMLImageElement;
|
import org.teavm.jso.dom.html.HTMLImageElement;
|
||||||
import org.teavm.jso.dom.xml.Document;
|
import org.teavm.jso.dom.xml.Document;
|
||||||
import org.teavm.jso.typedarrays.ArrayBuffer;
|
import org.teavm.jso.typedarrays.ArrayBuffer;
|
||||||
import org.teavm.jso.typedarrays.Int32Array;
|
|
||||||
import org.teavm.jso.typedarrays.Uint8ClampedArray;
|
import org.teavm.jso.typedarrays.Uint8ClampedArray;
|
||||||
|
|
||||||
import net.lax1dude.eaglercraft.v1_8.EaglerInputStream;
|
import net.lax1dude.eaglercraft.v1_8.EaglerInputStream;
|
||||||
|
@ -54,7 +53,7 @@ public class PlatformAssets {
|
||||||
ArrayBuffer file = PlatformRuntime.downloadRemoteURI(
|
ArrayBuffer file = PlatformRuntime.downloadRemoteURI(
|
||||||
ClientMain.configLocalesFolder + "/" + path.substring(22));
|
ClientMain.configLocalesFolder + "/" + path.substring(22));
|
||||||
if(file != null && file.getByteLength() > 0) {
|
if(file != null && file.getByteLength() > 0) {
|
||||||
data = TeaVMUtils.arrayBufferToBytes(file);
|
data = TeaVMUtils.wrapByteArrayBuffer(file);
|
||||||
assets.put(path, data);
|
assets.put(path, data);
|
||||||
return data;
|
return data;
|
||||||
}else {
|
}else {
|
||||||
|
@ -79,12 +78,15 @@ public class PlatformAssets {
|
||||||
private static CanvasRenderingContext2D imageLoadContext = null;
|
private static CanvasRenderingContext2D imageLoadContext = null;
|
||||||
|
|
||||||
public static ImageData loadImageFile(byte[] data) {
|
public static ImageData loadImageFile(byte[] data) {
|
||||||
return loadImageFile(TeaVMUtils.unwrapUnsignedByteArray(data).getBuffer());
|
return loadImageFile(TeaVMUtils.unwrapArrayBuffer(data));
|
||||||
}
|
}
|
||||||
|
|
||||||
@JSBody(params = { }, script = "return { willReadFrequently: true };")
|
@JSBody(params = { }, script = "return { willReadFrequently: true };")
|
||||||
public static native JSObject youEagler();
|
public static native JSObject youEagler();
|
||||||
|
|
||||||
|
@JSBody(params = { "ctx" }, script = "ctx.imageSmoothingEnabled = false;")
|
||||||
|
private static native void disableImageSmoothing(CanvasRenderingContext2D ctx);
|
||||||
|
|
||||||
@Async
|
@Async
|
||||||
private static native ImageData loadImageFile(ArrayBuffer data);
|
private static native ImageData loadImageFile(ArrayBuffer data);
|
||||||
|
|
||||||
|
@ -105,6 +107,7 @@ public class PlatformAssets {
|
||||||
}
|
}
|
||||||
if(imageLoadContext == null) {
|
if(imageLoadContext == null) {
|
||||||
imageLoadContext = (CanvasRenderingContext2D) imageLoadCanvas.getContext("2d", youEagler());
|
imageLoadContext = (CanvasRenderingContext2D) imageLoadCanvas.getContext("2d", youEagler());
|
||||||
|
disableImageSmoothing(imageLoadContext);
|
||||||
}
|
}
|
||||||
imageLoadContext.clearRect(0, 0, toLoad.getWidth(), toLoad.getHeight());
|
imageLoadContext.clearRect(0, 0, toLoad.getWidth(), toLoad.getHeight());
|
||||||
imageLoadContext.drawImage(toLoad, 0, 0, toLoad.getWidth(), toLoad.getHeight());
|
imageLoadContext.drawImage(toLoad, 0, 0, toLoad.getWidth(), toLoad.getHeight());
|
||||||
|
@ -116,7 +119,7 @@ public class PlatformAssets {
|
||||||
ret.complete(null);
|
ret.complete(null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ret.complete(new ImageData(pxlsDat.getWidth(), pxlsDat.getHeight(), TeaVMUtils.wrapIntArray(Int32Array.create(pxls.getBuffer())), true));
|
ret.complete(new ImageData(pxlsDat.getWidth(), pxlsDat.getHeight(), TeaVMUtils.wrapIntArrayBuffer(pxls.getBuffer()), true));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
toLoad.addEventListener("error", new EventListener<Event>() {
|
toLoad.addEventListener("error", new EventListener<Event>() {
|
||||||
|
|
|
@ -214,7 +214,7 @@ public class PlatformAudio {
|
||||||
if(buffer == null) {
|
if(buffer == null) {
|
||||||
byte[] file = PlatformAssets.getResourceBytes(filename);
|
byte[] file = PlatformAssets.getResourceBytes(filename);
|
||||||
if(file == null) return null;
|
if(file == null) return null;
|
||||||
buffer = new BrowserAudioResource(decodeAudioAsync(TeaVMUtils.unwrapUnsignedByteArray(file).getBuffer(), filename));
|
buffer = new BrowserAudioResource(decodeAudioAsync(TeaVMUtils.unwrapArrayBuffer(file), filename));
|
||||||
if(holdInCache) {
|
if(holdInCache) {
|
||||||
synchronized(soundCache) {
|
synchronized(soundCache) {
|
||||||
soundCache.put(filename, buffer);
|
soundCache.put(filename, buffer);
|
||||||
|
|
|
@ -12,7 +12,6 @@ import org.teavm.jso.dom.events.Event;
|
||||||
import org.teavm.jso.dom.events.EventListener;
|
import org.teavm.jso.dom.events.EventListener;
|
||||||
import org.teavm.jso.dom.events.MessageEvent;
|
import org.teavm.jso.dom.events.MessageEvent;
|
||||||
import org.teavm.jso.typedarrays.ArrayBuffer;
|
import org.teavm.jso.typedarrays.ArrayBuffer;
|
||||||
import org.teavm.jso.typedarrays.Uint8Array;
|
|
||||||
import org.teavm.jso.websocket.WebSocket;
|
import org.teavm.jso.websocket.WebSocket;
|
||||||
|
|
||||||
import net.lax1dude.eaglercraft.v1_8.internal.teavm.TeaVMServerQuery;
|
import net.lax1dude.eaglercraft.v1_8.internal.teavm.TeaVMServerQuery;
|
||||||
|
@ -120,7 +119,7 @@ public class PlatformNetworking {
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
synchronized(readPackets) {
|
synchronized(readPackets) {
|
||||||
readPackets.add(TeaVMUtils.wrapUnsignedByteArray(Uint8Array.create(evt.getDataAsArray())));
|
readPackets.add(TeaVMUtils.wrapByteArrayBuffer(evt.getDataAsArray()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -181,7 +180,7 @@ public class PlatformNetworking {
|
||||||
|
|
||||||
public static void writePlayPacket(byte[] pkt) {
|
public static void writePlayPacket(byte[] pkt) {
|
||||||
if(sock != null && !sockIsConnecting) {
|
if(sock != null && !sockIsConnecting) {
|
||||||
nativeBinarySend(sock, TeaVMUtils.unwrapUnsignedByteArray(pkt).getBuffer());
|
nativeBinarySend(sock, TeaVMUtils.unwrapArrayBuffer(pkt));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,6 @@ import org.teavm.jso.dom.html.HTMLCanvasElement;
|
||||||
import org.teavm.jso.dom.html.HTMLDocument;
|
import org.teavm.jso.dom.html.HTMLDocument;
|
||||||
import org.teavm.jso.dom.html.HTMLElement;
|
import org.teavm.jso.dom.html.HTMLElement;
|
||||||
import org.teavm.jso.typedarrays.ArrayBuffer;
|
import org.teavm.jso.typedarrays.ArrayBuffer;
|
||||||
import org.teavm.jso.typedarrays.Uint8Array;
|
|
||||||
import org.teavm.jso.webaudio.MediaStream;
|
import org.teavm.jso.webaudio.MediaStream;
|
||||||
import org.teavm.jso.webgl.WebGLFramebuffer;
|
import org.teavm.jso.webgl.WebGLFramebuffer;
|
||||||
|
|
||||||
|
@ -311,7 +310,7 @@ public class PlatformRuntime {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void downloadRemoteURIByteArray(String assetPackageURI, final Consumer<byte[]> cb) {
|
public static void downloadRemoteURIByteArray(String assetPackageURI, final Consumer<byte[]> cb) {
|
||||||
downloadRemoteURI(assetPackageURI, arr -> cb.accept(TeaVMUtils.wrapUnsignedByteArray(Uint8Array.create(arr))));
|
downloadRemoteURI(assetPackageURI, arr -> cb.accept(TeaVMUtils.wrapByteArrayBuffer(arr)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void downloadRemoteURI(String assetPackageURI, final Consumer<ArrayBuffer> cb) {
|
public static void downloadRemoteURI(String assetPackageURI, final Consumer<ArrayBuffer> cb) {
|
||||||
|
|
|
@ -2,7 +2,6 @@ package net.lax1dude.eaglercraft.v1_8.internal;
|
||||||
|
|
||||||
import org.teavm.jso.JSBody;
|
import org.teavm.jso.JSBody;
|
||||||
import org.teavm.jso.typedarrays.ArrayBuffer;
|
import org.teavm.jso.typedarrays.ArrayBuffer;
|
||||||
import org.teavm.jso.typedarrays.Uint8Array;
|
|
||||||
|
|
||||||
import net.lax1dude.eaglercraft.v1_8.EagRuntime;
|
import net.lax1dude.eaglercraft.v1_8.EagRuntime;
|
||||||
import net.lax1dude.eaglercraft.v1_8.internal.teavm.TeaVMUpdateThread;
|
import net.lax1dude.eaglercraft.v1_8.internal.teavm.TeaVMUpdateThread;
|
||||||
|
@ -62,7 +61,7 @@ public class PlatformUpdateSvc {
|
||||||
logger.error("Failed to download client bundle or signature URL!");
|
logger.error("Failed to download client bundle or signature URL!");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return TeaVMUtils.wrapUnsignedByteArray(Uint8Array.create(buf));
|
return TeaVMUtils.wrapByteArrayBuffer(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static byte[] getClientSignatureData() {
|
public static byte[] getClientSignatureData() {
|
||||||
|
|
|
@ -24,7 +24,6 @@ import org.teavm.jso.dom.events.Event;
|
||||||
import org.teavm.jso.dom.events.EventListener;
|
import org.teavm.jso.dom.events.EventListener;
|
||||||
import org.teavm.jso.json.JSON;
|
import org.teavm.jso.json.JSON;
|
||||||
import org.teavm.jso.typedarrays.ArrayBuffer;
|
import org.teavm.jso.typedarrays.ArrayBuffer;
|
||||||
import org.teavm.jso.typedarrays.Uint8Array;
|
|
||||||
import org.teavm.jso.websocket.WebSocket;
|
import org.teavm.jso.websocket.WebSocket;
|
||||||
|
|
||||||
import com.google.common.collect.LinkedListMultimap;
|
import com.google.common.collect.LinkedListMultimap;
|
||||||
|
@ -211,7 +210,7 @@ public class PlatformWebRTC {
|
||||||
|
|
||||||
TeaVMUtils.addEventListener(dataChannel, "message", (EventListener<Event>) evt -> {
|
TeaVMUtils.addEventListener(dataChannel, "message", (EventListener<Event>) evt -> {
|
||||||
synchronized(clientLANPacketBuffer) {
|
synchronized(clientLANPacketBuffer) {
|
||||||
clientLANPacketBuffer.add(TeaVMUtils.wrapUnsignedByteArray(Uint8Array.create(getData(evt))));
|
clientLANPacketBuffer.add(TeaVMUtils.wrapByteArrayBuffer(getData(evt)));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -326,7 +325,7 @@ public class PlatformWebRTC {
|
||||||
serverLANEventBuffer.put(peerId, new LANPeerEvent.LANPeerDataChannelEvent(peerId));
|
serverLANEventBuffer.put(peerId, new LANPeerEvent.LANPeerDataChannelEvent(peerId));
|
||||||
}
|
}
|
||||||
TeaVMUtils.addEventListener(dataChannel, "message", (EventListener<Event>) evt2 -> {
|
TeaVMUtils.addEventListener(dataChannel, "message", (EventListener<Event>) evt2 -> {
|
||||||
LANPeerEvent.LANPeerPacketEvent e = new LANPeerEvent.LANPeerPacketEvent(peerId, TeaVMUtils.wrapUnsignedByteArray(Uint8Array.create(getData(evt2))));
|
LANPeerEvent.LANPeerPacketEvent e = new LANPeerEvent.LANPeerPacketEvent(peerId, TeaVMUtils.wrapByteArrayBuffer(getData(evt2)));
|
||||||
synchronized(serverLANEventBuffer) {
|
synchronized(serverLANEventBuffer) {
|
||||||
serverLANEventBuffer.put(peerId, e);
|
serverLANEventBuffer.put(peerId, e);
|
||||||
}
|
}
|
||||||
|
@ -538,10 +537,6 @@ public class PlatformWebRTC {
|
||||||
@JSBody(params = { "obj" }, script = "return typeof obj === \"string\";")
|
@JSBody(params = { "obj" }, script = "return typeof obj === \"string\";")
|
||||||
private static native boolean isString(JSObject obj);
|
private static native boolean isString(JSObject obj);
|
||||||
|
|
||||||
private static ArrayBuffer convertToArrayBuffer(byte[] arr) {
|
|
||||||
return TeaVMUtils.unwrapUnsignedByteArray(arr).getBuffer();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final Map<String,Long> relayQueryLimited = new HashMap<>();
|
private static final Map<String,Long> relayQueryLimited = new HashMap<>();
|
||||||
private static final Map<String,Long> relayQueryBlocked = new HashMap<>();
|
private static final Map<String,Long> relayQueryBlocked = new HashMap<>();
|
||||||
|
|
||||||
|
@ -587,7 +582,7 @@ public class PlatformWebRTC {
|
||||||
sock.onOpen(evt -> {
|
sock.onOpen(evt -> {
|
||||||
try {
|
try {
|
||||||
connectionPingStart = System.currentTimeMillis();
|
connectionPingStart = System.currentTimeMillis();
|
||||||
PlatformNetworking.nativeBinarySend(sock, convertToArrayBuffer(
|
PlatformNetworking.nativeBinarySend(sock, TeaVMUtils.unwrapArrayBuffer(
|
||||||
IPacket.writePacket(new IPacket00Handshake(0x03, RelayManager.preferredRelayVersion, ""))
|
IPacket.writePacket(new IPacket00Handshake(0x03, RelayManager.preferredRelayVersion, ""))
|
||||||
));
|
));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
@ -599,7 +594,7 @@ public class PlatformWebRTC {
|
||||||
sock.onMessage(evt -> {
|
sock.onMessage(evt -> {
|
||||||
if(evt.getData() != null && !isString(evt.getData())) {
|
if(evt.getData() != null && !isString(evt.getData())) {
|
||||||
hasRecievedAnyData = true;
|
hasRecievedAnyData = true;
|
||||||
byte[] arr = TeaVMUtils.wrapUnsignedByteArray(Uint8Array.create(evt.getDataAsArray()));
|
byte[] arr = TeaVMUtils.wrapByteArrayBuffer(evt.getDataAsArray());
|
||||||
if(arr.length == 2 && arr[0] == (byte)0xFC) {
|
if(arr.length == 2 && arr[0] == (byte)0xFC) {
|
||||||
long millis = System.currentTimeMillis();
|
long millis = System.currentTimeMillis();
|
||||||
if(arr[1] == (byte)0x00 || arr[1] == (byte)0x01) {
|
if(arr[1] == (byte)0x00 || arr[1] == (byte)0x01) {
|
||||||
|
@ -842,7 +837,7 @@ public class PlatformWebRTC {
|
||||||
sock = s;
|
sock = s;
|
||||||
sock.onOpen(evt -> {
|
sock.onOpen(evt -> {
|
||||||
try {
|
try {
|
||||||
PlatformNetworking.nativeBinarySend(sock, convertToArrayBuffer(
|
PlatformNetworking.nativeBinarySend(sock, TeaVMUtils.unwrapArrayBuffer(
|
||||||
IPacket.writePacket(new IPacket00Handshake(0x04, RelayManager.preferredRelayVersion, ""))
|
IPacket.writePacket(new IPacket00Handshake(0x04, RelayManager.preferredRelayVersion, ""))
|
||||||
));
|
));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
@ -855,7 +850,7 @@ public class PlatformWebRTC {
|
||||||
sock.onMessage(evt -> {
|
sock.onMessage(evt -> {
|
||||||
if(evt.getData() != null && !isString(evt.getData())) {
|
if(evt.getData() != null && !isString(evt.getData())) {
|
||||||
hasRecievedAnyData = true;
|
hasRecievedAnyData = true;
|
||||||
byte[] arr = TeaVMUtils.wrapUnsignedByteArray(Uint8Array.create(evt.getDataAsArray()));
|
byte[] arr = TeaVMUtils.wrapByteArrayBuffer(evt.getDataAsArray());
|
||||||
if(arr.length == 2 && arr[0] == (byte)0xFC) {
|
if(arr.length == 2 && arr[0] == (byte)0xFC) {
|
||||||
long millis = System.currentTimeMillis();
|
long millis = System.currentTimeMillis();
|
||||||
if(arr[1] == (byte)0x00 || arr[1] == (byte)0x01) {
|
if(arr[1] == (byte)0x00 || arr[1] == (byte)0x01) {
|
||||||
|
@ -1065,7 +1060,7 @@ public class PlatformWebRTC {
|
||||||
if(evt.getData() != null && !isString(evt.getData())) {
|
if(evt.getData() != null && !isString(evt.getData())) {
|
||||||
hasRecievedAnyData = true;
|
hasRecievedAnyData = true;
|
||||||
try {
|
try {
|
||||||
IPacket pkt = IPacket.readPacket(new DataInputStream(new EaglerInputStream(TeaVMUtils.wrapUnsignedByteArray(Uint8Array.create(evt.getDataAsArray())))));
|
IPacket pkt = IPacket.readPacket(new DataInputStream(new EaglerInputStream(TeaVMUtils.wrapByteArrayBuffer(evt.getDataAsArray()))));
|
||||||
if(pkt instanceof IPacket70SpecialUpdate) {
|
if(pkt instanceof IPacket70SpecialUpdate) {
|
||||||
IPacket70SpecialUpdate ipkt = (IPacket70SpecialUpdate)pkt;
|
IPacket70SpecialUpdate ipkt = (IPacket70SpecialUpdate)pkt;
|
||||||
if(ipkt.operation == IPacket70SpecialUpdate.OPERATION_UPDATE_CERTIFICATE) {
|
if(ipkt.operation == IPacket70SpecialUpdate.OPERATION_UPDATE_CERTIFICATE) {
|
||||||
|
@ -1136,7 +1131,7 @@ public class PlatformWebRTC {
|
||||||
@Override
|
@Override
|
||||||
public void writePacket(IPacket pkt) {
|
public void writePacket(IPacket pkt) {
|
||||||
try {
|
try {
|
||||||
PlatformNetworking.nativeBinarySend(sock, convertToArrayBuffer(IPacket.writePacket(pkt)));
|
PlatformNetworking.nativeBinarySend(sock, TeaVMUtils.unwrapArrayBuffer(IPacket.writePacket(pkt)));
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
logger.error("Relay connection error: {}", e.toString());
|
logger.error("Relay connection error: {}", e.toString());
|
||||||
EagRuntime.debugPrintStackTrace(e);
|
EagRuntime.debugPrintStackTrace(e);
|
||||||
|
@ -1283,7 +1278,7 @@ public class PlatformWebRTC {
|
||||||
|
|
||||||
// todo: ArrayBuffer version
|
// todo: ArrayBuffer version
|
||||||
public static void clientLANSendPacket(byte[] pkt) {
|
public static void clientLANSendPacket(byte[] pkt) {
|
||||||
rtcLANClient.sendPacketToServer(convertToArrayBuffer(pkt));
|
rtcLANClient.sendPacketToServer(TeaVMUtils.unwrapArrayBuffer(pkt));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static byte[] clientLANReadPacket() {
|
public static byte[] clientLANReadPacket() {
|
||||||
|
@ -1409,7 +1404,7 @@ public class PlatformWebRTC {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void serverLANWritePacket(String peer, byte[] data) {
|
public static void serverLANWritePacket(String peer, byte[] data) {
|
||||||
rtcLANServer.sendPacketToRemoteClient(peer, TeaVMUtils.unwrapUnsignedByteArray(data).getBuffer());
|
rtcLANServer.sendPacketToRemoteClient(peer, TeaVMUtils.unwrapArrayBuffer(data));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void serverLANCreatePeer(String peer) {
|
public static void serverLANCreatePeer(String peer) {
|
||||||
|
|
|
@ -60,6 +60,7 @@ public class TeaVMClientConfigAdapter implements IClientConfigAdapter {
|
||||||
private boolean allowFNAWSkins = true;
|
private boolean allowFNAWSkins = true;
|
||||||
private String localStorageNamespace = "_eaglercraftX";
|
private String localStorageNamespace = "_eaglercraftX";
|
||||||
private final TeaVMClientConfigAdapterHooks hooks = new TeaVMClientConfigAdapterHooks();
|
private final TeaVMClientConfigAdapterHooks hooks = new TeaVMClientConfigAdapterHooks();
|
||||||
|
private boolean enableMinceraft = true;
|
||||||
|
|
||||||
public void loadNative(JSObject jsObject) {
|
public void loadNative(JSObject jsObject) {
|
||||||
integratedServerOpts = new JSONObject();
|
integratedServerOpts = new JSONObject();
|
||||||
|
@ -81,6 +82,7 @@ public class TeaVMClientConfigAdapter implements IClientConfigAdapter {
|
||||||
allowVoiceClient = eaglercraftXOpts.getAllowVoiceClient(true);
|
allowVoiceClient = eaglercraftXOpts.getAllowVoiceClient(true);
|
||||||
allowFNAWSkins = !demoMode && eaglercraftXOpts.getAllowFNAWSkins(true);
|
allowFNAWSkins = !demoMode && eaglercraftXOpts.getAllowFNAWSkins(true);
|
||||||
localStorageNamespace = eaglercraftXOpts.getLocalStorageNamespace(EaglercraftVersion.localStorageNamespace);
|
localStorageNamespace = eaglercraftXOpts.getLocalStorageNamespace(EaglercraftVersion.localStorageNamespace);
|
||||||
|
enableMinceraft = eaglercraftXOpts.getEnableMinceraft(true);
|
||||||
JSEaglercraftXOptsHooks hooksObj = eaglercraftXOpts.getHooks();
|
JSEaglercraftXOptsHooks hooksObj = eaglercraftXOpts.getHooks();
|
||||||
if(hooksObj != null) {
|
if(hooksObj != null) {
|
||||||
hooks.loadHooks(hooksObj);
|
hooks.loadHooks(hooksObj);
|
||||||
|
@ -175,6 +177,7 @@ public class TeaVMClientConfigAdapter implements IClientConfigAdapter {
|
||||||
allowVoiceClient = eaglercraftOpts.optBoolean("allowVoiceClient", true);
|
allowVoiceClient = eaglercraftOpts.optBoolean("allowVoiceClient", true);
|
||||||
allowFNAWSkins = eaglercraftOpts.optBoolean("allowFNAWSkins", true);
|
allowFNAWSkins = eaglercraftOpts.optBoolean("allowFNAWSkins", true);
|
||||||
localStorageNamespace = eaglercraftOpts.optString("localStorageNamespace", EaglercraftVersion.localStorageNamespace);
|
localStorageNamespace = eaglercraftOpts.optString("localStorageNamespace", EaglercraftVersion.localStorageNamespace);
|
||||||
|
enableMinceraft = eaglercraftOpts.optBoolean("enableMinceraft", true);
|
||||||
JSONArray serversArray = eaglercraftOpts.optJSONArray("servers");
|
JSONArray serversArray = eaglercraftOpts.optJSONArray("servers");
|
||||||
if(serversArray != null) {
|
if(serversArray != null) {
|
||||||
for(int i = 0, l = serversArray.length(); i < l; ++i) {
|
for(int i = 0, l = serversArray.length(); i < l; ++i) {
|
||||||
|
@ -332,6 +335,11 @@ public class TeaVMClientConfigAdapter implements IClientConfigAdapter {
|
||||||
return localStorageNamespace;
|
return localStorageNamespace;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isEnableMinceraft() {
|
||||||
|
return enableMinceraft;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IClientConfigAdapterHooks getHooks() {
|
public IClientConfigAdapterHooks getHooks() {
|
||||||
return hooks;
|
return hooks;
|
||||||
|
@ -357,6 +365,7 @@ public class TeaVMClientConfigAdapter implements IClientConfigAdapter {
|
||||||
jsonObject.put("allowVoiceClient", allowVoiceClient);
|
jsonObject.put("allowVoiceClient", allowVoiceClient);
|
||||||
jsonObject.put("allowFNAWSkins", allowFNAWSkins);
|
jsonObject.put("allowFNAWSkins", allowFNAWSkins);
|
||||||
jsonObject.put("localStorageNamespace", localStorageNamespace);
|
jsonObject.put("localStorageNamespace", localStorageNamespace);
|
||||||
|
jsonObject.put("enableMinceraft", enableMinceraft);
|
||||||
JSONArray serversArr = new JSONArray();
|
JSONArray serversArr = new JSONArray();
|
||||||
for(int i = 0, l = defaultServers.size(); i < l; ++i) {
|
for(int i = 0, l = defaultServers.size(); i < l; ++i) {
|
||||||
DefaultServer srv = defaultServers.get(i);
|
DefaultServer srv = defaultServers.get(i);
|
||||||
|
|
|
@ -10,7 +10,6 @@ import org.teavm.jso.dom.events.Event;
|
||||||
import org.teavm.jso.dom.events.EventListener;
|
import org.teavm.jso.dom.events.EventListener;
|
||||||
import org.teavm.jso.dom.events.MessageEvent;
|
import org.teavm.jso.dom.events.MessageEvent;
|
||||||
import org.teavm.jso.typedarrays.ArrayBuffer;
|
import org.teavm.jso.typedarrays.ArrayBuffer;
|
||||||
import org.teavm.jso.typedarrays.Uint8Array;
|
|
||||||
import org.teavm.jso.websocket.WebSocket;
|
import org.teavm.jso.websocket.WebSocket;
|
||||||
|
|
||||||
import net.lax1dude.eaglercraft.v1_8.internal.EnumServerRateLimit;
|
import net.lax1dude.eaglercraft.v1_8.internal.EnumServerRateLimit;
|
||||||
|
@ -116,7 +115,7 @@ public class TeaVMServerQuery implements IServerQuery {
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
synchronized(queryResponsesBytes) {
|
synchronized(queryResponsesBytes) {
|
||||||
queryResponsesBytes.add(TeaVMUtils.wrapUnsignedByteArray(Uint8Array.create(evt.getDataAsArray())));
|
queryResponsesBytes.add(TeaVMUtils.wrapByteArrayBuffer(evt.getDataAsArray()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -143,7 +142,7 @@ public class TeaVMServerQuery implements IServerQuery {
|
||||||
@Override
|
@Override
|
||||||
public void send(byte[] bytes) {
|
public void send(byte[] bytes) {
|
||||||
if(open) {
|
if(open) {
|
||||||
nativeBinarySend(sock, TeaVMUtils.unwrapByteArray(bytes).getBuffer());
|
nativeBinarySend(sock, TeaVMUtils.unwrapArrayBuffer(bytes));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,6 @@ import org.teavm.jso.browser.Window;
|
||||||
import org.teavm.jso.dom.events.Event;
|
import org.teavm.jso.dom.events.Event;
|
||||||
import org.teavm.jso.dom.events.EventListener;
|
import org.teavm.jso.dom.events.EventListener;
|
||||||
import org.teavm.jso.typedarrays.ArrayBuffer;
|
import org.teavm.jso.typedarrays.ArrayBuffer;
|
||||||
import org.teavm.jso.typedarrays.Uint8Array;
|
|
||||||
|
|
||||||
import com.google.common.collect.ListMultimap;
|
import com.google.common.collect.ListMultimap;
|
||||||
|
|
||||||
|
@ -220,7 +219,7 @@ public class TeaVMUpdateThread implements Runnable {
|
||||||
if(xhr.getStatus() == 200) {
|
if(xhr.getStatus() == 200) {
|
||||||
ArrayBuffer data = (ArrayBuffer)xhr.getResponse();
|
ArrayBuffer data = (ArrayBuffer)xhr.getResponse();
|
||||||
if(data.getByteLength() == updateCert.bundleDataLength) {
|
if(data.getByteLength() == updateCert.bundleDataLength) {
|
||||||
cb.complete(TeaVMUtils.wrapUnsignedByteArray(Uint8Array.create(data)));
|
cb.complete(TeaVMUtils.wrapByteArrayBuffer(data));
|
||||||
}else {
|
}else {
|
||||||
logger.error("Unexpected response length {} (expect: {}) from URL: {}", xhr.getStatus(), xhr.getStatusText(), url);
|
logger.error("Unexpected response length {} (expect: {}) from URL: {}", xhr.getStatus(), xhr.getStatusText(), url);
|
||||||
cb.complete(null);
|
cb.complete(null);
|
||||||
|
|
|
@ -51,89 +51,199 @@ public class TeaVMUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Int8Array unwrapByteArray(byte[] buf) {
|
public static Int8Array unwrapByteArray(byte[] buf) {
|
||||||
|
if(buf == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
return Int8Array.create(((TeaVMArrayObject)(Object)buf).getData().getBuffer());
|
return Int8Array.create(((TeaVMArrayObject)(Object)buf).getData().getBuffer());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ArrayBuffer unwrapArrayBuffer(byte[] buf) {
|
public static ArrayBuffer unwrapArrayBuffer(byte[] buf) {
|
||||||
|
if(buf == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
return ((TeaVMArrayObject)(Object)buf).getData().getBuffer();
|
return ((TeaVMArrayObject)(Object)buf).getData().getBuffer();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ArrayBufferView unwrapArrayBufferView(byte[] buf) {
|
public static ArrayBufferView unwrapArrayBufferView(byte[] buf) {
|
||||||
|
if(buf == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
return ((TeaVMArrayObject)(Object)buf).getData();
|
return ((TeaVMArrayObject)(Object)buf).getData();
|
||||||
}
|
}
|
||||||
|
|
||||||
@JSBody(params = { "buf" }, script = "return $rt_createByteArray(buf.buffer)")
|
@JSBody(params = { "buf" }, script = "return $rt_createByteArray(buf)")
|
||||||
private static native JSObject wrapByteArray0(JSObject buf);
|
private static native JSObject wrapByteArray0(JSObject buf);
|
||||||
|
|
||||||
public static byte[] wrapByteArray(Int8Array buf) {
|
public static byte[] wrapByteArray(Int8Array buf) {
|
||||||
|
if(buf == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return (byte[])(Object)wrapByteArray0(buf.getBuffer());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static byte[] wrapByteArrayBuffer(ArrayBuffer buf) {
|
||||||
|
if(buf == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
return (byte[])(Object)wrapByteArray0(buf);
|
return (byte[])(Object)wrapByteArray0(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static byte[] wrapByteArrayBufferView(ArrayBufferView buf) {
|
||||||
|
if(buf == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return (byte[])(Object)wrapByteArray0(buf.getBuffer());
|
||||||
|
}
|
||||||
|
|
||||||
public static Uint8Array unwrapUnsignedByteArray(byte[] buf) {
|
public static Uint8Array unwrapUnsignedByteArray(byte[] buf) {
|
||||||
|
if(buf == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
return Uint8Array.create(((TeaVMArrayObject)(Object)buf).getData().getBuffer());
|
return Uint8Array.create(((TeaVMArrayObject)(Object)buf).getData().getBuffer());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static byte[] wrapUnsignedByteArray(Uint8Array buf) {
|
public static byte[] wrapUnsignedByteArray(Uint8Array buf) {
|
||||||
return (byte[])(Object)wrapByteArray0(buf);
|
if(buf == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return (byte[])(Object)wrapByteArray0(buf.getBuffer());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Int32Array unwrapIntArray(int[] buf) {
|
public static Int32Array unwrapIntArray(int[] buf) {
|
||||||
|
if(buf == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
return Int32Array.create(((TeaVMArrayObject)(Object)buf).getData().getBuffer());
|
return Int32Array.create(((TeaVMArrayObject)(Object)buf).getData().getBuffer());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ArrayBuffer unwrapArrayBuffer(int[] buf) {
|
public static ArrayBuffer unwrapArrayBuffer(int[] buf) {
|
||||||
|
if(buf == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
return ((TeaVMArrayObject)(Object)buf).getData().getBuffer();
|
return ((TeaVMArrayObject)(Object)buf).getData().getBuffer();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ArrayBufferView unwrapArrayBufferView(int[] buf) {
|
public static ArrayBufferView unwrapArrayBufferView(int[] buf) {
|
||||||
|
if(buf == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
return ((TeaVMArrayObject)(Object)buf).getData();
|
return ((TeaVMArrayObject)(Object)buf).getData();
|
||||||
}
|
}
|
||||||
|
|
||||||
@JSBody(params = { "buf" }, script = "return $rt_createIntArray(buf.buffer)")
|
@JSBody(params = { "buf" }, script = "return $rt_createIntArray(buf)")
|
||||||
private static native JSObject wrapIntArray0(JSObject buf);
|
private static native JSObject wrapIntArray0(JSObject buf);
|
||||||
|
|
||||||
public static int[] wrapIntArray(Int32Array buf) {
|
public static int[] wrapIntArray(Int32Array buf) {
|
||||||
|
if(buf == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return (int[])(Object)wrapIntArray0(buf.getBuffer());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int[] wrapIntArrayBuffer(ArrayBuffer buf) {
|
||||||
|
if(buf == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
return (int[])(Object)wrapIntArray0(buf);
|
return (int[])(Object)wrapIntArray0(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static int[] wrapIntArrayBufferView(ArrayBufferView buf) {
|
||||||
|
if(buf == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return (int[])(Object)wrapIntArray0(buf.getBuffer());
|
||||||
|
}
|
||||||
|
|
||||||
public static Float32Array unwrapFloatArray(float[] buf) {
|
public static Float32Array unwrapFloatArray(float[] buf) {
|
||||||
|
if(buf == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
return Float32Array.create(((TeaVMArrayObject)(Object)buf).getData().getBuffer());
|
return Float32Array.create(((TeaVMArrayObject)(Object)buf).getData().getBuffer());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ArrayBuffer unwrapArrayBuffer(float[] buf) {
|
public static ArrayBuffer unwrapArrayBuffer(float[] buf) {
|
||||||
|
if(buf == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
return ((TeaVMArrayObject)(Object)buf).getData().getBuffer();
|
return ((TeaVMArrayObject)(Object)buf).getData().getBuffer();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ArrayBufferView unwrapArrayBufferView(float[] buf) {
|
public static ArrayBufferView unwrapArrayBufferView(float[] buf) {
|
||||||
|
if(buf == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
return ((TeaVMArrayObject)(Object)buf).getData();
|
return ((TeaVMArrayObject)(Object)buf).getData();
|
||||||
}
|
}
|
||||||
|
|
||||||
@JSBody(params = { "buf" }, script = "return $rt_createFloatArray(buf.buffer)")
|
@JSBody(params = { "buf" }, script = "return $rt_createFloatArray(buf)")
|
||||||
private static native JSObject wrapFloatArray0(JSObject buf);
|
private static native JSObject wrapFloatArray0(JSObject buf);
|
||||||
|
|
||||||
public static float[] wrapFloatArray(Float32Array buf) {
|
public static float[] wrapFloatArray(Float32Array buf) {
|
||||||
|
if(buf == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return (float[])(Object)wrapFloatArray0(buf.getBuffer());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static float[] wrapFloatArrayBuffer(ArrayBuffer buf) {
|
||||||
|
if(buf == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
return (float[])(Object)wrapFloatArray0(buf);
|
return (float[])(Object)wrapFloatArray0(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static float[] wrapFloatArrayBufferView(ArrayBufferView buf) {
|
||||||
|
if(buf == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return (float[])(Object)wrapFloatArray0(buf.getBuffer());
|
||||||
|
}
|
||||||
|
|
||||||
public static Int16Array unwrapShortArray(short[] buf) {
|
public static Int16Array unwrapShortArray(short[] buf) {
|
||||||
|
if(buf == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
return Int16Array.create(((TeaVMArrayObject)(Object)buf).getData().getBuffer());
|
return Int16Array.create(((TeaVMArrayObject)(Object)buf).getData().getBuffer());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ArrayBuffer unwrapArrayBuffer(short[] buf) {
|
public static ArrayBuffer unwrapArrayBuffer(short[] buf) {
|
||||||
|
if(buf == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
return ((TeaVMArrayObject)(Object)buf).getData().getBuffer();
|
return ((TeaVMArrayObject)(Object)buf).getData().getBuffer();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ArrayBufferView unwrapArrayBufferView(short[] buf) {
|
public static ArrayBufferView unwrapArrayBufferView(short[] buf) {
|
||||||
|
if(buf == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
return ((TeaVMArrayObject)(Object)buf).getData();
|
return ((TeaVMArrayObject)(Object)buf).getData();
|
||||||
}
|
}
|
||||||
|
|
||||||
@JSBody(params = { "buf" }, script = "return $rt_createShortArray(buf.buffer)")
|
@JSBody(params = { "buf" }, script = "return $rt_createShortArray(buf)")
|
||||||
private static native JSObject wrapShortArray0(JSObject buf);
|
private static native JSObject wrapShortArray0(JSObject buf);
|
||||||
|
|
||||||
public static short[] wrapShortArray(Int16Array buf) {
|
public static short[] wrapShortArray(Int16Array buf) {
|
||||||
|
if(buf == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return (short[])(Object)wrapShortArray0(buf.getBuffer());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static short[] wrapShortArrayBuffer(ArrayBuffer buf) {
|
||||||
|
if(buf == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
return (short[])(Object)wrapShortArray0(buf);
|
return (short[])(Object)wrapShortArray0(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static short[] wrapShortArrayBuffer(ArrayBufferView buf) {
|
||||||
|
if(buf == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return (short[])(Object)wrapShortArray0(buf.getBuffer());
|
||||||
|
}
|
||||||
|
|
||||||
@Async
|
@Async
|
||||||
public static native void sleepSetTimeout(int millis);
|
public static native void sleepSetTimeout(int millis);
|
||||||
|
|
||||||
|
@ -141,14 +251,6 @@ public class TeaVMUtils {
|
||||||
Window.setTimeout(() -> cb.complete(null), millis);
|
Window.setTimeout(() -> cb.complete(null), millis);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final byte[] arrayBufferToBytes(ArrayBuffer buf) {
|
|
||||||
if(buf == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return wrapUnsignedByteArray(Uint8Array.create(buf));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String tryResolveClassesSource() {
|
public static String tryResolveClassesSource() {
|
||||||
String str = dumpJSStackTrace();
|
String str = dumpJSStackTrace();
|
||||||
String[] frames = EagUtils.splitPattern.split(str);
|
String[] frames = EagUtils.splitPattern.split(str);
|
||||||
|
|
|
@ -93,4 +93,7 @@ public abstract class JSEaglercraftXOptsRoot implements JSObject {
|
||||||
@JSBody(params = { "def" }, script = "return (typeof this.localStorageNamespace === \"string\") ? this.localStorageNamespace : def;")
|
@JSBody(params = { "def" }, script = "return (typeof this.localStorageNamespace === \"string\") ? this.localStorageNamespace : def;")
|
||||||
public native String getLocalStorageNamespace(String defaultValue);
|
public native String getLocalStorageNamespace(String defaultValue);
|
||||||
|
|
||||||
|
@JSBody(params = { "def" }, script = "return (typeof this.enableMinceraft === \"boolean\") ? this.enableMinceraft : def;")
|
||||||
|
public native boolean getEnableMinceraft(boolean defaultValue);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,6 @@ import org.teavm.jso.JSObject;
|
||||||
import org.teavm.jso.dom.events.ErrorEvent;
|
import org.teavm.jso.dom.events.ErrorEvent;
|
||||||
import org.teavm.jso.dom.events.EventListener;
|
import org.teavm.jso.dom.events.EventListener;
|
||||||
import org.teavm.jso.typedarrays.ArrayBuffer;
|
import org.teavm.jso.typedarrays.ArrayBuffer;
|
||||||
import org.teavm.jso.typedarrays.Uint8Array;
|
|
||||||
import org.teavm.jso.workers.Worker;
|
import org.teavm.jso.workers.Worker;
|
||||||
|
|
||||||
import net.lax1dude.eaglercraft.v1_8.internal.IPCPacketData;
|
import net.lax1dude.eaglercraft.v1_8.internal.IPCPacketData;
|
||||||
|
@ -92,7 +91,7 @@ public class ClientPlatformSingleplayer {
|
||||||
}
|
}
|
||||||
|
|
||||||
synchronized(messageQueue) {
|
synchronized(messageQueue) {
|
||||||
messageQueue.add(new IPCPacketData(channel, TeaVMUtils.wrapUnsignedByteArray(Uint8Array.create(buf))));
|
messageQueue.add(new IPCPacketData(channel, TeaVMUtils.wrapByteArrayBuffer(buf)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -196,10 +195,7 @@ public class ClientPlatformSingleplayer {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void sendPacket(IPCPacketData packet) {
|
public static void sendPacket(IPCPacketData packet) {
|
||||||
ArrayBuffer arb = ArrayBuffer.create(packet.contents.length);
|
sendPacketTeaVM(packet.channel, TeaVMUtils.unwrapArrayBuffer(packet.contents));
|
||||||
Uint8Array ar = Uint8Array.create(arb);
|
|
||||||
ar.set(packet.contents);
|
|
||||||
sendPacketTeaVM(packet.channel, TeaVMUtils.unwrapUnsignedByteArray(packet.contents).getBuffer());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void sendPacketTeaVM(String channel, ArrayBuffer packet) {
|
public static void sendPacketTeaVM(String channel, ArrayBuffer packet) {
|
||||||
|
|
|
@ -8,7 +8,6 @@ import org.teavm.jso.JSBody;
|
||||||
import org.teavm.jso.JSFunctor;
|
import org.teavm.jso.JSFunctor;
|
||||||
import org.teavm.jso.JSObject;
|
import org.teavm.jso.JSObject;
|
||||||
import org.teavm.jso.typedarrays.ArrayBuffer;
|
import org.teavm.jso.typedarrays.ArrayBuffer;
|
||||||
import org.teavm.jso.typedarrays.Uint8Array;
|
|
||||||
|
|
||||||
import net.lax1dude.eaglercraft.v1_8.internal.IClientConfigAdapter;
|
import net.lax1dude.eaglercraft.v1_8.internal.IClientConfigAdapter;
|
||||||
import net.lax1dude.eaglercraft.v1_8.internal.IPCPacketData;
|
import net.lax1dude.eaglercraft.v1_8.internal.IPCPacketData;
|
||||||
|
@ -58,7 +57,7 @@ public class ServerPlatformSingleplayer {
|
||||||
}
|
}
|
||||||
|
|
||||||
synchronized(messageQueue) {
|
synchronized(messageQueue) {
|
||||||
messageQueue.add(new IPCPacketData(channel, TeaVMUtils.wrapUnsignedByteArray(Uint8Array.create(buf))));
|
messageQueue.add(new IPCPacketData(channel, TeaVMUtils.wrapByteArrayBuffer(buf)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,10 +78,7 @@ public class ServerPlatformSingleplayer {
|
||||||
public static native void sendPacketTeaVM(String channel, ArrayBuffer arr);
|
public static native void sendPacketTeaVM(String channel, ArrayBuffer arr);
|
||||||
|
|
||||||
public static void sendPacket(IPCPacketData packet) {
|
public static void sendPacket(IPCPacketData packet) {
|
||||||
ArrayBuffer arb = ArrayBuffer.create(packet.contents.length);
|
sendPacketTeaVM(packet.channel, TeaVMUtils.unwrapArrayBuffer(packet.contents));
|
||||||
Uint8Array ar = Uint8Array.create(arb);
|
|
||||||
ar.set(packet.contents);
|
|
||||||
sendPacketTeaVM(packet.channel, arb);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<IPCPacketData> recieveAllPacket() {
|
public static List<IPCPacketData> recieveAllPacket() {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user