mirror of
https://github.com/ViaVersion/ViaRewind-Legacy-Support.git
synced 2025-02-16 01:02:44 +01:00
fix NoSuchMethodException for SoundEffectType.e()
This commit is contained in:
parent
caaef40060
commit
938b2cd401
@ -117,9 +117,23 @@ public class SoundListener implements Listener {
|
|||||||
soundType = getStepSound.invoke(nmsBlock, blockData);
|
soundType = getStepSound.invoke(nmsBlock, blockData);
|
||||||
}
|
}
|
||||||
|
|
||||||
Object soundEffect = soundType.getClass().getMethod("e").invoke(soundType);
|
Method soundEffectMethod;
|
||||||
float volume = (float) soundType.getClass().getMethod("a").invoke(soundType);
|
Method volumeMethod;
|
||||||
float pitch = (float) soundType.getClass().getMethod("b").invoke(soundType);
|
Method pitchMethod;
|
||||||
|
|
||||||
|
try {
|
||||||
|
soundEffectMethod = soundType.getClass().getMethod("e");
|
||||||
|
volumeMethod = soundType.getClass().getMethod("a");
|
||||||
|
pitchMethod = soundType.getClass().getMethod("b");
|
||||||
|
} catch (NoSuchMethodException ex) {
|
||||||
|
soundEffectMethod = soundType.getClass().getMethod("getPlaceSound");
|
||||||
|
volumeMethod = soundType.getClass().getMethod("getVolume");
|
||||||
|
pitchMethod = soundType.getClass().getMethod("getPitch");
|
||||||
|
}
|
||||||
|
|
||||||
|
Object soundEffect = soundEffectMethod.invoke(soundType);
|
||||||
|
float volume = (float) volumeMethod.invoke(soundType);
|
||||||
|
float pitch = (float) pitchMethod.invoke(soundType);
|
||||||
Object soundCategory = Enum.valueOf(NMSReflection.getNMSClass("SoundCategory"), "BLOCKS");
|
Object soundCategory = Enum.valueOf(NMSReflection.getNMSClass("SoundCategory"), "BLOCKS");
|
||||||
|
|
||||||
volume = (volume + 1.0f) / 2.0f;
|
volume = (volume + 1.0f) / 2.0f;
|
||||||
|
Loading…
Reference in New Issue
Block a user