Add beta modloader
This commit is contained in:
parent
e718d15439
commit
8241f79d98
2
CREDITS
2
CREDITS
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
ZXMushroom63:
|
ZXMushroom63:
|
||||||
|
|
||||||
- Wrote the plugin system and API
|
- Wrote the plugin system, API and GUI
|
||||||
- Added a skip button for the start screen!!!!!!!!!!! Wow!
|
- Added a skip button for the start screen!!!!!!!!!!! Wow!
|
||||||
|
|
||||||
EaglercraftX Developers
|
EaglercraftX Developers
|
||||||
|
|
|
@ -185,7 +185,8 @@
|
||||||
"net.minecraft.client.entity.EntityOtherPlayerMP",
|
"net.minecraft.client.entity.EntityOtherPlayerMP",
|
||||||
"net.minecraft.client.entity.AbstractClientPlayer",
|
"net.minecraft.client.entity.AbstractClientPlayer",
|
||||||
"net.minecraft.init.Blocks",
|
"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"],
|
"imports": ["java.lang.String", "java.util.Calendar", "net.minecraft.world.WorldSettings.GameType"],
|
||||||
"managerFile": "net.eaglerforge.reflect.PLReflect",
|
"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() {
|
function loadLoader() {
|
||||||
window.ModLoader = function ModLoader(ModsArr) {
|
window.ModLoader = async function ModLoader(ModsArr) {
|
||||||
if (!window.eaglerMLoaderMainRun) {
|
if (!window.eaglerMLoaderMainRun) {
|
||||||
var searchParams = new URLSearchParams(location.search);
|
var searchParams = new URLSearchParams(location.search);
|
||||||
searchParams.getAll("Mod").forEach((ModToAdd) => {
|
searchParams.getAll("Mod").forEach((ModToAdd) => {
|
||||||
|
@ -21,6 +27,66 @@ function loadLoader() {
|
||||||
ModsArr.push(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;
|
window.eaglerMLoaderMainRun = true;
|
||||||
}
|
}
|
||||||
if (window.noLoadMods === true) {
|
if (window.noLoadMods === true) {
|
||||||
|
@ -127,7 +193,7 @@ function loadLoader() {
|
||||||
console.log(
|
console.log(
|
||||||
"EaglerML: Starting to load " + ModsArr.length + " Mods..."
|
"EaglerML: Starting to load " + ModsArr.length + " Mods..."
|
||||||
);
|
);
|
||||||
window.returntotalloadedmods = function returntotalloadedmods(){
|
window.returnTotalLoadedMods = function returnTotalLoadedMods() {
|
||||||
return totalLoaded
|
return totalLoaded
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -160,8 +160,14 @@ function initAPI(version) {
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
function promisifyIDBRequest(request) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
request.onsuccess = () => resolve(request.result);
|
||||||
|
request.onerror = () => reject(request.error);
|
||||||
|
});
|
||||||
|
}
|
||||||
function loadLoader() {
|
function loadLoader() {
|
||||||
window.ModLoader = function ModLoader(ModsArr) {
|
window.ModLoader = async function ModLoader(ModsArr) {
|
||||||
if (!window.eaglerMLoaderMainRun) {
|
if (!window.eaglerMLoaderMainRun) {
|
||||||
var searchParams = new URLSearchParams(location.search);
|
var searchParams = new URLSearchParams(location.search);
|
||||||
searchParams.getAll("Mod").forEach((ModToAdd) => {
|
searchParams.getAll("Mod").forEach((ModToAdd) => {
|
||||||
|
@ -183,6 +189,66 @@ function loadLoader() {
|
||||||
ModsArr.push(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;
|
window.eaglerMLoaderMainRun = true;
|
||||||
}
|
}
|
||||||
if (window.noLoadMods === true) {
|
if (window.noLoadMods === true) {
|
||||||
|
@ -289,7 +355,7 @@ function loadLoader() {
|
||||||
console.log(
|
console.log(
|
||||||
"EaglerML: Starting to load " + ModsArr.length + " Mods..."
|
"EaglerML: Starting to load " + ModsArr.length + " Mods..."
|
||||||
);
|
);
|
||||||
window.returntotalloadedmods = function returntotalloadedmods(){
|
window.returnTotalLoadedMods = function returnTotalLoadedMods() {
|
||||||
return totalLoaded
|
return totalLoaded
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -135,8 +135,14 @@ function initAPI(version) {
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
function promisifyIDBRequest(request) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
request.onsuccess = () => resolve(request.result);
|
||||||
|
request.onerror = () => reject(request.error);
|
||||||
|
});
|
||||||
|
}
|
||||||
function loadLoader() {
|
function loadLoader() {
|
||||||
window.ModLoader = function ModLoader(ModsArr) {
|
window.ModLoader = async function ModLoader(ModsArr) {
|
||||||
if (!window.eaglerMLoaderMainRun) {
|
if (!window.eaglerMLoaderMainRun) {
|
||||||
var searchParams = new URLSearchParams(location.search);
|
var searchParams = new URLSearchParams(location.search);
|
||||||
searchParams.getAll("Mod").forEach((ModToAdd) => {
|
searchParams.getAll("Mod").forEach((ModToAdd) => {
|
||||||
|
@ -158,6 +164,66 @@ function loadLoader() {
|
||||||
ModsArr.push(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;
|
window.eaglerMLoaderMainRun = true;
|
||||||
}
|
}
|
||||||
if (window.noLoadMods === true) {
|
if (window.noLoadMods === true) {
|
||||||
|
@ -264,7 +330,7 @@ function loadLoader() {
|
||||||
console.log(
|
console.log(
|
||||||
"EaglerML: Starting to load " + ModsArr.length + " Mods..."
|
"EaglerML: Starting to load " + ModsArr.length + " Mods..."
|
||||||
);
|
);
|
||||||
window.returntotalloadedmods = function returntotalloadedmods(){
|
window.returnTotalLoadedMods = function returnTotalLoadedMods() {
|
||||||
return totalLoaded
|
return totalLoaded
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -135,8 +135,14 @@ function initAPI(version) {
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
function promisifyIDBRequest(request) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
request.onsuccess = () => resolve(request.result);
|
||||||
|
request.onerror = () => reject(request.error);
|
||||||
|
});
|
||||||
|
}
|
||||||
function loadLoader() {
|
function loadLoader() {
|
||||||
window.ModLoader = function ModLoader(ModsArr) {
|
window.ModLoader = async function ModLoader(ModsArr) {
|
||||||
if (!window.eaglerMLoaderMainRun) {
|
if (!window.eaglerMLoaderMainRun) {
|
||||||
var searchParams = new URLSearchParams(location.search);
|
var searchParams = new URLSearchParams(location.search);
|
||||||
searchParams.getAll("Mod").forEach((ModToAdd) => {
|
searchParams.getAll("Mod").forEach((ModToAdd) => {
|
||||||
|
@ -158,6 +164,66 @@ function loadLoader() {
|
||||||
ModsArr.push(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;
|
window.eaglerMLoaderMainRun = true;
|
||||||
}
|
}
|
||||||
if (window.noLoadMods === true) {
|
if (window.noLoadMods === true) {
|
||||||
|
@ -264,7 +330,7 @@ function loadLoader() {
|
||||||
console.log(
|
console.log(
|
||||||
"EaglerML: Starting to load " + ModsArr.length + " Mods..."
|
"EaglerML: Starting to load " + ModsArr.length + " Mods..."
|
||||||
);
|
);
|
||||||
window.returntotalloadedmods = function returntotalloadedmods(){
|
window.returnTotalLoadedMods = function returnTotalLoadedMods() {
|
||||||
return totalLoaded
|
return totalLoaded
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue