|
1
|
|
|
package de.pewpewproject.lasertag.mixin; |
|
2
|
|
|
|
|
3
|
|
|
import net.minecraft.client.sound.MusicTracker; |
|
4
|
|
|
import org.spongepowered.asm.mixin.Mixin; |
|
5
|
|
|
import org.spongepowered.asm.mixin.injection.At; |
|
6
|
|
|
import org.spongepowered.asm.mixin.injection.Inject; |
|
7
|
|
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; |
|
8
|
|
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; |
|
9
|
|
|
|
|
10
|
|
|
/** |
|
11
|
|
|
* Mixin into the MusicTracer class to disable the default minecraft music |
|
12
|
|
|
* |
|
13
|
|
|
* @author Étienne Muser |
|
14
|
|
|
*/ |
|
15
|
|
|
@Mixin(MusicTracker.class) |
|
16
|
|
|
public abstract class MusicTrackerMixin { |
|
17
|
|
|
@Inject(method = "tick()V", at = @At("HEAD"), cancellable = true) |
|
18
|
|
|
private void atTick(CallbackInfo ci) { |
|
19
|
|
|
// Return method immediately |
|
20
|
|
|
ci.cancel(); |
|
21
|
|
|
} |
|
22
|
|
|
|
|
23
|
|
|
@Inject(method = "play(Lnet/minecraft/sound/MusicSound;)V", at = @At("HEAD"), cancellable = true) |
|
24
|
|
|
private void atPlay(CallbackInfo ci) { |
|
25
|
|
|
// Return method immediately |
|
26
|
|
|
ci.cancel(); |
|
27
|
|
|
} |
|
28
|
|
|
|
|
29
|
|
|
@Inject(method = "stop()V", at = @At("HEAD"), cancellable = true) |
|
30
|
|
|
private void atStop(CallbackInfo ci) { |
|
31
|
|
|
// Return method immediately |
|
32
|
|
|
ci.cancel(); |
|
33
|
|
|
} |
|
34
|
|
|
|
|
35
|
|
|
@Inject(method = "isPlayingType(Lnet/minecraft/sound/MusicSound;)Z", at = @At("HEAD"), cancellable = true) |
|
36
|
|
|
private void isPlayingType(CallbackInfoReturnable<Boolean> cir) { |
|
37
|
|
|
// MusicTracker cant play music anymore - immediately return false |
|
38
|
|
|
cir.setReturnValue(false); |
|
39
|
|
|
} |
|
40
|
|
|
} |
|
41
|
|
|
|