blob: b8239d3bdd49ac387518d4aaa0f31eed72bb82ea (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
package moe.nea.ultranotifier.mixin;
import moe.nea.ultranotifier.ChatLineAddedEvent;
import moe.nea.ultranotifier.UltraNotifierEvents;
import net.minecraft.client.gui.hud.ChatHud;
//#if MC > 11404
import net.minecraft.client.gui.hud.MessageIndicator;
import net.minecraft.network.message.MessageSignatureData;
//#endif
import net.minecraft.text.Text;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(
ChatHud.class
)
public class ChatHudMessageAdded {
@Inject(
//#if MC <= 11404
//$$ method = "printChatMessageWithOptionalDeletion",
//#else
method = "addMessage(Lnet/minecraft/text/Text;Lnet/minecraft/network/message/MessageSignatureData;Lnet/minecraft/client/gui/hud/MessageIndicator;)V",
//#endif
at = @At("HEAD"), cancellable = true)
private void onAddMessage(
Text message,
//#if MC <= 11404
//$$ int chatLineId,
//#else
MessageSignatureData signatureData, MessageIndicator indicator,
//#endif
CallbackInfo ci
) {
if (UltraNotifierEvents.post(new ChatLineAddedEvent()).isCancelled()) {
ci.cancel();
}
}
}
|