Swap pitch and volume for warden heartbeat

This commit is contained in:
Camotoy 2022-06-02 18:57:33 -04:00
parent 2e3e7c6949
commit 3ac2c981a7
No known key found for this signature in database
GPG key ID: 7EEFB66FE798081F
3 changed files with 13 additions and 7 deletions

View file

@ -75,8 +75,8 @@ public class WardenEntity extends MonsterEntity implements Tickable {
PlaySoundPacket packet = new PlaySoundPacket();
packet.setSound("mob.warden.heartbeat");
packet.setPosition(position);
packet.setPitch(1.0f);
packet.setVolume((random.nextFloat() - random.nextFloat()) * 0.2f + 1.0f);
packet.setPitch((random.nextFloat() - random.nextFloat()) * 0.2f + 1.0f);
packet.setVolume(1.0f);
session.sendUpstreamPacket(packet);
}

View file

@ -54,8 +54,9 @@ public class SoundRegistryLoader implements RegistryLoader<String, Map<String, S
while(soundsIterator.hasNext()) {
Map.Entry<String, JsonNode> next = soundsIterator.next();
JsonNode brMap = next.getValue();
soundMappings.put(next.getKey(), new SoundMapping(
next.getKey(),
String javaSound = next.getKey();
soundMappings.put(javaSound, new SoundMapping(
javaSound,
brMap.has("bedrock_mapping") && brMap.get("bedrock_mapping").isTextual() ? brMap.get("bedrock_mapping").asText() : null,
brMap.has("playsound_mapping") && brMap.get("playsound_mapping").isTextual() ? brMap.get("playsound_mapping").asText() : null,
brMap.has("extra_data") && brMap.get("extra_data").isInt() ? brMap.get("extra_data").asInt() : -1,

View file

@ -41,7 +41,9 @@ import org.geysermc.geyser.registry.Registries;
import org.geysermc.geyser.registry.type.SoundMapping;
import org.geysermc.geyser.session.GeyserSession;
public class SoundUtils {
import java.util.Locale;
public final class SoundUtils {
/**
* Maps a sound name to a sound event, null if one
@ -50,9 +52,9 @@ public class SoundUtils {
* @param sound the sound name
* @return a sound event from the given sound
*/
public static SoundEvent toSoundEvent(String sound) {
private static SoundEvent toSoundEvent(String sound) {
try {
return SoundEvent.valueOf(sound.toUpperCase().replace(".", "_"));
return SoundEvent.valueOf(sound.toUpperCase(Locale.ROOT).replace(".", "_"));
} catch (Exception ex) {
return null;
}
@ -161,4 +163,7 @@ public class SoundUtils {
soundPacket.setRelativeVolumeDisabled(false);
session.sendUpstreamPacket(soundPacket);
}
private SoundUtils() {
}
}