Add loading screen from 2.0

This commit is contained in:
PeytonPlayz595 2024-01-22 02:47:43 +00:00
parent 1dd142c682
commit 61d4655c73
9 changed files with 106789 additions and 106191 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -25,6 +25,7 @@ import net.PeytonPlayz585.shadow.gui.GuiSecretMainMenu;
import net.PeytonPlayz585.shadow.input.Controller; import net.PeytonPlayz585.shadow.input.Controller;
import net.lax1dude.eaglercraft.v1_8.Display; import net.lax1dude.eaglercraft.v1_8.Display;
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.HString; import net.lax1dude.eaglercraft.v1_8.HString;
import net.lax1dude.eaglercraft.v1_8.IOUtils; import net.lax1dude.eaglercraft.v1_8.IOUtils;
import net.lax1dude.eaglercraft.v1_8.Keyboard; import net.lax1dude.eaglercraft.v1_8.Keyboard;
@ -482,6 +483,9 @@ public class Minecraft implements IThreadListener {
this.renderEngine.deleteTexture(this.mojangLogo); this.renderEngine.deleteTexture(this.mojangLogo);
this.mojangLogo = null; this.mojangLogo = null;
this.loadingScreen = new LoadingScreenRenderer(this); this.loadingScreen = new LoadingScreenRenderer(this);
PlatformRuntime.die();
EagUtils.sleep(400l);
} }
private void registerMetadataSerializers() { private void registerMetadataSerializers() {

View File

@ -545,7 +545,7 @@ public class PlatformInput {
if(mouseEvents.isEmpty() && keyEvents.isEmpty() && !hasBeenActive()) { if(mouseEvents.isEmpty() && keyEvents.isEmpty() && !hasBeenActive()) {
EarlyLoadScreen.paintEnable(); EarlyLoadScreen.paintEnable();
while(mouseEvents.isEmpty() && keyEvents.isEmpty()) { while(!PlatformRuntime.returnHasUserInteractionHappened()) {
EagUtils.sleep(100l); EagUtils.sleep(100l);
} }
} }

View File

@ -7,6 +7,7 @@ import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import java.util.function.Consumer; import java.util.function.Consumer;
import net.lax1dude.eaglercraft.v1_8.EagUtils;
import net.lax1dude.eaglercraft.v1_8.EaglercraftVersion; import net.lax1dude.eaglercraft.v1_8.EaglercraftVersion;
import net.lax1dude.eaglercraft.v1_8.profile.EaglerProfile; import net.lax1dude.eaglercraft.v1_8.profile.EaglerProfile;
import org.teavm.interop.Async; import org.teavm.interop.Async;
@ -149,7 +150,9 @@ public class PlatformRuntime {
throw new RuntimeInitializationFailureException("Could not download EPK file \"" + url + "\""); throw new RuntimeInitializationFailureException("Could not download EPK file \"" + url + "\"");
} }
showDecompressing();
logger.info("Decompressing: {}", logURL); logger.info("Decompressing: {}", logURL);
EagUtils.sleep(200l);
try { try {
EPKLoader.loadEPK(epkFileData, epkFiles[i].path, PlatformAssets.assets); EPKLoader.loadEPK(epkFileData, epkFiles[i].path, PlatformAssets.assets);
@ -165,10 +168,15 @@ public class PlatformRuntime {
logger.info("Initializing sound engine..."); logger.info("Initializing sound engine...");
showEnableScreen();
EagUtils.sleep(400l);
PlatformInput.pressAnyKeyScreen(); PlatformInput.pressAnyKeyScreen();
PlatformAudio.initialize(); PlatformAudio.initialize();
showEaglerLoadingScreen();
EagUtils.sleep(400l);
if(finalLoadScreen != null) { if(finalLoadScreen != null) {
EarlyLoadScreen.paintFinal(finalLoadScreen); EarlyLoadScreen.paintFinal(finalLoadScreen);
} }
@ -292,6 +300,13 @@ public class PlatformRuntime {
} }
}); });
TeaVMUtils.addEventListener(request, "progress", new EventListener<Event>() {
@Override
public void handleEvent(Event evt) {
updateLoading(evt);
}
});
TeaVMUtils.addEventListener(request, "error", new EventListener<Event>() { TeaVMUtils.addEventListener(request, "error", new EventListener<Event>() {
@Override @Override
public void handleEvent(Event evt) { public void handleEvent(Event evt) {
@ -558,4 +573,25 @@ public class PlatformRuntime {
mediaRec = null; mediaRec = null;
} }
} }
@JSBody(params = { "evt" }, script = "updateLoadingScreen(evt)")
public static native void updateLoading(Event evt);
@JSBody(params = { }, script = "showDecompressing()")
public static native void showDecompressing();
@JSBody(params = { }, script = "showEnableScreen()")
public static native void showEnableScreen();
@JSBody(params = { }, script = "showEaglerLoadingScreen()")
public static native void showEaglerLoadingScreen();
@JSBody(params = { }, script = "showMojangScreen()")
public static native void showMojangScreen();
@JSBody(params = { }, script = "die()")
public static native void die();
@JSBody(params = { }, script = "return returnHasUserInteractionHappened()")
public static native boolean returnHasUserInteractionHappened();
} }