22w38a Made better crash message for no webgl 2.0

This commit is contained in:
LAX1DUDE 2022-09-21 23:13:57 -07:00
parent 1ff73b29b0
commit 8356ae7763
17 changed files with 54220 additions and 53934 deletions

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<projectDescription> <projectDescription>
<name>eaglercraft-sp</name> <name>eaglercraft</name>
<comment>Project eaglercraft-unified created by Buildship.</comment> <comment>Project eaglercraft-unified created by Buildship.</comment>
<projects> <projects>
</projects> </projects>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -6,7 +6,7 @@ public class ConfigConstants {
public static boolean profanity = false; public static boolean profanity = false;
public static final String version = "22w36a"; public static final String version = "22w38a";
public static final String mainMenuString = "eaglercraft " + version; public static final String mainMenuString = "eaglercraft " + version;
public static final String forkMe = "https://github.com/lax1dude/eaglercraft"; public static final String forkMe = "https://github.com/lax1dude/eaglercraft";

View File

@ -1504,12 +1504,14 @@ public class Minecraft implements Runnable {
} else { } else {
this.entityRenderer.startup = 0; this.entityRenderer.startup = 0;
this.entityRenderer.preStartup = 0; this.entityRenderer.preStartup = 0;
this.entityRenderer.asdfghjkl = false;
} }
if(!this.gameSettings.adderall || !yeeState) { if(!(this.gameSettings.adderall || entityRenderer.asdfghjkl) || !yeeState) {
this.entityRenderer.startup = 0; this.entityRenderer.startup = 0;
this.entityRenderer.preStartup = 0; this.entityRenderer.preStartup = 0;
this.gameSettings.adderall = false; this.gameSettings.adderall = false;
this.entityRenderer.asdfghjkl = false;
} }
if(this.theWorld == null) { if(this.theWorld == null) {

View File

@ -1197,6 +1197,8 @@ public class EntityRenderer {
private int updateCounter = 0; private int updateCounter = 0;
private int randomOffset = (int)(System.currentTimeMillis() % 100000l); private int randomOffset = (int)(System.currentTimeMillis() % 100000l);
public boolean asdfghjkl = false;
private void addRainParticles() { private void addRainParticles() {
float var1 = this.mc.theWorld.getRainStrength(1.0F); float var1 = this.mc.theWorld.getRainStrength(1.0F);
@ -1267,7 +1269,7 @@ public class EntityRenderer {
} }
} }
if(mc.gameSettings.adderall) { if(mc.gameSettings.adderall || asdfghjkl) {
if(startup == 0) { if(startup == 0) {
var3.ambientTickCountdown = random.nextInt(12000); var3.ambientTickCountdown = random.nextInt(12000);
} }
@ -1396,7 +1398,7 @@ public class EntityRenderer {
l = Block.blocksList[random.nextInt(256)]; l = Block.blocksList[random.nextInt(256)];
}while(l == null || !(l.isOpaqueCube() || l.renderAsNormalBlock() || l.getRenderType() == 0 || }while(l == null || !(l.isOpaqueCube() || l.renderAsNormalBlock() || l.getRenderType() == 0 ||
l.getRenderType() == 27 || l.getRenderType() == 35 || l == Block.portal)); l.getRenderType() == 27 || l.getRenderType() == 35 || l == Block.portal));
EntityFallingSand itm = new EntityFallingSand(var3, x + var4 + 0.5, yy + 1, z + var6 + 0.5, l.blockID, 0); EntityFallingSand itm = new EntityFallingSand(var3, x + var4 + 0.5, yy + 0.5, z + var6 + 0.5, l.blockID, 0);
itm.entityId = --var3.ghostEntityId; itm.entityId = --var3.ghostEntityId;
itm.ghost = true; itm.ghost = true;
var3.spawnEntityInWorld(itm); var3.spawnEntityInWorld(itm);
@ -1405,7 +1407,7 @@ public class EntityRenderer {
do { do {
l = Item.itemsList[random.nextInt(384)]; l = Item.itemsList[random.nextInt(384)];
}while(l == null); }while(l == null);
EntityItem itm = new EntityItem(var3, x + var4 + 0.5, yy + 1, z + var6 + 0.5, new ItemStack(l, 1)); EntityItem itm = new EntityItem(var3, x + var4 + 0.5, yy + 1.0, z + var6 + 0.5, new ItemStack(l, 1));
itm.entityId = --var3.ghostEntityId; itm.entityId = --var3.ghostEntityId;
itm.ghost = true; itm.ghost = true;
var3.spawnEntityInWorld(itm); var3.spawnEntityInWorld(itm);

View File

@ -1162,8 +1162,28 @@ public class NetClientHandler extends NetHandler {
} }
public void handleLevelSound(Packet62LevelSound par1Packet62LevelSound) { public void handleLevelSound(Packet62LevelSound par1Packet62LevelSound) {
this.mc.theWorld.playSound(par1Packet62LevelSound.getEffectX(), par1Packet62LevelSound.getEffectY(), par1Packet62LevelSound.getEffectZ(), par1Packet62LevelSound.getSoundName(), par1Packet62LevelSound.getVolume(), String name = par1Packet62LevelSound.getSoundName();
par1Packet62LevelSound.getPitch(), false); if("~!EAG.adderall.start".equals(name)) {
if(mc.yeeState) {
mc.entityRenderer.asdfghjkl = true;
mc.entityRenderer.preStartup = 100000;
}
}else if("~!EAG.adderall.start_instant".equals(name)) {
if(mc.yeeState) {
mc.entityRenderer.asdfghjkl = true;
if(mc.entityRenderer.startup < 1700) {
mc.entityRenderer.preStartup = 100000;
mc.entityRenderer.startup = 1700;
}
}
}else if("~!EAG.adderall.stop".equals(name)) {
if(mc.yeeState) {
mc.entityRenderer.asdfghjkl = false;
}
}else {
this.mc.theWorld.playSound(par1Packet62LevelSound.getEffectX(), par1Packet62LevelSound.getEffectY(), par1Packet62LevelSound.getEffectZ(), name, par1Packet62LevelSound.getVolume(),
par1Packet62LevelSound.getPitch(), false);
}
} }
public void handleCustomPayload(Packet250CustomPayload par1Packet250CustomPayload) { public void handleCustomPayload(Packet250CustomPayload par1Packet250CustomPayload) {

View File

@ -275,7 +275,7 @@ public class SoundManager {
} }
if(this.options.soundVolume > 0.0F && par3 > 0.0F) { if(this.options.soundVolume > 0.0F && par3 > 0.0F) {
Minecraft mc = Minecraft.getMinecraft(); Minecraft mc = Minecraft.getMinecraft();
if(mc.gameSettings.adderall) { if(mc.gameSettings.adderall || mc.entityRenderer.asdfghjkl) {
if(mc.entityRenderer.startup > 300) { if(mc.entityRenderer.startup > 300) {
String rp = remapAdl.get(par1Str); String rp = remapAdl.get(par1Str);
if(rp != null) { if(rp != null) {
@ -334,7 +334,7 @@ public class SoundManager {
public void playSound(String par1Str, float par2, float par3, float par4, float par5, float par6) { public void playSound(String par1Str, float par2, float par3, float par4, float par5, float par6) {
if(this.options.soundVolume > 0.0F && par5 > 0.0F) { if(this.options.soundVolume > 0.0F && par5 > 0.0F) {
Minecraft mc = Minecraft.getMinecraft(); Minecraft mc = Minecraft.getMinecraft();
if(mc.gameSettings.adderall) { if(mc.gameSettings.adderall || mc.entityRenderer.asdfghjkl) {
if(mc.entityRenderer.startup > 300) { if(mc.entityRenderer.startup > 300) {
String rp = remapAdl.get(par1Str); String rp = remapAdl.get(par1Str);
if(rp != null) { if(rp != null) {

File diff suppressed because one or more lines are too long

View File

@ -7,6 +7,7 @@ import org.teavm.jso.dom.html.HTMLCanvasElement;
import org.teavm.jso.typedarrays.Float32Array; import org.teavm.jso.typedarrays.Float32Array;
import org.teavm.jso.typedarrays.Uint8Array; import org.teavm.jso.typedarrays.Uint8Array;
import net.lax1dude.eaglercraft.Client;
import net.lax1dude.eaglercraft.adapter.teavm.WebGL2RenderingContext; import net.lax1dude.eaglercraft.adapter.teavm.WebGL2RenderingContext;
import net.lax1dude.eaglercraft.adapter.teavm.WebGLVertexArray; import net.lax1dude.eaglercraft.adapter.teavm.WebGLVertexArray;
@ -23,8 +24,8 @@ public class DetectAnisotropicGlitch {
WebGL2RenderingContext ctx = (WebGL2RenderingContext) cvs.getContext("webgl2"); WebGL2RenderingContext ctx = (WebGL2RenderingContext) cvs.getContext("webgl2");
if(ctx == null) { if(ctx == null) {
Window.alert("WebGL 2 is not supported in this browser! Eaglercraft cannot start."); Client.showIncompatibleScreen("WebGL 2.0 is not supported on this device!");
throw new UnsupportedOperationException("WebGL 2 is not supported in this browser!"); throw new UnsupportedOperationException("WebGL 2 is not supported on this device!");
} }
if(ctx.getExtension("EXT_texture_filter_anisotropic") != null) { if(ctx.getExtension("EXT_texture_filter_anisotropic") != null) {

View File

@ -88,6 +88,7 @@ import org.teavm.jso.workers.Worker;
import net.lax1dude.eaglercraft.AssetRepository; import net.lax1dude.eaglercraft.AssetRepository;
import net.lax1dude.eaglercraft.Base64; import net.lax1dude.eaglercraft.Base64;
import net.lax1dude.eaglercraft.Client;
import net.lax1dude.eaglercraft.EaglerAdapter; import net.lax1dude.eaglercraft.EaglerAdapter;
import net.lax1dude.eaglercraft.EaglerImage; import net.lax1dude.eaglercraft.EaglerImage;
import net.lax1dude.eaglercraft.EaglerProfile; import net.lax1dude.eaglercraft.EaglerProfile;
@ -281,14 +282,21 @@ public class EaglerAdapterImpl2 {
canvasStyle.setProperty("image-rendering", "pixelated"); canvasStyle.setProperty("image-rendering", "pixelated");
canvas.setWidth(sw); canvas.setWidth(sw);
canvas.setHeight(sh); canvas.setHeight(sh);
SelfDefence.init(canvas);
rootElement.appendChild(canvas); rootElement.appendChild(canvas);
try {
doc.exitPointerLock();
}catch(Throwable t) {
Client.showIncompatibleScreen("Mouse cursor lock is not available on this device!");
throw new RuntimeException("Mouse cursor lock is not available on this device!");
}
SelfDefence.init(canvas);
renderingCanvas = (HTMLCanvasElement)doc.createElement("canvas"); renderingCanvas = (HTMLCanvasElement)doc.createElement("canvas");
renderingCanvas.setWidth(sw); renderingCanvas.setWidth(sw);
renderingCanvas.setHeight(sh); renderingCanvas.setHeight(sh);
frameBuffer = (CanvasRenderingContext2D) canvas.getContext("2d"); frameBuffer = (CanvasRenderingContext2D) canvas.getContext("2d");
webgl = (WebGL2RenderingContext) renderingCanvas.getContext("webgl2", youEagler()); webgl = (WebGL2RenderingContext) renderingCanvas.getContext("webgl2", youEagler());
if(webgl == null) { 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")+")"); throw new RuntimeException("WebGL 2.0 is not supported in your browser ("+getNavString("userAgent")+")");
} }
@ -483,21 +491,27 @@ public class EaglerAdapterImpl2 {
} }
public static final void removeEventHandlers() { public static final void removeEventHandlers() {
win.removeEventListener("contextmenu", contextmenu); try {
win.removeEventListener("mousedown", mousedown); win.removeEventListener("contextmenu", contextmenu);
win.removeEventListener("mouseup", mouseup); win.removeEventListener("mousedown", mousedown);
win.removeEventListener("mousemove", mousemove); win.removeEventListener("mouseup", mouseup);
win.removeEventListener("keydown", keydown); win.removeEventListener("mousemove", mousemove);
win.removeEventListener("keyup", keyup); win.removeEventListener("keydown", keydown);
win.removeEventListener("keypress", keypress); win.removeEventListener("keyup", keyup);
win.removeEventListener("wheel", wheel); win.removeEventListener("keypress", keypress);
String screenImg = canvas.toDataURL("image/png"); win.removeEventListener("wheel", wheel);
canvas.delete(); }catch(Throwable t) {
HTMLImageElement newImage = (HTMLImageElement) doc.createElement("img"); }
newImage.setSrc(screenImg); try {
newImage.setWidth(parent.getClientWidth()); String screenImg = canvas.toDataURL("image/png");
newImage.setHeight(parent.getClientHeight()); canvas.delete();
parent.appendChild(newImage); HTMLImageElement newImage = (HTMLImageElement) doc.createElement("img");
newImage.setSrc(screenImg);
newImage.setWidth(parent.getClientWidth());
newImage.setHeight(parent.getClientHeight());
parent.appendChild(newImage);
}catch(Throwable t) {
}
} }
private static LinkedList<MouseEvent> mouseEvents = new LinkedList(); private static LinkedList<MouseEvent> mouseEvents = new LinkedList();

File diff suppressed because one or more lines are too long

Binary file not shown.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long