diff options
author | nea <nea@nea.moe> | 2023-06-09 18:08:38 +0200 |
---|---|---|
committer | nea <nea@nea.moe> | 2023-06-09 18:08:38 +0200 |
commit | 428056ff805839e04443dcff3badd021eb4abe01 (patch) | |
tree | 1dfb5b4dc84bc0884dc319be7f8ad4e949decb81 /src/main/java/moe/nea/firmament/mixins/MixinChatHud.java | |
parent | e7a7b04d8cadbc08d12272e8c59bff711be4d463 (diff) | |
download | firmament-428056ff805839e04443dcff3badd021eb4abe01.tar.gz firmament-428056ff805839e04443dcff3badd021eb4abe01.tar.bz2 firmament-428056ff805839e04443dcff3badd021eb4abe01.zip |
Add support for other mods using /locraw
Diffstat (limited to 'src/main/java/moe/nea/firmament/mixins/MixinChatHud.java')
-rw-r--r-- | src/main/java/moe/nea/firmament/mixins/MixinChatHud.java | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/main/java/moe/nea/firmament/mixins/MixinChatHud.java b/src/main/java/moe/nea/firmament/mixins/MixinChatHud.java new file mode 100644 index 0000000..f0db847 --- /dev/null +++ b/src/main/java/moe/nea/firmament/mixins/MixinChatHud.java @@ -0,0 +1,21 @@ +package moe.nea.firmament.mixins; + +import moe.nea.firmament.events.ClientChatLineReceivedEvent; +import net.minecraft.client.gui.hud.ChatHud; +import net.minecraft.client.gui.hud.MessageIndicator; +import net.minecraft.network.message.MessageSignatureData; +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 MixinChatHud { + @Inject(at = @At("HEAD"), method = "addMessage(Lnet/minecraft/text/Text;Lnet/minecraft/network/message/MessageSignatureData;ILnet/minecraft/client/gui/hud/MessageIndicator;Z)V", cancellable = true) + public void onAddMessage(Text message, MessageSignatureData signature, int ticks, MessageIndicator indicator, boolean refresh, CallbackInfo ci) { + if (ClientChatLineReceivedEvent.Companion.publish(new ClientChatLineReceivedEvent(message)).getCancelled()) { + ci.cancel(); + } + } +} |