From a3189d3d99b756e942dfbe8a39bbb26de1556ba9 Mon Sep 17 00:00:00 2001 From: ZXMushroom63 Date: Thu, 29 May 2025 16:16:14 +0800 Subject: [PATCH] add keygen for sound objects in 1.12 --- core/postinit.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/postinit.js b/core/postinit.js index 38e1fea..089dc7d 100644 --- a/core/postinit.js +++ b/core/postinit.js @@ -1248,6 +1248,11 @@ const modapi_postinit = "(" + (() => { } return qhash(entity, values, 127); } + ModAPI.keygen.sound = function (soundId) { + 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); + return qhash(soundId, values, 4095); + } }).toString() + ")();"; if (globalThis.process) {