diff --git a/pom.xml b/pom.xml
index 51280cc..eab63b8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
de.gerrygames
viarewind-legacy-support
- 1.3.0
+ 1.3.1
jar
@@ -42,7 +42,7 @@
us.myles
viaversion
- 1.3.0
+ 2.1.1
provided
@@ -67,5 +67,4 @@
-
\ No newline at end of file
diff --git a/src/main/java/de/gerrygames/viarewind/legacysupport/listener/SoundListener.java b/src/main/java/de/gerrygames/viarewind/legacysupport/listener/SoundListener.java
index 6829b4a..b6eef37 100644
--- a/src/main/java/de/gerrygames/viarewind/legacysupport/listener/SoundListener.java
+++ b/src/main/java/de/gerrygames/viarewind/legacysupport/listener/SoundListener.java
@@ -101,16 +101,26 @@ public class SoundListener implements Listener {
Object nmsBlock = getBlock.invoke(blockData);
Method getStepSound;
try {
- getStepSound = nmsBlock.getClass().getMethod("getStepSound");
+ getStepSound = nmsBlock.getClass().getMethod("getStepSound", blockData.getClass());
} catch (NoSuchMethodException ex) {
- getStepSound = nmsBlock.getClass().getMethod("w");
+ try {
+ getStepSound = nmsBlock.getClass().getMethod("getStepSound");
+ } catch (NoSuchMethodError ex2) {
+ getStepSound = nmsBlock.getClass().getMethod("w");
+ }
+ }
+
+ Object soundType;
+ if (getStepSound.getParameterCount() == 0) {
+ soundType = getStepSound.invoke(nmsBlock);
+ } else {
+ soundType = getStepSound.invoke(nmsBlock, blockData);
}
- Object soundType = getStepSound.invoke(nmsBlock);
Object soundEffect = soundType.getClass().getMethod("e").invoke(soundType);
float volume = (float) soundType.getClass().getMethod("a").invoke(soundType);
float pitch = (float) soundType.getClass().getMethod("b").invoke(soundType);
- Object soundCategory = Enum.class.getMethod("valueOf", Class.class, String.class).invoke(null, NMSReflection.getNMSClass("SoundCategory"), "BLOCKS");
+ Object soundCategory = Enum.valueOf(NMSReflection.getNMSClass("SoundCategory"), "BLOCKS");
volume = (volume + 1.0f) / 2.0f;
pitch *= 0.8;