FIX PITCH - MAKE IT NOT SOUND OUT OF TUNE

This commit is contained in:
Chayapak 2023-10-15 15:21:14 +07:00
parent 81178ffe53
commit 3bab11c263

View file

@ -394,18 +394,16 @@ public class MusicPlayerPlugin extends Bot.Listener {
final boolean shouldCustomPitch = currentSong.nbs ? final boolean shouldCustomPitch = currentSong.nbs ?
isMoreOrLessOctave : isMoreOrLessOctave :
note.pitch != note.shiftedPitch || note.pitch != note.shiftedPitch ||
note.shiftedInstrument != note.instrument; note.shiftedInstrument != note.instrument;E
final boolean isBass = note.instrument == Instrument.BASS; final double volume = (note.instrument == Instrument.BASS ? note.volume * 1.5 : note.volume);
final double volume = (isBass ? note.volume * 1.2 : note.volume);
if (shouldCustomPitch) { if (shouldCustomPitch) {
bot.core.run( bot.core.run(
"minecraft:execute as " + "minecraft:execute as " +
CUSTOM_PITCH_SELECTOR + CUSTOM_PITCH_SELECTOR +
" at @s run playsound " + " at @s run playsound " +
(!instrument.equals("off") ? instrument : note.instrument.sound) + ".pitch." + (isBass ? notShiftedFloatingPitch - 1.5 : notShiftedFloatingPitch) + (!instrument.equals("off") ? instrument : note.instrument.sound) + ".pitch." + notShiftedFloatingPitch +
" record @s ^" + blockPosition.getX() + " ^" + blockPosition.getY() + " ^" + blockPosition.getZ() + " " + " record @s ^" + blockPosition.getX() + " ^" + blockPosition.getY() + " ^" + blockPosition.getZ() + " " +
volume + volume +
" " + " " +
@ -431,7 +429,7 @@ public class MusicPlayerPlugin extends Bot.Listener {
" record @s ^" + blockPosition.getX() + " ^" + blockPosition.getY() + " ^" + blockPosition.getZ() + " " + " record @s ^" + blockPosition.getX() + " ^" + blockPosition.getY() + " ^" + blockPosition.getZ() + " " +
volume + volume +
" " + " " +
MathUtilities.clamp((isBass ? floatingPitch - 0.5 : floatingPitch), 0, 2) MathUtilities.clamp(floatingPitch, 0, 2)
); );
} }