Skip to content

Commit

Permalink
fix: 一些伪装缺少部分声音
Browse files Browse the repository at this point in the history
fix: 一些伪装的闲置音效音量不正确
  • Loading branch information
MATRIX-feather committed Feb 23, 2024
1 parent e5dda99 commit 835376a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ protected void doSync()
bitMask |= (byte) 0x80;

write(values.GENERAL, bitMask);
write(values.SILENT, true);
//write(values.SILENT, true);
write(values.NO_GRAVITY, !player.hasGravity());
write(values.POSE, nmsPlayer.getPose());
write(values.FROZEN_TICKS, nmsPlayer.getTicksFrozen());
Expand Down
9 changes: 8 additions & 1 deletion src/main/java/xiamomc/morph/misc/DisguiseState.java
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,7 @@ public static class SoundHandler
public Sound ambientSoundSecondary;
private int soundTime;
private double soundFrequency = 0D;
private float soundVolume = 1f;

public void resetSoundTime()
{
Expand Down Expand Up @@ -657,7 +658,12 @@ public void update()
else if (sound != null && random.nextInt((int)(1000 * frequencyScale)) < soundTime)
{
soundTime = -(int)(ambientInterval * frequencyScale);
bindingPlayer.getWorld().playSound(bindingPlayer.getLocation(), sound.name().asString(), soundCategory, 1f, 1f);
bindingPlayer.getWorld().playSound(
bindingPlayer.getLocation(),
sound.name().asString(),
soundCategory,
soundVolume,
1f);
}
}
}
Expand Down Expand Up @@ -687,6 +693,7 @@ public void refreshSounds(EntityType entityType, boolean isBaby)
var sound = soundEvent.sound();
if (sound == null) return;

this.soundVolume = soundEvent.volume();
this.ambientInterval = soundEvent.interval();
var pitch = isBaby ? 1.5F : 1F;

Expand Down

0 comments on commit 835376a

Please sign in to comment.