blob: 48e252594249d05d6d7d5197c33b8396d1372248 (
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
42
43
44
45
46
47
48
49
|
package com.raeids.stratus.mixin;
import com.raeids.stratus.Stratus;
import com.raeids.stratus.hook.ChatHookKt;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ChatLine;
import net.minecraft.client.gui.GuiNewChat;
import org.spongepowered.asm.lib.Opcodes;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.ModifyVariable;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import java.util.List;
@Mixin(GuiNewChat.class)
public class GuiNewChatMixin {
@Shadow @Final private Minecraft mc;
@Inject(method = "drawChat", at = @At("HEAD"))
private void checkScreenshotKeybind(int j2, CallbackInfo ci) {
if (Stratus.INSTANCE.getKeybind().isPressed()) {
Stratus.INSTANCE.setDoTheThing(true);
}
}
@ModifyVariable(method = "drawChat", at = @At("HEAD"), argsOnly = true)
private int setUpdateCounterWhjenYes(int updateCounter) {
return Stratus.INSTANCE.getDoTheThing() ? 0 : updateCounter;
}
@ModifyVariable(method = "drawChat", at = @At("STORE"), index = 2)
private int setChatLimitWhenYes(int linesToDraw) {
return Stratus.INSTANCE.getDoTheThing()
? GuiNewChat.calculateChatboxHeight(mc.gameSettings.chatHeightFocused) / 9
: linesToDraw;
}
@Shadow @Final private List<ChatLine> drawnChatLines;
@Redirect(method = "drawChat", at = @At(value = "FIELD", target = "Lnet/minecraft/client/gui/GuiNewChat;drawnChatLines:Ljava/util/List;", opcode = Opcodes.GETFIELD))
private List<ChatLine> injected(GuiNewChat instance) {
return ChatHookKt.filterMessages(drawnChatLines);
}
}
|