Add beta modloader
This commit is contained in:
parent
e718d15439
commit
8241f79d98
2
CREDITS
2
CREDITS
|
@ -28,7 +28,7 @@
|
|||
|
||||
ZXMushroom63:
|
||||
|
||||
- Wrote the plugin system and API
|
||||
- Wrote the plugin system, API and GUI
|
||||
- Added a skip button for the start screen!!!!!!!!!!! Wow!
|
||||
|
||||
EaglercraftX Developers
|
||||
|
|
|
@ -185,7 +185,8 @@
|
|||
"net.minecraft.client.entity.EntityOtherPlayerMP",
|
||||
"net.minecraft.client.entity.AbstractClientPlayer",
|
||||
"net.minecraft.init.Blocks",
|
||||
"net.minecraft.init.Items"
|
||||
"net.minecraft.init.Items",
|
||||
"me.otterdev.UwUAPI"
|
||||
],
|
||||
"imports": ["java.lang.String", "java.util.Calendar", "net.minecraft.world.WorldSettings.GameType"],
|
||||
"managerFile": "net.eaglerforge.reflect.PLReflect",
|
||||
|
|
|
@ -1,5 +1,11 @@
|
|||
function promisifyIDBRequest(request) {
|
||||
return new Promise((resolve, reject) => {
|
||||
request.onsuccess = () => resolve(request.result);
|
||||
request.onerror = () => reject(request.error);
|
||||
});
|
||||
}
|
||||
function loadLoader() {
|
||||
window.ModLoader = function ModLoader(ModsArr) {
|
||||
window.ModLoader = async function ModLoader(ModsArr) {
|
||||
if (!window.eaglerMLoaderMainRun) {
|
||||
var searchParams = new URLSearchParams(location.search);
|
||||
searchParams.getAll("Mod").forEach((ModToAdd) => {
|
||||
|
@ -16,11 +22,71 @@ function loadLoader() {
|
|||
eaglercraftXOpts.Mods.forEach((ModToAdd) => {
|
||||
console.log(
|
||||
"EaglerML: Adding Mod to loadlist from eaglercraftXOpts: " +
|
||||
ModToAdd
|
||||
ModToAdd
|
||||
);
|
||||
ModsArr.push(ModToAdd);
|
||||
});
|
||||
}
|
||||
|
||||
//Reverse engineer eaglercraftx virtual file system to gain external access to mod store WITHOUT messing with java teavm nonsense
|
||||
var StoreId = null;
|
||||
var decoder = new TextDecoder("utf-8");
|
||||
console.log("EaglerML: Searching in iDB");
|
||||
try {
|
||||
var dbs = await indexedDB.databases();
|
||||
for (let i=0; i<dbs.length; i++) {
|
||||
const db = dbs[i];
|
||||
if (db.name.endsWith("resourcePacks")) {
|
||||
StoreId = db.name;
|
||||
if (StoreId) {
|
||||
var database = await promisifyIDBRequest(indexedDB.open(StoreId));
|
||||
var storeIsValid = !!database.objectStoreNames[0];
|
||||
if (!storeIsValid) {
|
||||
break;
|
||||
}
|
||||
var key = database.objectStoreNames[0].length === 0 ? "filesystem" : database.objectStoreNames[0];
|
||||
var transaction = database.transaction([key], "readwrite");
|
||||
var objectStore = transaction.objectStore("filesystem");
|
||||
var object = await promisifyIDBRequest(objectStore.get(["mods.txt"]));
|
||||
if (!object) {
|
||||
break;
|
||||
}
|
||||
var mods = decoder.decode(object.data);
|
||||
if (mods.length === 0) {
|
||||
break;
|
||||
}
|
||||
var modsArr = mods.split("|");
|
||||
for (var modFilePath of modsArr) {
|
||||
if (modFilePath.length === 0) {
|
||||
break;
|
||||
}
|
||||
var modUrl = null;
|
||||
if (modFilePath.startsWith("web@")) {
|
||||
modUrl = modFilePath.replace("web@", "");
|
||||
} else {
|
||||
var modFile = await promisifyIDBRequest(objectStore.get(["mods/" + modFilePath]));
|
||||
if (!modFile) {
|
||||
break;
|
||||
}
|
||||
var modData = decoder.decode(modFile.data);
|
||||
var modBlob = new Blob([modData], {
|
||||
type: 'text/javascript'
|
||||
});
|
||||
modUrl = URL.createObjectURL(modBlob);
|
||||
}
|
||||
if (!modUrl) {
|
||||
break;
|
||||
}
|
||||
ModsArr.push(modUrl);
|
||||
console.log("Loaded iDB mod: "+modFilePath);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
|
||||
window.eaglerMLoaderMainRun = true;
|
||||
}
|
||||
if (window.noLoadMods === true) {
|
||||
|
@ -29,9 +95,9 @@ function loadLoader() {
|
|||
function checkModsLoaded(totalLoaded, identifier) {
|
||||
console.log(
|
||||
"EaglerML: Checking if Mods are finished :: " +
|
||||
totalLoaded +
|
||||
"/" +
|
||||
ModsArr.length
|
||||
totalLoaded +
|
||||
"/" +
|
||||
ModsArr.length
|
||||
);
|
||||
if (totalLoaded >= ModsArr.length) {
|
||||
clearInterval(identifier);
|
||||
|
@ -127,7 +193,7 @@ function loadLoader() {
|
|||
console.log(
|
||||
"EaglerML: Starting to load " + ModsArr.length + " Mods..."
|
||||
);
|
||||
window.returntotalloadedmods = function returntotalloadedmods(){
|
||||
window.returnTotalLoadedMods = function returnTotalLoadedMods() {
|
||||
return totalLoaded
|
||||
}
|
||||
};
|
||||
|
|
|
@ -160,8 +160,14 @@ function initAPI(version) {
|
|||
}
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
function promisifyIDBRequest(request) {
|
||||
return new Promise((resolve, reject) => {
|
||||
request.onsuccess = () => resolve(request.result);
|
||||
request.onerror = () => reject(request.error);
|
||||
});
|
||||
}
|
||||
function loadLoader() {
|
||||
window.ModLoader = function ModLoader(ModsArr) {
|
||||
window.ModLoader = async function ModLoader(ModsArr) {
|
||||
if (!window.eaglerMLoaderMainRun) {
|
||||
var searchParams = new URLSearchParams(location.search);
|
||||
searchParams.getAll("Mod").forEach((ModToAdd) => {
|
||||
|
@ -178,11 +184,71 @@ function loadLoader() {
|
|||
eaglercraftXOpts.Mods.forEach((ModToAdd) => {
|
||||
console.log(
|
||||
"EaglerML: Adding Mod to loadlist from eaglercraftXOpts: " +
|
||||
ModToAdd
|
||||
ModToAdd
|
||||
);
|
||||
ModsArr.push(ModToAdd);
|
||||
});
|
||||
}
|
||||
|
||||
//Reverse engineer eaglercraftx virtual file system to gain external access to mod store WITHOUT messing with java teavm nonsense
|
||||
var StoreId = null;
|
||||
var decoder = new TextDecoder("utf-8");
|
||||
console.log("EaglerML: Searching in iDB");
|
||||
try {
|
||||
var dbs = await indexedDB.databases();
|
||||
for (let i=0; i<dbs.length; i++) {
|
||||
const db = dbs[i];
|
||||
if (db.name.endsWith("resourcePacks")) {
|
||||
StoreId = db.name;
|
||||
if (StoreId) {
|
||||
var database = await promisifyIDBRequest(indexedDB.open(StoreId));
|
||||
var storeIsValid = !!database.objectStoreNames[0];
|
||||
if (!storeIsValid) {
|
||||
break;
|
||||
}
|
||||
var key = database.objectStoreNames[0].length === 0 ? "filesystem" : database.objectStoreNames[0];
|
||||
var transaction = database.transaction([key], "readwrite");
|
||||
var objectStore = transaction.objectStore("filesystem");
|
||||
var object = await promisifyIDBRequest(objectStore.get(["mods.txt"]));
|
||||
if (!object) {
|
||||
break;
|
||||
}
|
||||
var mods = decoder.decode(object.data);
|
||||
if (mods.length === 0) {
|
||||
break;
|
||||
}
|
||||
var modsArr = mods.split("|");
|
||||
for (var modFilePath of modsArr) {
|
||||
if (modFilePath.length === 0) {
|
||||
break;
|
||||
}
|
||||
var modUrl = null;
|
||||
if (modFilePath.startsWith("web@")) {
|
||||
modUrl = modFilePath.replace("web@", "");
|
||||
} else {
|
||||
var modFile = await promisifyIDBRequest(objectStore.get(["mods/" + modFilePath]));
|
||||
if (!modFile) {
|
||||
break;
|
||||
}
|
||||
var modData = decoder.decode(modFile.data);
|
||||
var modBlob = new Blob([modData], {
|
||||
type: 'text/javascript'
|
||||
});
|
||||
modUrl = URL.createObjectURL(modBlob);
|
||||
}
|
||||
if (!modUrl) {
|
||||
break;
|
||||
}
|
||||
ModsArr.push(modUrl);
|
||||
console.log("Loaded iDB mod: "+modFilePath);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
|
||||
window.eaglerMLoaderMainRun = true;
|
||||
}
|
||||
if (window.noLoadMods === true) {
|
||||
|
@ -191,9 +257,9 @@ function loadLoader() {
|
|||
function checkModsLoaded(totalLoaded, identifier) {
|
||||
console.log(
|
||||
"EaglerML: Checking if Mods are finished :: " +
|
||||
totalLoaded +
|
||||
"/" +
|
||||
ModsArr.length
|
||||
totalLoaded +
|
||||
"/" +
|
||||
ModsArr.length
|
||||
);
|
||||
if (totalLoaded >= ModsArr.length) {
|
||||
clearInterval(identifier);
|
||||
|
@ -289,7 +355,7 @@ function loadLoader() {
|
|||
console.log(
|
||||
"EaglerML: Starting to load " + ModsArr.length + " Mods..."
|
||||
);
|
||||
window.returntotalloadedmods = function returntotalloadedmods(){
|
||||
window.returnTotalLoadedMods = function returnTotalLoadedMods() {
|
||||
return totalLoaded
|
||||
}
|
||||
};
|
||||
|
|
|
@ -135,8 +135,14 @@ function initAPI(version) {
|
|||
}
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
function promisifyIDBRequest(request) {
|
||||
return new Promise((resolve, reject) => {
|
||||
request.onsuccess = () => resolve(request.result);
|
||||
request.onerror = () => reject(request.error);
|
||||
});
|
||||
}
|
||||
function loadLoader() {
|
||||
window.ModLoader = function ModLoader(ModsArr) {
|
||||
window.ModLoader = async function ModLoader(ModsArr) {
|
||||
if (!window.eaglerMLoaderMainRun) {
|
||||
var searchParams = new URLSearchParams(location.search);
|
||||
searchParams.getAll("Mod").forEach((ModToAdd) => {
|
||||
|
@ -153,11 +159,71 @@ function loadLoader() {
|
|||
eaglercraftXOpts.Mods.forEach((ModToAdd) => {
|
||||
console.log(
|
||||
"EaglerML: Adding Mod to loadlist from eaglercraftXOpts: " +
|
||||
ModToAdd
|
||||
ModToAdd
|
||||
);
|
||||
ModsArr.push(ModToAdd);
|
||||
});
|
||||
}
|
||||
|
||||
//Reverse engineer eaglercraftx virtual file system to gain external access to mod store WITHOUT messing with java teavm nonsense
|
||||
var StoreId = null;
|
||||
var decoder = new TextDecoder("utf-8");
|
||||
console.log("EaglerML: Searching in iDB");
|
||||
try {
|
||||
var dbs = await indexedDB.databases();
|
||||
for (let i=0; i<dbs.length; i++) {
|
||||
const db = dbs[i];
|
||||
if (db.name.endsWith("resourcePacks")) {
|
||||
StoreId = db.name;
|
||||
if (StoreId) {
|
||||
var database = await promisifyIDBRequest(indexedDB.open(StoreId));
|
||||
var storeIsValid = !!database.objectStoreNames[0];
|
||||
if (!storeIsValid) {
|
||||
break;
|
||||
}
|
||||
var key = database.objectStoreNames[0].length === 0 ? "filesystem" : database.objectStoreNames[0];
|
||||
var transaction = database.transaction([key], "readwrite");
|
||||
var objectStore = transaction.objectStore("filesystem");
|
||||
var object = await promisifyIDBRequest(objectStore.get(["mods.txt"]));
|
||||
if (!object) {
|
||||
break;
|
||||
}
|
||||
var mods = decoder.decode(object.data);
|
||||
if (mods.length === 0) {
|
||||
break;
|
||||
}
|
||||
var modsArr = mods.split("|");
|
||||
for (var modFilePath of modsArr) {
|
||||
if (modFilePath.length === 0) {
|
||||
break;
|
||||
}
|
||||
var modUrl = null;
|
||||
if (modFilePath.startsWith("web@")) {
|
||||
modUrl = modFilePath.replace("web@", "");
|
||||
} else {
|
||||
var modFile = await promisifyIDBRequest(objectStore.get(["mods/" + modFilePath]));
|
||||
if (!modFile) {
|
||||
break;
|
||||
}
|
||||
var modData = decoder.decode(modFile.data);
|
||||
var modBlob = new Blob([modData], {
|
||||
type: 'text/javascript'
|
||||
});
|
||||
modUrl = URL.createObjectURL(modBlob);
|
||||
}
|
||||
if (!modUrl) {
|
||||
break;
|
||||
}
|
||||
ModsArr.push(modUrl);
|
||||
console.log("Loaded iDB mod: "+modFilePath);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
|
||||
window.eaglerMLoaderMainRun = true;
|
||||
}
|
||||
if (window.noLoadMods === true) {
|
||||
|
@ -166,9 +232,9 @@ function loadLoader() {
|
|||
function checkModsLoaded(totalLoaded, identifier) {
|
||||
console.log(
|
||||
"EaglerML: Checking if Mods are finished :: " +
|
||||
totalLoaded +
|
||||
"/" +
|
||||
ModsArr.length
|
||||
totalLoaded +
|
||||
"/" +
|
||||
ModsArr.length
|
||||
);
|
||||
if (totalLoaded >= ModsArr.length) {
|
||||
clearInterval(identifier);
|
||||
|
@ -264,7 +330,7 @@ function loadLoader() {
|
|||
console.log(
|
||||
"EaglerML: Starting to load " + ModsArr.length + " Mods..."
|
||||
);
|
||||
window.returntotalloadedmods = function returntotalloadedmods(){
|
||||
window.returnTotalLoadedMods = function returnTotalLoadedMods() {
|
||||
return totalLoaded
|
||||
}
|
||||
};
|
||||
|
|
|
@ -135,8 +135,14 @@ function initAPI(version) {
|
|||
}
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
function promisifyIDBRequest(request) {
|
||||
return new Promise((resolve, reject) => {
|
||||
request.onsuccess = () => resolve(request.result);
|
||||
request.onerror = () => reject(request.error);
|
||||
});
|
||||
}
|
||||
function loadLoader() {
|
||||
window.ModLoader = function ModLoader(ModsArr) {
|
||||
window.ModLoader = async function ModLoader(ModsArr) {
|
||||
if (!window.eaglerMLoaderMainRun) {
|
||||
var searchParams = new URLSearchParams(location.search);
|
||||
searchParams.getAll("Mod").forEach((ModToAdd) => {
|
||||
|
@ -153,11 +159,71 @@ function loadLoader() {
|
|||
eaglercraftXOpts.Mods.forEach((ModToAdd) => {
|
||||
console.log(
|
||||
"EaglerML: Adding Mod to loadlist from eaglercraftXOpts: " +
|
||||
ModToAdd
|
||||
ModToAdd
|
||||
);
|
||||
ModsArr.push(ModToAdd);
|
||||
});
|
||||
}
|
||||
|
||||
//Reverse engineer eaglercraftx virtual file system to gain external access to mod store WITHOUT messing with java teavm nonsense
|
||||
var StoreId = null;
|
||||
var decoder = new TextDecoder("utf-8");
|
||||
console.log("EaglerML: Searching in iDB");
|
||||
try {
|
||||
var dbs = await indexedDB.databases();
|
||||
for (let i=0; i<dbs.length; i++) {
|
||||
const db = dbs[i];
|
||||
if (db.name.endsWith("resourcePacks")) {
|
||||
StoreId = db.name;
|
||||
if (StoreId) {
|
||||
var database = await promisifyIDBRequest(indexedDB.open(StoreId));
|
||||
var storeIsValid = !!database.objectStoreNames[0];
|
||||
if (!storeIsValid) {
|
||||
break;
|
||||
}
|
||||
var key = database.objectStoreNames[0].length === 0 ? "filesystem" : database.objectStoreNames[0];
|
||||
var transaction = database.transaction([key], "readwrite");
|
||||
var objectStore = transaction.objectStore("filesystem");
|
||||
var object = await promisifyIDBRequest(objectStore.get(["mods.txt"]));
|
||||
if (!object) {
|
||||
break;
|
||||
}
|
||||
var mods = decoder.decode(object.data);
|
||||
if (mods.length === 0) {
|
||||
break;
|
||||
}
|
||||
var modsArr = mods.split("|");
|
||||
for (var modFilePath of modsArr) {
|
||||
if (modFilePath.length === 0) {
|
||||
break;
|
||||
}
|
||||
var modUrl = null;
|
||||
if (modFilePath.startsWith("web@")) {
|
||||
modUrl = modFilePath.replace("web@", "");
|
||||
} else {
|
||||
var modFile = await promisifyIDBRequest(objectStore.get(["mods/" + modFilePath]));
|
||||
if (!modFile) {
|
||||
break;
|
||||
}
|
||||
var modData = decoder.decode(modFile.data);
|
||||
var modBlob = new Blob([modData], {
|
||||
type: 'text/javascript'
|
||||
});
|
||||
modUrl = URL.createObjectURL(modBlob);
|
||||
}
|
||||
if (!modUrl) {
|
||||
break;
|
||||
}
|
||||
ModsArr.push(modUrl);
|
||||
console.log("Loaded iDB mod: "+modFilePath);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
|
||||
window.eaglerMLoaderMainRun = true;
|
||||
}
|
||||
if (window.noLoadMods === true) {
|
||||
|
@ -166,9 +232,9 @@ function loadLoader() {
|
|||
function checkModsLoaded(totalLoaded, identifier) {
|
||||
console.log(
|
||||
"EaglerML: Checking if Mods are finished :: " +
|
||||
totalLoaded +
|
||||
"/" +
|
||||
ModsArr.length
|
||||
totalLoaded +
|
||||
"/" +
|
||||
ModsArr.length
|
||||
);
|
||||
if (totalLoaded >= ModsArr.length) {
|
||||
clearInterval(identifier);
|
||||
|
@ -264,7 +330,7 @@ function loadLoader() {
|
|||
console.log(
|
||||
"EaglerML: Starting to load " + ModsArr.length + " Mods..."
|
||||
);
|
||||
window.returntotalloadedmods = function returntotalloadedmods(){
|
||||
window.returnTotalLoadedMods = function returnTotalLoadedMods() {
|
||||
return totalLoaded
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue