mirror of
https://git.zelz.net/catfoolyou/Project164.git
synced 2025-12-14 15:37:41 +00:00
25w16a singleplayer added
This commit is contained in:
170
zip-generator/Offline_Download_Version_Template.html
Executable file
170
zip-generator/Offline_Download_Version_Template.html
Executable file
@@ -0,0 +1,170 @@
|
||||
<!DOCTYPE html>
|
||||
|
||||
|
||||
<!--
|
||||
|
||||
To correctly download this file on github, right click on this page of code and press 'Save As...'
|
||||
|
||||
To correctly download this file on google drive, press the download button at the top right of the screen near the picture of your google account photo
|
||||
|
||||
-->
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!--
|
||||
|
||||
Eaglercraft 1.6.4 is still under development
|
||||
|
||||
This version of eaglercraft you are using right now is from ${date}
|
||||
|
||||
-->
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>My Drive - Google Drive</title>
|
||||
|
||||
<script type="text/javascript">
|
||||
window.addEventListener("load", function() {
|
||||
countdown();
|
||||
setTimeout(function(){
|
||||
document.getElementById("locally").remove();
|
||||
const relayId = Math.floor(Math.random() * 3);
|
||||
window.eaglercraftOpts = {
|
||||
container: "game_frame", assetsURI: getAssetsURI(),
|
||||
serverWorkerURI: createWorkerURI("sp_worker"),
|
||||
worldsFolder: "TEST", mainMenu: { splashes: [
|
||||
"Darviglet!", "eaglerenophile!", "You Eagler!", "Yeeeeeee!", "yeee",
|
||||
"EEEEEEEEE!", "You Darvig!", "You Vigg!", ":>", "|>", "You Yumpster!"
|
||||
]}, worldsFolder: "OFFLINE", relays: [
|
||||
{ addr: "wss://relay.deev.is/", name: "lax1dude relay #1", primary: relayId == 0 },
|
||||
{ addr: "wss://relay.lax1dude.net/", name: "lax1dude relay #2", primary: relayId == 1 },
|
||||
{ addr: "wss://relay.shhnowisnottheti.me/", name: "ayunami relay #1", primary: relayId == 2 } ]
|
||||
};
|
||||
main();
|
||||
}, 6000);
|
||||
});
|
||||
</script>
|
||||
|
||||
<script type="text/javascript">
|
||||
function getAssetsURI() {
|
||||
return "data:application/octet-stream;base64,${assets_epk_base64}";
|
||||
}
|
||||
</script>
|
||||
|
||||
<script type="text/javascript">
|
||||
function createWorkerURI(el) {
|
||||
var eee = document.getElementById(el);
|
||||
var str = eee.innerHTML;
|
||||
eee.remove();
|
||||
str = "onmessage = function(o) { eaglercraftServerOpts = o.data; main(); };\n" + str;
|
||||
return URL.createObjectURL(new Blob([str], {type:"text/javascript"}));
|
||||
}
|
||||
</script>
|
||||
|
||||
<link type="image/png" rel="shortcut icon" href="data:image/png;base64,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" />
|
||||
|
||||
<script type="text/javascript">
|
||||
${classes_js}
|
||||
${eagswebrtc_js}
|
||||
</script>
|
||||
|
||||
<script type="text/eaglerworker" id="sp_worker">
|
||||
${classes_server_js}
|
||||
</script>
|
||||
|
||||
<script type="text/javascript">
|
||||
function countdown() {
|
||||
const c = document.getElementById("countdown");
|
||||
setTimeout(function(){ c.innerText = "(Game will launch in 4)"; }, 1000);
|
||||
setTimeout(function(){ c.innerText = "(Game will launch in 3)"; }, 2000);
|
||||
setTimeout(function(){ c.innerText = "(Game will launch in 2)"; }, 3000);
|
||||
setTimeout(function(){ c.innerText = "(Game will launch in 1)"; }, 4000);
|
||||
setTimeout(function(){ c.innerText = "(Game will launch in 0)"; }, 5000);
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body style="margin:0px;width:100vw;height:100vh;font-family:sans-serif;" id="game_frame">
|
||||
<div id="locally" style="text-align:center;">
|
||||
<div style="height:5vh;"></div>
|
||||
<h2>Eaglercraft 1.6.4</h2>
|
||||
<h3>the version you are currently using is from <span style="color:#cc0000;font-size:larger;">${date}</span></h3>
|
||||
<p id="countdown" style="text-align:center;">(Game will launch in 5)</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
19
zip-generator/ZipStableDownloadJava11.bat
Executable file
19
zip-generator/ZipStableDownloadJava11.bat
Executable file
@@ -0,0 +1,19 @@
|
||||
@echo off
|
||||
setlocal enabledelayedexpansion
|
||||
title ZipStableDownload
|
||||
cd ..
|
||||
echo enter the path to your java 11 installation (or leave blank to assume it is the default):
|
||||
SET /P "JAVA11PATH="
|
||||
if "!JAVA11PATH!" neq "" (
|
||||
set "JAVA11PATH=!JAVA11PATH:\=/!"
|
||||
if "!JAVA11PATH:~-1!" neq "/" (
|
||||
set "JAVA11PATH=!JAVA11PATH!/"
|
||||
)
|
||||
if "!JAVA11PATH:~-5!" neq "/bin/" (
|
||||
set "JAVA11PATH=!JAVA11PATH!bin/"
|
||||
)
|
||||
)
|
||||
echo Using java at: "!JAVA11PATH!java"
|
||||
"!JAVA11PATH!java" -cp zip-generator/deps/*;zip-generator/zipGenerator.jar net.lax1dude.eaglercraft.zip_generator.ZipGenerator
|
||||
endlocal
|
||||
pause
|
||||
BIN
zip-generator/deps/Java11Check.jar
Executable file
BIN
zip-generator/deps/Java11Check.jar
Executable file
Binary file not shown.
BIN
zip-generator/deps/commons-codec-1.15.jar
Executable file
BIN
zip-generator/deps/commons-codec-1.15.jar
Executable file
Binary file not shown.
BIN
zip-generator/deps/commons-io-2.11.0.jar
Executable file
BIN
zip-generator/deps/commons-io-2.11.0.jar
Executable file
Binary file not shown.
BIN
zip-generator/google-closure-compiler.jar
Executable file
BIN
zip-generator/google-closure-compiler.jar
Executable file
Binary file not shown.
@@ -0,0 +1,61 @@
|
||||
package net.lax1dude.eaglercraft.zip_generator;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.lang.ProcessBuilder.Redirect;
|
||||
|
||||
// taken from 1.8 buildtools
|
||||
public class JARSubprocess {
|
||||
|
||||
public static final char classPathSeperator;
|
||||
|
||||
static {
|
||||
classPathSeperator = System.getProperty("os.name").toLowerCase().contains("windows") ? ';' : ':';
|
||||
}
|
||||
|
||||
public static int runJava(File directory, String[] javaExeArguments, String logPrefix) throws IOException {
|
||||
if(logPrefix.length() > 0 && !logPrefix.endsWith(" ")) {
|
||||
logPrefix = logPrefix + " ";
|
||||
}
|
||||
String javaHome = System.getProperty("java.home");
|
||||
if(classPathSeperator == ';') {
|
||||
File javaExe = new File(javaHome, "bin/java.exe");
|
||||
if(!javaExe.isFile()) {
|
||||
javaExe = new File(javaHome, "java.exe");
|
||||
if(!javaExe.isFile()) {
|
||||
throw new IOException("Could not find /bin/java.exe equivelant on java.home! (java.home=" + javaHome + ")");
|
||||
}
|
||||
}
|
||||
javaHome = javaExe.getAbsolutePath();
|
||||
}else {
|
||||
File javaExe = new File(javaHome, "bin/java");
|
||||
if(!javaExe.isFile()) {
|
||||
javaExe = new File(javaHome, "java");
|
||||
if(!javaExe.isFile()) {
|
||||
throw new IOException("Could not find /bin/java equivelant on java.home! (java.home=" + javaHome + ")");
|
||||
}
|
||||
}
|
||||
javaHome = javaExe.getAbsolutePath();
|
||||
}
|
||||
|
||||
String[] fullArgs = new String[javaExeArguments.length + 1];
|
||||
fullArgs[0] = javaHome;
|
||||
System.arraycopy(javaExeArguments, 0, fullArgs, 1, javaExeArguments.length);
|
||||
|
||||
ProcessBuilder exec = new ProcessBuilder(fullArgs);
|
||||
exec.directory(directory);
|
||||
|
||||
exec.redirectOutput(Redirect.INHERIT);
|
||||
exec.redirectError(Redirect.INHERIT);
|
||||
|
||||
Process ps = exec.start();
|
||||
|
||||
while(true) {
|
||||
try {
|
||||
return ps.waitFor();
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,185 @@
|
||||
package net.lax1dude.eaglercraft.zip_generator;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
|
||||
public class ZipGenerator {
|
||||
|
||||
public static void main(String[] args) throws IOException {
|
||||
|
||||
System.out.println();
|
||||
System.out.println("Notes:");
|
||||
System.out.println();
|
||||
System.out.println(" - please run \"gradlew teavmc\" on the client and integrated server");
|
||||
System.out.println(" - please run \"epkcompiler/run.bat\" (or run.sh) to generate \"javascript/assets.epk\"");
|
||||
System.out.println(" - compile eaglercraftbungee and put it in it's \"stable-download/java/bungee_command\" folder");
|
||||
System.out.println();
|
||||
|
||||
try {
|
||||
if(!(boolean) Class.forName("net.lax1dude.eaglercraft.v1_8.buildtools.Java11Check").getMethod("classLoadCheck").invoke(null)) {
|
||||
throw new RuntimeException("wtf?");
|
||||
}
|
||||
}catch(Throwable t) {
|
||||
System.err.println("ERROR: A minimum of Java 11 is required to run this tool!");
|
||||
System.err.println();
|
||||
System.err.println("You are using Java " + System.getProperty("java.version"));
|
||||
System.err.println();
|
||||
return;
|
||||
}
|
||||
|
||||
String date = (new SimpleDateFormat("MM/dd/yyyy")).format(new Date());
|
||||
System.out.println("Using date: " + date);
|
||||
|
||||
System.out.println();
|
||||
|
||||
System.out.println("Running closure compiler on 'eagswebrtc.js'...");
|
||||
JARSubprocess.runJava(new File("."), new String[] { "-jar", "zip-generator/google-closure-compiler.jar", "--js", "javascript/eagswebrtc.js",
|
||||
"--js_output_file", "stable-download/web/eagswebrtc.js", "-O", "SIMPLE" }, "[ClosureCompiler]");
|
||||
|
||||
System.out.println("Loading 'javascript/classes.js'");
|
||||
String classesJs = FileUtils.readFileToString(new File("javascript/classes.js"), "UTF-8");
|
||||
|
||||
File f = new File("crash_report_override.txt");
|
||||
if(f.isFile()) {
|
||||
classesJs = classesJs.replace("If this has happened more than once then please copy the text on this screen and publish"
|
||||
+ " it in the issues feed of this fork\\'s GitHub repository.", FileUtils.readFileToString(f, "UTF-8").trim());
|
||||
}
|
||||
|
||||
System.out.println("Loading 'javascript/classes_server.js'");
|
||||
String classesServerJs = FileUtils.readFileToString(new File("javascript/classes_server.js"), "UTF-8").replaceFirst("\\/\\/# sourceMappingURL=.*(\\r\\n|\\r|\\n)*", "").trim();
|
||||
|
||||
System.out.println("Loading 'javascript/assets.epk'");
|
||||
String assetsEpk = Base64.encodeBase64String(FileUtils.readFileToByteArray(new File("javascript/assets.epk")));
|
||||
|
||||
System.out.println("Loading 'stable-download/web/eagswebrtc.js'");
|
||||
String classesWebRTCJs = FileUtils.readFileToString(new File("stable-download/web/eagswebrtc.js"), "UTF-8").replaceFirst("[\\'\\\"]use strict[\\'\\\"]\\;(\\r\\n|\\r|\\n)*", "").trim();
|
||||
|
||||
System.out.println("Loading 'zip-generator/Offline_Download_Version_Template.html'");
|
||||
String offlineTemplate = FileUtils.readFileToString(new File("zip-generator/Offline_Download_Version_Template.html"), "UTF-8");
|
||||
|
||||
System.out.println("Writing 'stable-download/Offline_Download_Version.html'");
|
||||
|
||||
offlineTemplate = offlineTemplate.replace("${date}", date).replace("${assets_epk_base64}", assetsEpk).replace("${classes_js}",
|
||||
classesJs.replaceFirst("\\/\\/# sourceMappingURL=.*(\\r\\n|\\r|\\n)*", "").trim());
|
||||
offlineTemplate = offlineTemplate.replace("${eagswebrtc_js}", classesWebRTCJs).replace("${classes_server_js}", classesServerJs);
|
||||
|
||||
FileUtils.writeStringToFile(new File("stable-download/Offline_Download_Version.html"), offlineTemplate, "UTF-8");
|
||||
|
||||
System.out.println("Writing 'javascript/classes.js' to 'stable-download/web/classes.js'");
|
||||
FileUtils.writeStringToFile(new File("stable-download/web/classes.js"), classesJs, "UTF-8");
|
||||
|
||||
System.out.println("Copying 'javascript/classes.js.map' to 'stable-download/web/classes.js.map'");
|
||||
FileUtils.copyFile(new File("javascript/classes.js.map"), new File("stable-download/web/classes.js.map"));
|
||||
|
||||
System.out.println("Copying 'javascript/classes_server.js' to 'stable-download/web/classes_server.js'");
|
||||
FileUtils.copyFile(new File("javascript/classes_server.js"), new File("stable-download/web/classes_server.js"));
|
||||
|
||||
System.out.println("Copying 'javascript/classes_server.js.map' to 'stable-download/web/classes_server.js.map'");
|
||||
FileUtils.copyFile(new File("javascript/classes_server.js.map"), new File("stable-download/web/classes_server.js.map"));
|
||||
|
||||
System.out.println("Copying 'javascript/assets.epk' to 'stable-download/web/assets.epk'");
|
||||
FileUtils.copyFile(new File("javascript/assets.epk"), new File("stable-download/web/assets.epk"));
|
||||
|
||||
System.out.println("Copying 'javascript/worker_bootstrap.js' to 'stable-download/web/worker_bootstrap.js'");
|
||||
FileUtils.copyFile(new File("javascript/worker_bootstrap.js"), new File("stable-download/web/worker_bootstrap.js"));
|
||||
|
||||
System.out.println("Writing 'stable-download/stable-download.zip'");
|
||||
|
||||
ZipOutputStream zOut = new ZipOutputStream(new FileOutputStream(new File("stable-download/stable-download.zip")));
|
||||
zOut.setLevel(9);
|
||||
|
||||
zipFolder(zOut, "web", new File("stable-download/web"));
|
||||
zipFolder(zOut, "java", new File("stable-download/java"));
|
||||
|
||||
zOut.close();
|
||||
|
||||
System.out.println("Writing 'stable-download/stable-download_repl.zip'");
|
||||
|
||||
zOut = new ZipOutputStream(new FileOutputStream(new File("stable-download/stable-download_repl.zip")));
|
||||
zOut.setLevel(9);
|
||||
|
||||
zipFolder(zOut, "web", new File("stable-download/web"), "web/classes.js", "web/classes_server.js",
|
||||
"web/worker_bootstrap.js", "web/eagswebrtc.js", "web/index.html", "web/classes.js.map",
|
||||
"web/classes_server.js.map");
|
||||
|
||||
zipFolder(zOut, "java", new File("stable-download/java"));
|
||||
|
||||
zOut.putNextEntry(new ZipEntry("web/classes.js"));
|
||||
IOUtils.write(classesJs + "\n" + classesWebRTCJs, zOut, "UTF-8");
|
||||
|
||||
if(classesServerJs.startsWith("\"use strict\";")) {
|
||||
classesServerJs = classesServerJs.substring(13).trim();
|
||||
}
|
||||
|
||||
zOut.putNextEntry(new ZipEntry("web/worker_bootstrap.js"));
|
||||
IOUtils.write(FileUtils.readFileToString(new File("zip-generator/repl_worker_bootstrap.js"), "UTF-8")
|
||||
.replace("${classes_server}", classesServerJs), zOut, "UTF-8");
|
||||
|
||||
zOut.putNextEntry(new ZipEntry("web/index.html"));
|
||||
IOUtils.write(FileUtils.readFileToByteArray(new File("zip-generator/repl_index.html")), zOut);
|
||||
|
||||
zOut.close();
|
||||
|
||||
System.out.println("Writing 'stable-download/stable-download_livestream.zip'");
|
||||
|
||||
zOut = new ZipOutputStream(new FileOutputStream(new File("stable-download/stable-download_livestream.zip")));
|
||||
zOut.setLevel(9);
|
||||
|
||||
zipFolder(zOut, "web", new File("stable-download/web"), "web/index.html");
|
||||
zipFolder(zOut, "java", new File("stable-download/java"));
|
||||
|
||||
zOut.putNextEntry(new ZipEntry("web/index.html"));
|
||||
IOUtils.write(FileUtils.readFileToByteArray(new File("zip-generator/livestream_index.html")), zOut);
|
||||
|
||||
zOut.close();
|
||||
|
||||
}
|
||||
|
||||
private static void zipFolder(ZipOutputStream zOut, String pfx, File file, String... exclude) throws IOException {
|
||||
zipFolder0(zOut, file.getAbsolutePath().replace('\\', '/'), pfx, file, exclude);
|
||||
}
|
||||
|
||||
private static void zipFolder0(ZipOutputStream zOut, String pfx, String writePfx, File file, String... exclude) throws IOException {
|
||||
for(File f : file.listFiles()) {
|
||||
if(f.isDirectory()) {
|
||||
zipFolder0(zOut, pfx, writePfx, f);
|
||||
}else if(f.isFile()) {
|
||||
String path = f.getAbsolutePath().replace('\\', '/').replace(pfx, "");
|
||||
if(path.startsWith("/")) {
|
||||
path = path.substring(1);
|
||||
}
|
||||
if(writePfx.length() > 0 && !writePfx.endsWith("/")) {
|
||||
writePfx = writePfx + "/";
|
||||
}
|
||||
path = writePfx + path;
|
||||
if(!shouldExclude(path, exclude)) {
|
||||
zipFile(zOut, path, f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void zipFile(ZipOutputStream zOut, String name, File file) throws IOException {
|
||||
zOut.putNextEntry(new ZipEntry(name));
|
||||
IOUtils.write(FileUtils.readFileToByteArray(file), zOut);
|
||||
}
|
||||
|
||||
private static boolean shouldExclude(String name, String... exclude) {
|
||||
for(int i = 0; i < exclude.length; ++i) {
|
||||
if(exclude[i].equalsIgnoreCase(name)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
BIN
zip-generator/zipGenerator.jar
Executable file
BIN
zip-generator/zipGenerator.jar
Executable file
Binary file not shown.
Reference in New Issue
Block a user