Music option
This commit is contained in:
parent
35ed6a05b1
commit
1d95a4c771
2 changed files with 43 additions and 30 deletions
|
@ -5,10 +5,12 @@ import ru.betterend.config.Configs;
|
||||||
public class ClientOptions {
|
public class ClientOptions {
|
||||||
private static boolean customSky;
|
private static boolean customSky;
|
||||||
private static boolean useFogDensity;
|
private static boolean useFogDensity;
|
||||||
|
private static boolean blendBiomeMusic;
|
||||||
|
|
||||||
public static void init() {
|
public static void init() {
|
||||||
setCustomSky(Configs.CLENT_CONFIG.getBooleanRoot("customSky", true));
|
setCustomSky(Configs.CLENT_CONFIG.getBooleanRoot("customSky", true));
|
||||||
setUseFogDensity(Configs.CLENT_CONFIG.getBooleanRoot("useFogDensity", true));
|
setUseFogDensity(Configs.CLENT_CONFIG.getBooleanRoot("useFogDensity", true));
|
||||||
|
setBlendBiomeMusic(Configs.CLENT_CONFIG.getBooleanRoot("blendBiomeMusic", true));
|
||||||
Configs.CLENT_CONFIG.saveChanges();
|
Configs.CLENT_CONFIG.saveChanges();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,4 +29,12 @@ public class ClientOptions {
|
||||||
public static void setUseFogDensity(boolean useFogDensity) {
|
public static void setUseFogDensity(boolean useFogDensity) {
|
||||||
ClientOptions.useFogDensity = useFogDensity;
|
ClientOptions.useFogDensity = useFogDensity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean blendBiomeMusic() {
|
||||||
|
return blendBiomeMusic;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setBlendBiomeMusic(boolean blendBiomeMusic) {
|
||||||
|
ClientOptions.blendBiomeMusic = blendBiomeMusic;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,7 @@ import net.minecraft.client.sound.SoundInstance;
|
||||||
import net.minecraft.sound.MusicSound;
|
import net.minecraft.sound.MusicSound;
|
||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
import ru.betterend.client.ClientOptions;
|
||||||
|
|
||||||
@Mixin(MusicTracker.class)
|
@Mixin(MusicTracker.class)
|
||||||
public class MusicTrackerMixin {
|
public class MusicTrackerMixin {
|
||||||
|
@ -39,6 +40,7 @@ public class MusicTrackerMixin {
|
||||||
|
|
||||||
@Inject(method = "tick", at = @At("HEAD"), cancellable = true)
|
@Inject(method = "tick", at = @At("HEAD"), cancellable = true)
|
||||||
public void beOnTick(CallbackInfo info) {
|
public void beOnTick(CallbackInfo info) {
|
||||||
|
if (ClientOptions.blendBiomeMusic()) {
|
||||||
MusicSound musicSound = client.getMusicType();
|
MusicSound musicSound = client.getMusicType();
|
||||||
if (volume > 0 && beIsInEnd() && beShouldChangeSound(musicSound)) {
|
if (volume > 0 && beIsInEnd() && beShouldChangeSound(musicSound)) {
|
||||||
if (volume > 0) {
|
if (volume > 0) {
|
||||||
|
@ -77,6 +79,7 @@ public class MusicTrackerMixin {
|
||||||
volume = 1;
|
volume = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private boolean beIsInEnd() {
|
private boolean beIsInEnd() {
|
||||||
return client.world != null && client.world.getRegistryKey().equals(World.END);
|
return client.world != null && client.world.getRegistryKey().equals(World.END);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue