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

View File

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

View File

@ -7,6 +7,7 @@ import java.text.SimpleDateFormat;
import java.util.Date;
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.profile.EaglerProfile;
import org.teavm.interop.Async;
@ -149,7 +150,9 @@ public class PlatformRuntime {
throw new RuntimeInitializationFailureException("Could not download EPK file \"" + url + "\"");
}
showDecompressing();
logger.info("Decompressing: {}", logURL);
EagUtils.sleep(200l);
try {
EPKLoader.loadEPK(epkFileData, epkFiles[i].path, PlatformAssets.assets);
@ -165,10 +168,15 @@ public class PlatformRuntime {
logger.info("Initializing sound engine...");
showEnableScreen();
EagUtils.sleep(400l);
PlatformInput.pressAnyKeyScreen();
PlatformAudio.initialize();
showEaglerLoadingScreen();
EagUtils.sleep(400l);
if(finalLoadScreen != null) {
EarlyLoadScreen.paintFinal(finalLoadScreen);
}
@ -291,6 +299,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>() {
@Override
@ -558,4 +573,25 @@ public class PlatformRuntime {
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();
}