mirror of
https://github.com/eaglerforge/EaglerForgeInjector
synced 2025-07-24 14:41:18 -09:00
add enchantment keygen
This commit is contained in:
parent
e3c7d474c5
commit
3979d7e0ce
@ -571,6 +571,24 @@ const modapi_postinit = "(" + (() => {
|
|||||||
return target;
|
return target;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (prop === "getCorrective") {
|
||||||
|
return function () {
|
||||||
|
return new Proxy(target, patchProxyConfToCorrective(TeaVMArray_To_Recursive_BaseData_ProxyConf));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (prop === "isCorrective") {
|
||||||
|
return function () {
|
||||||
|
return corrective;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (prop === "reload") {
|
||||||
|
return function () {
|
||||||
|
if (reloadDeprecationWarnings < 10) {
|
||||||
|
console.warn("ModAPI/PluginAPI reload() is obsolete, please stop using it in code.")
|
||||||
|
reloadDeprecationWarnings++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
var outputValue = Reflect.get(target, prop, receiver);
|
var outputValue = Reflect.get(target, prop, receiver);
|
||||||
var wrapped = ModAPI.util.wrap(outputValue, target, corrective, true);
|
var wrapped = ModAPI.util.wrap(outputValue, target, corrective, true);
|
||||||
if (wrapped) {
|
if (wrapped) {
|
||||||
@ -1197,7 +1215,9 @@ const modapi_postinit = "(" + (() => {
|
|||||||
var ArrayAsList = ModAPI.reflect.getClassById("java.util.Arrays$ArrayAsList").class;
|
var ArrayAsList = ModAPI.reflect.getClassById("java.util.Arrays$ArrayAsList").class;
|
||||||
}
|
}
|
||||||
|
|
||||||
function qhash(txt, arr, interval) {
|
ModAPI.util.qhash = function qhash(txt, arr, interval) {
|
||||||
|
arr ||= [];
|
||||||
|
interval ||= 32767;
|
||||||
// var interval = 4095; //used to be 4095 - arr.length, but that increases incompatibility based on load order and other circumstances
|
// var interval = 4095; //used to be 4095 - arr.length, but that increases incompatibility based on load order and other circumstances
|
||||||
if (arr.length >= interval) {
|
if (arr.length >= interval) {
|
||||||
console.error("[ModAPI.keygen] Ran out of IDs while generating for " + txt);
|
console.error("[ModAPI.keygen] Ran out of IDs while generating for " + txt);
|
||||||
@ -1256,6 +1276,15 @@ const modapi_postinit = "(" + (() => {
|
|||||||
const values = ModAPI.util.wrap(SoundEvent.staticVariables.REGISTRY).getCorrective().underlyingIntegerMap.identityMap.elementData.filter(x => !!x).map(y => y.value.value);
|
const values = ModAPI.util.wrap(SoundEvent.staticVariables.REGISTRY).getCorrective().underlyingIntegerMap.identityMap.elementData.filter(x => !!x).map(y => y.value.value);
|
||||||
return qhash(soundId, values, 4095);
|
return qhash(soundId, values, 4095);
|
||||||
}
|
}
|
||||||
|
ModAPI.keygen.enchantment = function (enchantment) {
|
||||||
|
const Enchantment = ModAPI.reflect.getClassByName("Enchantment");
|
||||||
|
if (ModAPI.is_1_12) {
|
||||||
|
const values = ModAPI.util.wrap(Enchantment.staticVariables.REGISTRY).getCorrective().underlyingIntegerMap.identityMap.elementData.filter(x => !!x).map(y => y.value.value);
|
||||||
|
return qhash(enchantment, values, 4095);
|
||||||
|
}
|
||||||
|
const values = ModAPI.util.wrap(Enchantment.staticVariables.enchantmentsList).getCorrective().filter(x => !!x).map(y => y.effectId);
|
||||||
|
return qhash(enchantment, values, 4095);
|
||||||
|
}
|
||||||
}).toString() + ")();";
|
}).toString() + ")();";
|
||||||
|
|
||||||
if (globalThis.process) {
|
if (globalThis.process) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user