mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
Swap pitch and volume for warden heartbeat
This commit is contained in:
parent
2e3e7c6949
commit
3ac2c981a7
3 changed files with 13 additions and 7 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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() {
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue