Skip to content

Commit

Permalink
Make enabled options for each music category functional
Browse files Browse the repository at this point in the history
  • Loading branch information
AliahX committed Jul 6, 2023
1 parent a9dee71 commit 9812244
Showing 1 changed file with 30 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,36 @@ private static void musicMixin(SoundEvent sound, CallbackInfoReturnable<Position
yield 100f;
}
};

SoundEvent sound2 = SoundEvents.INTENTIONALLY_EMPTY;
switch (sound.getId().toString()) {
case "minecraft:music.menu" -> {
if (!config.menu.enabled) sound = sound2;
}
case "minecraft:music.creative" -> {
if (!config.creative.enabled) sound = sound2;
}
case "minecraft:music.end" -> {
if (!config.end.enabled) sound = sound2;
}
case "minecraft:music.under_water" -> {
if (!config.underwater.enabled) sound = sound2;
}
case "minecraft:music.credits" -> {
if (!config.credits.enabled) sound = sound2;
}
case "minecraft:music.game" -> {
if (!config.game.enabled) sound = sound2;
}
default -> {
if (sound.getId().toString().contains("overworld")) {
if (!config.game.enabled) sound = sound2;
} else if (sound.getId().toString().contains("nether")) {
if (!config.nether.enabled) sound = sound2;
}
}
}

long note = config.main.varyPitch ? new Random().nextLong((config.main.maxNoteChange - config.main.minNoteChange) + 1) + config.main.minNoteChange : 0;
cir.setReturnValue(new PositionedSoundInstance(sound.getId(), SoundCategory.MUSIC, volume / 100, (float) Math.pow(2.0D, (double) (note) / 12.0D), SoundInstance.createRandom(), false, 0, SoundInstance.AttenuationType.NONE, 0.0D, 0.0D, 0.0D, false));
}
Expand Down

0 comments on commit 9812244

Please sign in to comment.