mirror of
https://github.com/eaglerforge/EaglerForgeInjector
synced 2025-07-24 14:41:18 -09:00
almost done with postinit
This commit is contained in:
parent
8aa7937382
commit
8c1ae93040
@ -891,13 +891,17 @@ globalThis.modapi_postinit = "(" + (() => {
|
|||||||
|
|
||||||
ModAPI.events.newEvent("bootstrap", "server");
|
ModAPI.events.newEvent("bootstrap", "server");
|
||||||
ModAPI.events.newEvent("prebootstrap", "server");
|
ModAPI.events.newEvent("prebootstrap", "server");
|
||||||
|
const bootstrapClass = ModAPI.reflect.getClassById("net.minecraft.init.Bootstrap");
|
||||||
const originalBootstrap = ModAPI.hooks.methods[ModAPI.util.getMethodFromPackage("net.minecraft.init.Bootstrap", "register")];
|
const originalBootstrap = ModAPI.hooks.methods[ModAPI.util.getMethodFromPackage("net.minecraft.init.Bootstrap", "register")];
|
||||||
ModAPI.hooks.methods[ModAPI.util.getMethodFromPackage("net.minecraft.init.Bootstrap", "register")] = function (...args) {
|
ModAPI.hooks.methods[ModAPI.util.getMethodFromPackage("net.minecraft.init.Bootstrap", "register")] = function (...args) {
|
||||||
|
if (bootstrapClass.staticVariables.alreadyRegistered) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
ModAPI.events.callEvent("prebootstrap", {});
|
ModAPI.events.callEvent("prebootstrap", {});
|
||||||
var x = originalBootstrap.apply(this, args);
|
var x = originalBootstrap.apply(this, args);
|
||||||
ModAPI.util.bootstrap();
|
ModAPI.util.bootstrap();
|
||||||
ModAPI.events.callEvent("bootstrap", {});
|
|
||||||
console.log("[ModAPI] Hooked into bootstrap. .blocks, .items, .materials and .enchantments are now accessible.");
|
console.log("[ModAPI] Hooked into bootstrap. .blocks, .items, .materials and .enchantments are now accessible.");
|
||||||
|
ModAPI.events.callEvent("bootstrap", {});
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user