mirror of
https://github.com/eaglerforge/EaglerForgeInjector
synced 2025-07-23 06:01:38 -09:00
add enchantment keygen
This commit is contained in:
parent
e3c7d474c5
commit
3979d7e0ce
@ -571,6 +571,24 @@ const modapi_postinit = "(" + (() => {
|
||||
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 wrapped = ModAPI.util.wrap(outputValue, target, corrective, true);
|
||||
if (wrapped) {
|
||||
@ -1197,7 +1215,9 @@ const modapi_postinit = "(" + (() => {
|
||||
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
|
||||
if (arr.length >= interval) {
|
||||
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);
|
||||
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() + ")();";
|
||||
|
||||
if (globalThis.process) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user