fixes part 4

This commit is contained in:
lax1dude 2023-10-14 19:21:14 -07:00
parent 5fb9eded24
commit 5fac75829e
12 changed files with 52679 additions and 52637 deletions

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -261,6 +261,7 @@ directConnect.prompt=What would you like to do?
directConnect.lanWorld=Join LAN World
directConnect.lanWorldCode=Enter Join Code:
directConnect.networkSettingsNote=Click 'Network Settings' to add a relay URL
directConnect.ipGrabNote=Note: The world's owner can get your IP address
directConnect.serverJoin=Connect to Server
directConnect.lanWorldJoin=Join World
directConnect.lanWorldRelay=Network Settings
@ -279,6 +280,7 @@ lanServer.opened=LAN world opened on $relay$, join code is §a$code$
lanServer.closed=LAN world closed
lanServer.pleaseWait=Please Wait...
lanServer.relayDisconnected=Error: connection to LAN relay was lost, you must re-share the world to invide more people
lanServer.ipGrabNote=Note: Players joining your world can get your IP address
networkSettings.title=LAN World Relay Servers
networkSettings.add=Add Relay

View File

@ -182,7 +182,6 @@ public class AssetRepository {
loadNew(new ByteArrayInputStream(load, off + 8, len2));
}
}catch(Throwable t) {
t.printStackTrace();
}
}
}else {

View File

@ -59,7 +59,8 @@ public class GuiScreenLANConnect extends GuiScreen {
this.drawDefaultBackground();
this.drawCenteredString(this.fontRenderer, var4.translateKey("selectServer.direct"), this.width / 2, this.height / 4 - 60 + 20, 16777215);
this.drawString(this.fontRenderer, var4.translateKey("directConnect.lanWorldCode"), this.width / 2 - 100, this.height / 4 + 12, 10526880);
this.drawCenteredString(this.fontRenderer, var4.translateKey("directConnect.networkSettingsNote"), this.width / 2, this.height / 4 + 67, 10526880);
this.drawCenteredString(this.fontRenderer, var4.translateKey("directConnect.networkSettingsNote"), this.width / 2, this.height / 4 + 63, 10526880);
this.drawCenteredString(this.fontRenderer, var4.translateKey("directConnect.ipGrabNote"), this.width / 2, this.height / 4 + 77, 10526880);
this.codeTextField.drawTextBox();
super.drawScreen(xx, yy, pt);
this.relaysButton.drawScreen(xx, yy);

View File

@ -41,17 +41,17 @@ public class GuiShareToLan extends GuiScreen {
*/
public void initGui() {
this.buttonList.clear();
this.buttonList.add(new GuiButton(101, this.width / 2 - 155, this.height - 28, 150, 20,
this.buttonList.add(new GuiButton(101, this.width / 2 - 155, this.height - 28, 140, 20,
StatCollector.translateToLocal("lanServer.start")));
this.buttonList.add(new GuiButton(102, this.width / 2 + 5, this.height - 28, 150, 20,
this.buttonList.add(new GuiButton(102, this.width / 2 + 5, this.height - 28, 140, 20,
StatCollector.translateToLocal("gui.cancel")));
this.buttonList.add(this.buttonGameMode = new GuiButton(104, this.width / 2 - 155, 160, 150, 20,
this.buttonList.add(this.buttonGameMode = new GuiButton(104, this.width / 2 - 155, 135, 140, 20,
StatCollector.translateToLocal("selectWorld.gameMode")));
this.buttonList.add(this.buttonAllowCommandsToggle = new GuiButton(103, this.width / 2 + 5, 160, 150, 20,
this.buttonList.add(this.buttonAllowCommandsToggle = new GuiButton(103, this.width / 2 + 5, 135, 140, 20,
StatCollector.translateToLocal("selectWorld.allowCommands")));
this.buttonList.add(this.buttonHiddenToggle = new GuiButton(105, this.width / 2 - 75, 190, 150, 20,
this.buttonList.add(this.buttonHiddenToggle = new GuiButton(105, this.width / 2 - 75, 165, 140, 20,
StatCollector.translateToLocal("lanServer.hidden")));
this.codeTextField = new GuiTextField(this.fontRenderer, this.width / 2 - 100, 100, 200, 20);
this.codeTextField = new GuiTextField(this.fontRenderer, this.width / 2 - 100, 80, 200, 20);
this.codeTextField.setText(mc.thePlayer.username + "'s World");
this.codeTextField.setFocused(true);
this.codeTextField.setMaxStringLength(252);
@ -135,11 +135,13 @@ public class GuiShareToLan extends GuiScreen {
public void drawScreen(int par1, int par2, float par3) {
this.drawDefaultBackground();
this.drawCenteredString(this.fontRenderer, StatCollector.translateToLocal("lanServer.title"), this.width / 2,
50, 16777215);
35, 16777215);
this.drawCenteredString(this.fontRenderer, StatCollector.translateToLocal("lanServer.worldName"), this.width / 2,
82, 16777215);
62, 16777215);
this.drawCenteredString(this.fontRenderer, StatCollector.translateToLocal("lanServer.otherPlayers"),
this.width / 2, 142, 16777215);
this.width / 2, 112, 16777215);
this.drawCenteredString(this.fontRenderer, StatCollector.translateToLocal("lanServer.ipGrabNote"),
this.width / 2, 195, 16777215);
super.drawScreen(par1, par2, par3);
this.relaysButton.drawScreen(par1, par2);
this.codeTextField.drawTextBox();

View File

@ -224,9 +224,10 @@ public class EaglerAdapterImpl2 {
public static HTMLDocument doc = null;
public static HTMLElement parent = null;
public static HTMLCanvasElement canvas = null;
public static CanvasRenderingContext2D frameBuffer = null;
public static HTMLCanvasElement renderingCanvas = null;
public static WebGL2RenderingContext webgl = null;
public static FramebufferGL backBuffer = null;
public static RenderbufferGL backBufferColor = null;
public static RenderbufferGL backBufferDepth = null;
public static Window win = null;
private static byte[] loadedPackage = null;
private static EventListener contextmenu = null;
@ -290,18 +291,14 @@ public class EaglerAdapterImpl2 {
throw new RuntimeException("Mouse cursor lock is not available on this device!");
}
SelfDefence.init(canvas);
renderingCanvas = (HTMLCanvasElement)doc.createElement("canvas");
renderingCanvas.setWidth(sw);
renderingCanvas.setHeight(sh);
frameBuffer = (CanvasRenderingContext2D) canvas.getContext("2d");
webgl = (WebGL2RenderingContext) renderingCanvas.getContext("webgl2", youEagler());
webgl = (WebGL2RenderingContext) canvas.getContext("webgl2", youEagler());
if(webgl == null) {
Client.showIncompatibleScreen("WebGL 2.0 is not supported on this device!");
throw new RuntimeException("WebGL 2.0 is not supported in your browser ("+getNavString("userAgent")+")");
}
//String agent = getString("window.navigator.userAgent").toLowerCase();
//if(agent.contains("windows")) isAnisotropicPatched = false;
setupBackBuffer();
resizeBackBuffer(sw, sh);
anisotropicFilteringSupported = webgl.getExtension("EXT_texture_filter_anisotropic") != null;
@ -526,7 +523,7 @@ public class EaglerAdapterImpl2 {
private static boolean enableRepeatEvents = false;
private static boolean isWindowFocused = true;
@JSBody(params = { }, script = "return {antialias: false, depth: true, powerPreference: \"high-performance\", desynchronized: false, preserveDrawingBuffer: false, premultipliedAlpha: false, alpha: false};")
@JSBody(params = { }, script = "return {antialias: false, depth: true, powerPreference: \"high-performance\", desynchronized: true, preserveDrawingBuffer: false, premultipliedAlpha: false, alpha: false};")
public static native JSObject youEagler();
public static final int _wGL_TEXTURE_2D = TEXTURE_2D;
@ -956,7 +953,7 @@ public class EaglerAdapterImpl2 {
webgl.vertexAttribPointer(p1, p2, p3, p4, p5, p6);
}
public static final void _wglBindFramebuffer(int p1, FramebufferGL p2) {
webgl.bindFramebuffer(p1, p2 == null ? null : p2.obj);
webgl.bindFramebuffer(p1, p2 == null ? backBuffer.obj : p2.obj);
}
public static final void _wglReadBuffer(int p1) {
webgl.readBuffer(p1);
@ -1057,6 +1054,9 @@ public class EaglerAdapterImpl2 {
return loadPNG0(arr);
}
@JSBody(params = { "cccc", "ennn" }, script = "cccc.imageSmoothingEnabled = ennn;")
private static native void setImageSmoothingMode(CanvasRenderingContext2D cc, boolean en);
@Async
private static native EaglerImage loadPNG0(ArrayBuffer data);
@ -1076,6 +1076,7 @@ public class EaglerAdapterImpl2 {
}
if(imageLoadContext == null) {
imageLoadContext = (CanvasRenderingContext2D) imageLoadCanvas.getContext("2d");
setImageSmoothingMode(imageLoadContext, false);
}
imageLoadContext.clearRect(0, 0, toLoad.getWidth(), toLoad.getHeight());
imageLoadContext.drawImage(toLoad, 0, 0, toLoad.getWidth(), toLoad.getHeight());
@ -1693,12 +1694,7 @@ public class EaglerAdapterImpl2 {
public static final boolean shouldShutdown() {
return false;
}
@JSBody(params = { "obj" }, script = "if(obj.commit) obj.commit();")
private static native int commitContext(JSObject obj);
public static final void updateDisplay() {
//commitContext(webgl);
double r = win.getDevicePixelRatio();
int w = parent.getClientWidth();
int h = parent.getClientHeight();
@ -1710,19 +1706,40 @@ public class EaglerAdapterImpl2 {
if(canvas.getHeight() != h2) {
canvas.setHeight(h2);
}
frameBuffer.drawImage(renderingCanvas, 0, 0, w2, h2);
if(renderingCanvas.getWidth() != w2) {
renderingCanvas.setWidth(w2);
}
if(renderingCanvas.getHeight() != h2) {
renderingCanvas.setHeight(h2);
}
webgl.bindFramebuffer(FRAMEBUFFER, null);
webgl.bindFramebuffer(READ_FRAMEBUFFER, backBuffer.obj);
webgl.bindFramebuffer(DRAW_FRAMEBUFFER, null);
webgl.blitFramebuffer(0, 0, backBufferWidth, backBufferHeight, 0, 0, w2, h2, COLOR_BUFFER_BIT, NEAREST);
webgl.bindFramebuffer(FRAMEBUFFER, backBuffer.obj);
resizeBackBuffer(w2, h2);
try {
Thread.sleep(1l);
} catch (InterruptedException e) {
;
}
}
public static final void setupBackBuffer() {
backBuffer = _wglCreateFramebuffer();
_wglBindFramebuffer(_wGL_FRAMEBUFFER, null);
backBufferColor = _wglCreateRenderBuffer();
_wglBindRenderbuffer(backBufferColor);
_wglFramebufferRenderbuffer(_wGL_COLOR_ATTACHMENT0, backBufferColor);
backBufferDepth = _wglCreateRenderBuffer();
_wglBindRenderbuffer(backBufferDepth);
_wglFramebufferRenderbuffer(_wGL_DEPTH_ATTACHMENT, backBufferDepth);
}
private static int backBufferWidth = -1;
private static int backBufferHeight = -1;
public static final void resizeBackBuffer(int w, int h) {
if(w != backBufferWidth || h != backBufferHeight) {
_wglBindRenderbuffer(backBufferColor);
_wglRenderbufferStorage(_wGL_RGBA8, w, h);
_wglBindRenderbuffer(backBufferDepth);
_wglRenderbufferStorage(_wGL_DEPTH_COMPONENT32F, w, h);
backBufferWidth = w;
backBufferHeight = h;
}
}
public static final float getContentScaling() {
return (float)win.getDevicePixelRatio();
}
@ -1755,10 +1772,10 @@ public class EaglerAdapterImpl2 {
return win.getScreen().getAvailHeight();
}
public static final int getCanvasWidth() {
return renderingCanvas.getWidth();
return canvas.getWidth();
}
public static final int getCanvasHeight() {
return renderingCanvas.getHeight();
return canvas.getHeight();
}
public static final void setDisplaySize(int x, int y) {
@ -1769,7 +1786,16 @@ public class EaglerAdapterImpl2 {
private static final DateFormat dateFormatSS = new SimpleDateFormat("yyyy-MM-dd_HH.mm.ss");
public static final void saveScreenshot() {
saveScreenshot("screenshot_" + dateFormatSS.format(new Date()).toString() + ".png", canvas);
webgl.finish();
HTMLCanvasElement retardedCanvas = (HTMLCanvasElement)doc.createElement("canvas");
retardedCanvas.setWidth(canvas.getWidth());
retardedCanvas.setHeight(canvas.getHeight());
CanvasRenderingContext2D cc = (CanvasRenderingContext2D)retardedCanvas.getContext("2d");
setImageSmoothingMode(cc, false);
cc.setFillStyle("black");
cc.fillRect(0, 0, canvas.getWidth(), canvas.getHeight());
cc.drawImage(canvas, 0, 0, canvas.getWidth(), canvas.getHeight());
saveScreenshot("screenshot_" + dateFormatSS.format(new Date()).toString() + ".png", retardedCanvas);
}
@JSBody(params = { "name", "cvs" }, script = "var a=document.createElement(\"a\");a.href=cvs.toDataURL(\"image/png\");a.download=name;a.click();")

File diff suppressed because one or more lines are too long

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long