add music amplifier + mabe NBS fix a bit
This commit is contained in:
parent
e56b6533a1
commit
4667f60739
3 changed files with 35 additions and 12 deletions
|
@ -49,6 +49,7 @@ public class MusicCommand extends Command {
|
||||||
"goto <timestamp>",
|
"goto <timestamp>",
|
||||||
"pitch <pitch>",
|
"pitch <pitch>",
|
||||||
"speed <speed>",
|
"speed <speed>",
|
||||||
|
"amplify <amplification>",
|
||||||
"noteinstrument <instrument>",
|
"noteinstrument <instrument>",
|
||||||
"pause",
|
"pause",
|
||||||
"resume",
|
"resume",
|
||||||
|
@ -82,6 +83,7 @@ public class MusicCommand extends Command {
|
||||||
case "goto" -> goTo(context);
|
case "goto" -> goTo(context);
|
||||||
case "pitch" -> pitch(context);
|
case "pitch" -> pitch(context);
|
||||||
case "speed" -> speed(context);
|
case "speed" -> speed(context);
|
||||||
|
case "amplify" -> amplify(context);
|
||||||
case "noteinstrument" -> noteInstrument(context);
|
case "noteinstrument" -> noteInstrument(context);
|
||||||
case "pause", "resume" -> pause(context);
|
case "pause", "resume" -> pause(context);
|
||||||
case "info" -> info(context);
|
case "info" -> info(context);
|
||||||
|
@ -395,6 +397,21 @@ public class MusicCommand extends Command {
|
||||||
.color(ColorUtilities.getColorByString(bot.config.colorPalette.defaultColor));
|
.color(ColorUtilities.getColorByString(bot.config.colorPalette.defaultColor));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Component amplify(CommandContext context) throws CommandException {
|
||||||
|
final Bot bot = context.bot;
|
||||||
|
|
||||||
|
final int amplify = context.getInteger(true);
|
||||||
|
|
||||||
|
if (amplify > 8) throw new CommandException(Component.text("Too big value"));
|
||||||
|
|
||||||
|
bot.music.amplify = amplify;
|
||||||
|
|
||||||
|
return Component.empty()
|
||||||
|
.append(Component.text("Set the amplification to "))
|
||||||
|
.append(Component.text(amplify).color(ColorUtilities.getColorByString(bot.config.colorPalette.number)))
|
||||||
|
.color(ColorUtilities.getColorByString(bot.config.colorPalette.defaultColor));
|
||||||
|
}
|
||||||
|
|
||||||
public Component noteInstrument (CommandContext context) throws CommandException {
|
public Component noteInstrument (CommandContext context) throws CommandException {
|
||||||
final Bot bot = context.bot;
|
final Bot bot = context.bot;
|
||||||
|
|
||||||
|
|
|
@ -49,6 +49,7 @@ public class MusicPlayerPlugin extends Bot.Listener {
|
||||||
// sus nightcore stuff,..,.,.
|
// sus nightcore stuff,..,.,.
|
||||||
public float pitch = 0;
|
public float pitch = 0;
|
||||||
public float speed = 1;
|
public float speed = 1;
|
||||||
|
public int amplify = 1;
|
||||||
|
|
||||||
public String instrument = "off";
|
public String instrument = "off";
|
||||||
|
|
||||||
|
@ -355,6 +356,7 @@ public class MusicPlayerPlugin extends Bot.Listener {
|
||||||
|
|
||||||
floatingPitch = Math.pow(2.0, ((key + (pitch / 10)) - 12) / 12.0);
|
floatingPitch = Math.pow(2.0, ((key + (pitch / 10)) - 12) / 12.0);
|
||||||
|
|
||||||
|
for (int i = 0; i < amplify; i++) {
|
||||||
bot.core.run(
|
bot.core.run(
|
||||||
"minecraft:execute as " +
|
"minecraft:execute as " +
|
||||||
(isMoreOrLessOctave ? SELECTOR : BOTH_SELECTOR) +
|
(isMoreOrLessOctave ? SELECTOR : BOTH_SELECTOR) +
|
||||||
|
@ -365,6 +367,7 @@ public class MusicPlayerPlugin extends Bot.Listener {
|
||||||
" " +
|
" " +
|
||||||
MathUtilities.clamp(floatingPitch, 0, 2)
|
MathUtilities.clamp(floatingPitch, 0, 2)
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
notesPerSecond++;
|
notesPerSecond++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -197,6 +197,9 @@ public class NBSConverter implements Converter {
|
||||||
} else if (name.toLowerCase().contains("door close") || name.toLowerCase().contains("door open")) {
|
} else if (name.toLowerCase().contains("door close") || name.toLowerCase().contains("door open")) {
|
||||||
name = "block.wooden_door.open";
|
name = "block.wooden_door.open";
|
||||||
replaced = true;
|
replaced = true;
|
||||||
|
} else if (name.toLowerCase().contains("anvil")) {
|
||||||
|
name = "block.anvil.fall";
|
||||||
|
replaced = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!sounds.contains(name) && !sounds.contains(file) && !replaced) {
|
if (!sounds.contains(name) && !sounds.contains(file) && !replaced) {
|
||||||
|
@ -205,7 +208,7 @@ public class NBSConverter implements Converter {
|
||||||
|
|
||||||
final List<String> outputTitles = LevenshteinUtilities.searchTitles(name, subtitles.values());
|
final List<String> outputTitles = LevenshteinUtilities.searchTitles(name, subtitles.values());
|
||||||
|
|
||||||
final String bestMatch = outputTitles.size() == 0 ? "" : outputTitles.get(0);
|
final String bestMatch = outputTitles.isEmpty() ? "" : outputTitles.get(0);
|
||||||
|
|
||||||
for (Map.Entry<String, String> entry : subtitles.entrySet()) {
|
for (Map.Entry<String, String> entry : subtitles.entrySet()) {
|
||||||
if (!entry.getValue().equals(bestMatch)) continue;
|
if (!entry.getValue().equals(bestMatch)) continue;
|
||||||
|
@ -220,7 +223,7 @@ public class NBSConverter implements Converter {
|
||||||
|
|
||||||
instrument = Instrument.of(name);
|
instrument = Instrument.of(name);
|
||||||
|
|
||||||
key += note.key + customInstrument.pitch;
|
key += note.key + (customInstrument.pitch / 100);
|
||||||
key -= 45 + (note.pitch / 100);
|
key -= 45 + (note.pitch / 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue