Skip to content

Commit

Permalink
Fixed bug where the skip key was not function with certain settings
Browse files Browse the repository at this point in the history
  • Loading branch information
AliahX committed Jun 9, 2023
1 parent c9c59bf commit 520a326
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/main/java/com/aliahx/mixtape/mixin/SoundSystemMixin.java
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
package com.aliahx.mixtape.mixin;

import com.google.common.collect.Multimap;
import net.minecraft.client.sound.*;
import net.minecraft.sound.SoundCategory;
import net.minecraft.util.Identifier;
import org.jetbrains.annotations.Nullable;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

import java.util.Map;

Expand Down Expand Up @@ -38,9 +40,11 @@ private void updateSoundVolume(SoundCategory category, float volume, CallbackInf
}

@Inject(at = @At("HEAD"), method = "stopSounds", cancellable = true)
public void stopSoundsMixin(CallbackInfo ci) {
if(config.mainConfig.enabled && config.mainConfig.stopMusicWhenLeftGame) {
ci.cancel();
public void stopSoundsMixin(@Nullable Identifier id, @Nullable SoundCategory category, CallbackInfo ci) {
if(!(id == null && category == SoundCategory.MUSIC)) {
if (config.mainConfig.enabled && config.mainConfig.stopMusicWhenLeftGame) {
ci.cancel();
}
}
}
}

0 comments on commit 520a326

Please sign in to comment.