only allow sound keygen on 1.12

This commit is contained in:
ZXMushroom63 2025-05-29 16:16:32 +08:00
parent a3189d3d99
commit 2f9edbc381

View File

@ -1249,6 +1249,9 @@ const modapi_postinit = "(" + (() => {
return qhash(entity, values, 127); return qhash(entity, values, 127);
} }
ModAPI.keygen.sound = function (soundId) { ModAPI.keygen.sound = function (soundId) {
if (!ModAPI.is_1_12) {
return -1;
}
const SoundEvent = ModAPI.reflect.getClassByName("SoundEvent") const SoundEvent = ModAPI.reflect.getClassByName("SoundEvent")
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);