-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
27 additions
and
0 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
src/main/java/com/aetherteam/cumulus/mixin/mixins/client/MusicManagerMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.aetherteam.cumulus.mixin.mixins.client; | ||
|
||
import com.aetherteam.cumulus.client.CumulusClient; | ||
import net.minecraft.client.Minecraft; | ||
import net.minecraft.client.sounds.MusicManager; | ||
import net.minecraft.sounds.Music; | ||
import net.minecraft.sounds.Musics; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.ModifyVariable; | ||
|
||
@Mixin(MusicManager.class) | ||
public class MusicManagerMixin { | ||
/** | ||
* This mixin modifies the return of {@link Minecraft#getSituationalMusic()} as it is given to the music variable in {@link MusicManager}. | ||
* @param music The original {@link Music} variable. | ||
* @return The modified {@link Music} variable. | ||
*/ | ||
@ModifyVariable(method = "tick()V", at = @At(value = "STORE")) | ||
public Music injected(Music music) { | ||
if (music == Musics.MENU && CumulusClient.MENU_HELPER.getActiveMusic() != null) { | ||
return CumulusClient.MENU_HELPER.getActiveMusic(); | ||
} | ||
return music; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters