17 lines
678 B
Java
17 lines
678 B
Java
package io.gitlab.jfronny.googlechat.client.mixin;
|
|
|
|
import io.gitlab.jfronny.googlechat.GoogleChat;
|
|
import net.minecraft.client.network.ClientPlayerEntity;
|
|
import net.minecraft.text.Text;
|
|
import org.spongepowered.asm.mixin.Mixin;
|
|
import org.spongepowered.asm.mixin.injection.At;
|
|
import org.spongepowered.asm.mixin.injection.ModifyVariable;
|
|
|
|
@Mixin(ClientPlayerEntity.class)
|
|
public class ClientPlayerEntityMixin {
|
|
@ModifyVariable(method = "sendMessage(Lnet/minecraft/text/Text;)V", at = @At("HEAD"), argsOnly = true, ordinal = 0)
|
|
Text googlechat$translateMessage(Text source) {
|
|
return GoogleChat.translateIfNeeded(source, GoogleChat.Direction.C2S, true);
|
|
}
|
|
}
|