9
0
mirror of https://github.com/Xiao-MoMi/craft-engine.git synced 2025-12-30 12:29:15 +00:00

fix(network): 改进声音事件处理

This commit is contained in:
jhqwqmc
2025-04-10 02:40:33 +08:00
parent 55b0bee275
commit 9318034e99
2 changed files with 2 additions and 4 deletions

View File

@@ -1620,9 +1620,7 @@ public class PacketConsumers {
buf.writeVarInt(event.packetID());
buf.writeVarInt(0);
Object newId = KeyUtils.toResourceLocation(mapped);
Object newSoundEvent = VersionHelper.isVersionNewerThan1_21_2() ?
Reflections.constructor$SoundEvent.newInstance(newId, Reflections.field$SoundEvent$fixedRange.get(soundEvent)) :
Reflections.constructor$SoundEvent.newInstance(newId, Reflections.field$SoundEvent$range.get(soundEvent), Reflections.field$SoundEvent$newSystem.get(soundEvent));
Object newSoundEvent = FastNMS.INSTANCE.constructor$SoundEvent(newId, FastNMS.INSTANCE.method$SoundEvent$fixedRange(soundEvent));
FastNMS.INSTANCE.method$SoundEvent$directEncode(buf, newSoundEvent);
buf.writeVarInt(source);
buf.writeInt(x);