mirror of
https://github.com/ViaVersion/ViaRewind-Legacy-Support.git
synced 2025-01-09 19:17:34 +01:00
fix block place sounds in 1.14.2
This commit is contained in:
parent
b1cef12f46
commit
7ae66a27e4
5
pom.xml
5
pom.xml
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<groupId>de.gerrygames</groupId>
|
<groupId>de.gerrygames</groupId>
|
||||||
<artifactId>viarewind-legacy-support</artifactId>
|
<artifactId>viarewind-legacy-support</artifactId>
|
||||||
<version>1.3.0</version>
|
<version>1.3.1</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
@ -42,7 +42,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>us.myles</groupId>
|
<groupId>us.myles</groupId>
|
||||||
<artifactId>viaversion</artifactId>
|
<artifactId>viaversion</artifactId>
|
||||||
<version>1.3.0</version>
|
<version>2.1.1</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
@ -67,5 +67,4 @@
|
|||||||
</resource>
|
</resource>
|
||||||
</resources>
|
</resources>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
</project>
|
</project>
|
@ -101,16 +101,26 @@ public class SoundListener implements Listener {
|
|||||||
Object nmsBlock = getBlock.invoke(blockData);
|
Object nmsBlock = getBlock.invoke(blockData);
|
||||||
Method getStepSound;
|
Method getStepSound;
|
||||||
try {
|
try {
|
||||||
getStepSound = nmsBlock.getClass().getMethod("getStepSound");
|
getStepSound = nmsBlock.getClass().getMethod("getStepSound", blockData.getClass());
|
||||||
} catch (NoSuchMethodException ex) {
|
} 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);
|
Object soundEffect = soundType.getClass().getMethod("e").invoke(soundType);
|
||||||
float volume = (float) soundType.getClass().getMethod("a").invoke(soundType);
|
float volume = (float) soundType.getClass().getMethod("a").invoke(soundType);
|
||||||
float pitch = (float) soundType.getClass().getMethod("b").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;
|
volume = (volume + 1.0f) / 2.0f;
|
||||||
pitch *= 0.8;
|
pitch *= 0.8;
|
||||||
|
Loading…
Reference in New Issue
Block a user