aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/raeids/stratus/mixin
diff options
context:
space:
mode:
authorWyvest <45589059+Wyvest@users.noreply.github.com>2021-12-22 11:15:36 +0700
committerWyvest <45589059+Wyvest@users.noreply.github.com>2021-12-22 11:15:36 +0700
commit136710660fbcf27e33a53723024203b2a7b25dae (patch)
tree1bceaea8957cee74b768413adee92e498146f120 /src/main/java/com/raeids/stratus/mixin
parentc84baaa1586da7aafdd3d3ddf2dcd3543b2444a2 (diff)
downloadChatting-136710660fbcf27e33a53723024203b2a7b25dae.tar.gz
Chatting-136710660fbcf27e33a53723024203b2a7b25dae.tar.bz2
Chatting-136710660fbcf27e33a53723024203b2a7b25dae.zip
fix chat message copying with patcher
Diffstat (limited to 'src/main/java/com/raeids/stratus/mixin')
-rw-r--r--src/main/java/com/raeids/stratus/mixin/GuiIngameForgeMixin.java13
-rw-r--r--src/main/java/com/raeids/stratus/mixin/GuiNewChatMixin.java11
2 files changed, 13 insertions, 11 deletions
diff --git a/src/main/java/com/raeids/stratus/mixin/GuiIngameForgeMixin.java b/src/main/java/com/raeids/stratus/mixin/GuiIngameForgeMixin.java
index 3c500f5..1e09a8f 100644
--- a/src/main/java/com/raeids/stratus/mixin/GuiIngameForgeMixin.java
+++ b/src/main/java/com/raeids/stratus/mixin/GuiIngameForgeMixin.java
@@ -1,21 +1,20 @@
package com.raeids.stratus.mixin;
import com.raeids.stratus.hook.GuiIngameForgeHook;
-import net.minecraft.client.renderer.GlStateManager;
import net.minecraftforge.client.GuiIngameForge;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
-import org.spongepowered.asm.mixin.injection.Redirect;
+import org.spongepowered.asm.mixin.injection.ModifyArgs;
+import org.spongepowered.asm.mixin.injection.invoke.arg.Args;
@Mixin(value = GuiIngameForge.class, remap = false)
public class GuiIngameForgeMixin implements GuiIngameForgeHook {
private int stratus$x = 0;
private int stratus$y = 0;
- @Redirect(method = "renderChat", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/GlStateManager;translate(FFF)V", remap = true))
- private void captureTranslate(float x, float y, float z) {
- stratus$x = Math.round(x);
- stratus$y = Math.round(y);
- GlStateManager.translate(x, y, z);
+ @ModifyArgs(method = "renderChat", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/GlStateManager;translate(FFF)V", remap = true))
+ private void captureTranslate(Args args) {
+ stratus$x = Math.round(args.get(0));
+ stratus$y = Math.round(args.get(1));
}
@Override
diff --git a/src/main/java/com/raeids/stratus/mixin/GuiNewChatMixin.java b/src/main/java/com/raeids/stratus/mixin/GuiNewChatMixin.java
index 5def2e5..2f4a13a 100644
--- a/src/main/java/com/raeids/stratus/mixin/GuiNewChatMixin.java
+++ b/src/main/java/com/raeids/stratus/mixin/GuiNewChatMixin.java
@@ -21,6 +21,7 @@ import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.*;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
+import org.spongepowered.asm.mixin.injection.invoke.arg.Args;
import java.util.List;
@@ -68,10 +69,12 @@ public abstract class GuiNewChatMixin extends Gui implements GuiNewChatHook {
: linesToDraw;
}
- //TODO: fix with patcher
- @Redirect(method = "drawChat", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiNewChat;drawRect(IIIII)V"), slice = @Slice(from = @At(value = "INVOKE", target = "Lnet/minecraft/util/MathHelper;clamp_double(DDD)D"), to = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/GlStateManager;enableBlend()V")))
- private void captureDrawRect(int left, int top, int right, int bottom, int color) {
- drawRect(left, top, right, bottom, color);
+ @ModifyArgs(method = "drawChat", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiNewChat;drawRect(IIIII)V"), slice = @Slice(from = @At(value = "INVOKE", target = "Lnet/minecraft/util/MathHelper;clamp_double(DDD)D"), to = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/GlStateManager;enableBlend()V")))
+ private void captureDrawRect(Args args) {
+ int left = args.get(0);
+ int top = args.get(1);
+ int right = args.get(2);
+ int bottom = args.get(3);
if (mc.currentScreen instanceof GuiChat) {
final int k1 = Mouse.getX() * UResolution.getScaledWidth() / this.mc.displayWidth;
final int l1 = UResolution.getScaledHeight() - Mouse.getY() * UResolution.getScaledHeight() / this.mc.displayHeight - 1;