aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/raeids/stratus/mixin
diff options
context:
space:
mode:
authorWyvest <45589059+Wyvest@users.noreply.github.com>2021-12-26 19:42:24 +0700
committerWyvest <45589059+Wyvest@users.noreply.github.com>2021-12-26 19:42:24 +0700
commit641e50e9c509981df6a7d3fb5a29ff7e3dbe4d47 (patch)
treeb9f429d0e9e73f9f2ad0f6597e3da4683fdb663d /src/main/java/com/raeids/stratus/mixin
parent913ab61c3637833e445669ad252a72b9d6e5947d (diff)
downloadChatting-641e50e9c509981df6a7d3fb5a29ff7e3dbe4d47.tar.gz
Chatting-641e50e9c509981df6a7d3fb5a29ff7e3dbe4d47.tar.bz2
Chatting-641e50e9c509981df6a7d3fb5a29ff7e3dbe4d47.zip
enabled (real)
Diffstat (limited to 'src/main/java/com/raeids/stratus/mixin')
-rw-r--r--src/main/java/com/raeids/stratus/mixin/ClientCommandHandlerMixin.java2
-rw-r--r--src/main/java/com/raeids/stratus/mixin/EntityPlayerSPMixin.java2
-rw-r--r--src/main/java/com/raeids/stratus/mixin/GuiChatMixin.java19
-rw-r--r--src/main/java/com/raeids/stratus/mixin/GuiNewChatAccessor.java2
-rw-r--r--src/main/java/com/raeids/stratus/mixin/GuiNewChatMixin.java22
5 files changed, 26 insertions, 21 deletions
diff --git a/src/main/java/com/raeids/stratus/mixin/ClientCommandHandlerMixin.java b/src/main/java/com/raeids/stratus/mixin/ClientCommandHandlerMixin.java
index 3082b88..ecdef69 100644
--- a/src/main/java/com/raeids/stratus/mixin/ClientCommandHandlerMixin.java
+++ b/src/main/java/com/raeids/stratus/mixin/ClientCommandHandlerMixin.java
@@ -1,7 +1,7 @@
package com.raeids.stratus.mixin;
import com.raeids.stratus.config.StratusConfig;
-import com.raeids.stratus.hook.ChatShortcuts;
+import com.raeids.stratus.chat.ChatShortcuts;
import kotlin.Pair;
import net.minecraft.client.Minecraft;
import net.minecraft.command.CommandHandler;
diff --git a/src/main/java/com/raeids/stratus/mixin/EntityPlayerSPMixin.java b/src/main/java/com/raeids/stratus/mixin/EntityPlayerSPMixin.java
index 44ef05d..c605511 100644
--- a/src/main/java/com/raeids/stratus/mixin/EntityPlayerSPMixin.java
+++ b/src/main/java/com/raeids/stratus/mixin/EntityPlayerSPMixin.java
@@ -1,7 +1,7 @@
package com.raeids.stratus.mixin;
import com.raeids.stratus.config.StratusConfig;
-import com.raeids.stratus.hook.ChatTabs;
+import com.raeids.stratus.chat.ChatTabs;
import net.minecraft.client.entity.EntityPlayerSP;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
diff --git a/src/main/java/com/raeids/stratus/mixin/GuiChatMixin.java b/src/main/java/com/raeids/stratus/mixin/GuiChatMixin.java
index 37fb0f3..bf0ac79 100644
--- a/src/main/java/com/raeids/stratus/mixin/GuiChatMixin.java
+++ b/src/main/java/com/raeids/stratus/mixin/GuiChatMixin.java
@@ -1,9 +1,12 @@
package com.raeids.stratus.mixin;
import com.google.common.collect.Lists;
-import com.raeids.stratus.Stratus;
+import com.raeids.stratus.chat.*;
import com.raeids.stratus.config.StratusConfig;
+import com.raeids.stratus.gui.components.ScreenshotButton;
+import com.raeids.stratus.gui.components.SearchButton;
import com.raeids.stratus.hook.*;
+import com.raeids.stratus.utils.ModCompatHooks;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiChat;
import net.minecraft.client.gui.GuiScreen;
@@ -36,17 +39,15 @@ public abstract class GuiChatMixin extends GuiScreen {
"\u00A73\u00A7l\u00A7nModifiers",
"\u00A7lALT\u00A7r - Formatting Codes");
- private CleanSearchButton searchButton;
- private ScreenshotButton screenshotButton;
+ private SearchButton searchButton;
@Inject(method = "initGui", at = @At("TAIL"))
private void init(CallbackInfo ci) {
if (StratusConfig.INSTANCE.getChatSearch()) {
- searchButton = new CleanSearchButton();
+ searchButton = new SearchButton();
buttonList.add(searchButton);
}
- screenshotButton = new ScreenshotButton();
- buttonList.add(screenshotButton);
+ buttonList.add(new ScreenshotButton());
if (StratusConfig.INSTANCE.getChatTabs()) {
for (ChatTab chatTab : ChatTabs.INSTANCE.getTabs()) {
buttonList.add(chatTab.getButton());
@@ -70,7 +71,7 @@ public abstract class GuiChatMixin extends GuiScreen {
return;
}
searchButton.getInputField().textboxKeyTyped(typedChar, keyCode);
- ChatSearchingKt.setPrevText(searchButton.getInputField().getText());
+ ChatSearchingManager.setPrevText(searchButton.getInputField().getText());
}
}
@@ -79,7 +80,7 @@ public abstract class GuiChatMixin extends GuiScreen {
GuiNewChatHook hook = ((GuiNewChatHook) Minecraft.getMinecraft().ingameGUI.getChatGUI());
float f = mc.ingameGUI.getChatGUI().getChatScale();
int x = MathHelper.floor_float((float) mouseX / f);
- if (hook.shouldCopy() && (hook.getRight() + (Stratus.INSTANCE.isBetterChat() ? ModCompatHooks.getXOffset() : 0)) <= x && (hook.getRight() + (Stratus.INSTANCE.isBetterChat() ? ModCompatHooks.getXOffset() : 0)) + 9 > x) {
+ if (hook.shouldCopy() && (hook.getRight() + ModCompatHooks.getXOffset()) <= x && (hook.getRight() + ModCompatHooks.getXOffset()) + 9 > x) {
GuiUtils.drawHoveringText(COPY_TOOLTIP, mouseX, mouseY, width, height, -1, fontRendererObj);
GlStateManager.disableLighting();
}
@@ -90,7 +91,7 @@ public abstract class GuiChatMixin extends GuiScreen {
GuiNewChatHook hook = ((GuiNewChatHook) Minecraft.getMinecraft().ingameGUI.getChatGUI());
float f = mc.ingameGUI.getChatGUI().getChatScale();
int x = MathHelper.floor_float((float) mouseX / f);
- if (hook.shouldCopy() && (hook.getRight() + (Stratus.INSTANCE.isBetterChat() ? ModCompatHooks.getXOffset() : 0)) <= x && (hook.getRight() + (Stratus.INSTANCE.isBetterChat() ? ModCompatHooks.getXOffset() : 0)) + 9 > x) {
+ if (hook.shouldCopy() && (hook.getRight() + ModCompatHooks.getXOffset()) <= x && (hook.getRight() + ModCompatHooks.getXOffset()) + 9 > x) {
Transferable message = hook.getStratusChatComponent(Mouse.getY());
if (message == null) return;
try {
diff --git a/src/main/java/com/raeids/stratus/mixin/GuiNewChatAccessor.java b/src/main/java/com/raeids/stratus/mixin/GuiNewChatAccessor.java
index 9b68d48..43d4288 100644
--- a/src/main/java/com/raeids/stratus/mixin/GuiNewChatAccessor.java
+++ b/src/main/java/com/raeids/stratus/mixin/GuiNewChatAccessor.java
@@ -7,7 +7,7 @@ import org.spongepowered.asm.mixin.gen.Accessor;
import java.util.List;
-@Mixin (GuiNewChat.class)
+@Mixin(GuiNewChat.class)
public interface GuiNewChatAccessor {
@Accessor
List<ChatLine> getDrawnChatLines();
diff --git a/src/main/java/com/raeids/stratus/mixin/GuiNewChatMixin.java b/src/main/java/com/raeids/stratus/mixin/GuiNewChatMixin.java
index 09c464b..06e25be 100644
--- a/src/main/java/com/raeids/stratus/mixin/GuiNewChatMixin.java
+++ b/src/main/java/com/raeids/stratus/mixin/GuiNewChatMixin.java
@@ -1,11 +1,11 @@
package com.raeids.stratus.mixin;
import com.raeids.stratus.Stratus;
+import com.raeids.stratus.chat.ChatSearchingManager;
+import com.raeids.stratus.chat.ChatTabs;
+import com.raeids.stratus.utils.ModCompatHooks;
import com.raeids.stratus.config.StratusConfig;
-import com.raeids.stratus.hook.ChatSearchingKt;
-import com.raeids.stratus.hook.ChatTabs;
import com.raeids.stratus.hook.GuiNewChatHook;
-import com.raeids.stratus.hook.ModCompatHooks;
import com.raeids.stratus.utils.RenderHelper;
import gg.essential.universal.UMouse;
import net.minecraft.client.Minecraft;
@@ -28,6 +28,7 @@ import java.awt.datatransfer.StringSelection;
import java.awt.datatransfer.Transferable;
import java.awt.image.BufferedImage;
import java.util.List;
+import java.util.Locale;
@Mixin(value = GuiNewChat.class, priority = Integer.MIN_VALUE)
public abstract class GuiNewChatMixin extends Gui implements GuiNewChatHook {
@@ -56,11 +57,14 @@ public abstract class GuiNewChatMixin extends Gui implements GuiNewChatHook {
@Inject(method = "printChatMessageWithOptionalDeletion", at = @At("HEAD"), cancellable = true)
private void handlePrintChatMessage(IChatComponent chatComponent, int chatLineId, CallbackInfo ci) {
handleChatTabMessage(chatComponent, chatLineId, mc.ingameGUI.getUpdateCounter(), false, ci);
+ if (!EnumChatFormatting.getTextWithoutFormattingCodes(chatComponent.getUnformattedText()).toLowerCase(Locale.ENGLISH).contains(stratus$previousText.toLowerCase(Locale.ENGLISH))) {
+ percentComplete = 1.0F;
+ }
}
@Inject(method = "setChatLine", at = @At("HEAD"), cancellable = true)
private void handleSetChatLine(IChatComponent chatComponent, int chatLineId, int updateCounter, boolean displayOnly, CallbackInfo ci) {
- ChatSearchingKt.getCache().invalidateAll();
+ ChatSearchingManager.getCache().invalidateAll();
handleChatTabMessage(chatComponent, chatLineId, updateCounter, displayOnly, ci);
}
@@ -93,10 +97,10 @@ public abstract class GuiNewChatMixin extends Gui implements GuiNewChatHook {
if (mc.currentScreen instanceof GuiChat) {
float f = this.getChatScale();
int mouseX = MathHelper.floor_double(UMouse.getScaledX()) - 3;
- int mouseY = MathHelper.floor_double(UMouse.getScaledY()) - 27 + (Stratus.INSTANCE.isBetterChat() ? ModCompatHooks.getYOffset() : 0) - (Stratus.INSTANCE.isPatcher() && ModCompatHooks.getChatPosition() ? 12 : 0);
+ int mouseY = MathHelper.floor_double(UMouse.getScaledY()) - 27 + ModCompatHooks.getYOffset() - ModCompatHooks.getChatPosition();
mouseX = MathHelper.floor_float((float)mouseX / f);
mouseY = -(MathHelper.floor_float((float)mouseY / f)); //WHY DO I NEED TO DO THIS
- if (mouseX >= (left + (Stratus.INSTANCE.isBetterChat() ? ModCompatHooks.getXOffset() : 0)) && mouseY < bottom && mouseX < (right + 9 + (Stratus.INSTANCE.isBetterChat() ? ModCompatHooks.getXOffset() : 0)) && mouseY >= top) {
+ if (mouseX >= (left + ModCompatHooks.getXOffset()) && mouseY < bottom && mouseX < (right + 9 + ModCompatHooks.getXOffset()) && mouseY >= top) {
stratus$shouldCopy = true;
drawCopyChatBox(right, top);
}
@@ -105,7 +109,7 @@ public abstract class GuiNewChatMixin extends Gui implements GuiNewChatHook {
@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 ChatSearchingKt.filterMessages(stratus$previousText, drawnChatLines);
+ return ChatSearchingManager.filterMessages(stratus$previousText, drawnChatLines);
}
@Inject(method = "drawChat", at = @At("RETURN"))
@@ -134,7 +138,7 @@ public abstract class GuiNewChatMixin extends Gui implements GuiNewChatHook {
}
if (!displayOnly) {
chatLines.add(0, new ChatLine(updateCounter, chatComponent, chatLineId));
- while (this.chatLines.size() > (Stratus.INSTANCE.isPatcher() ? 32767 : 100))
+ while (this.chatLines.size() > (100 + ModCompatHooks.getExtendedChatLength()))
{
this.chatLines.remove(this.chatLines.size() - 1);
}
@@ -172,7 +176,7 @@ public abstract class GuiNewChatMixin extends Gui implements GuiNewChatHook {
ScaledResolution scaledresolution = new ScaledResolution(this.mc);
int i = scaledresolution.getScaleFactor();
float f = this.getChatScale();
- int k = mouseY / i - 27 + (Stratus.INSTANCE.isBetterChat() ? ModCompatHooks.getYOffset() : 0) - (Stratus.INSTANCE.isPatcher() && ModCompatHooks.getChatPosition() ? 12 : 0);
+ int k = mouseY / i - 27 + ModCompatHooks.getYOffset() - ModCompatHooks.getChatPosition();
k = MathHelper.floor_float((float) k / f);
if (k >= 0) {