Skip to content

Commit

Permalink
Make ChatComponentMixin smaller
Browse files Browse the repository at this point in the history
  • Loading branch information
tr7zw committed Aug 1, 2024
1 parent fb7cab2 commit d4eb427
Showing 1 changed file with 4 additions and 73 deletions.
77 changes: 4 additions & 73 deletions src/main/java/dev/tr7zw/exordium/mixin/ChatComponentMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import net.minecraft.client.gui.components.ChatComponent;

@Mixin(ChatComponent.class)
public class ChatComponentMixin implements ChatAccess {
public abstract class ChatComponentMixin implements ChatAccess {

@Getter
@Final
Expand All @@ -21,90 +21,21 @@ public class ChatComponentMixin implements ChatAccess {
@Shadow
private int chatScrollbarPos;

// @Unique
// private int lastScrollbarPos = 0;
// @Unique
// private int messageCount = 0;
// @Unique
// private boolean wasFocused = false;
// @Unique
// private GuiMessage.Line lastMessage = null;
//
// @Unique
// boolean outdated = false;
//
// @Unique
// private final BufferedComponent chatBufferedComponent = new BufferedComponent(
// () -> ExordiumModBase.instance.config.chatSettings) {
//
// @Override
// public boolean shouldRenderNextCappedFrame() {
// return outdated;
// }
//
// @Override
// public void captureState() {
// lastMessage = trimmedMessages.isEmpty() ? null : trimmedMessages.get(0);
// lastScrollbarPos = chatScrollbarPos;
// messageCount = trimmedMessages.size();
// wasFocused = isChatFocused();
// }
// };
//
// @Unique
// public boolean hasChanged(int i) {
// GuiMessage.Line msg = trimmedMessages.isEmpty() ? null : trimmedMessages.get(0);
// boolean changed = chatScrollbarPos != lastScrollbarPos || messageCount != trimmedMessages.size()
// || isChatFocused() != wasFocused || msg != lastMessage;
// if (changed) {
// return true;
// }
// int j = getLinesPerPage();
// for (int o = 0; o + this.chatScrollbarPos < this.trimmedMessages.size() && o < j; o++) {
// GuiMessage.Line guiMessage = this.trimmedMessages.get(o + this.chatScrollbarPos);
// if (guiMessage != null) {
// int p = i - guiMessage.addedTime();
// if (p > 170 && p < 200) { // 180 is correct, add a tiny buffer for the frame to catch up
// return true;
// }
// }
// }
// return false;
// }
//
// public void updateState(int tickCount) {
// outdated = hasChanged(tickCount);
// }

@Override
public int getChatScollbarPos() {
return chatScrollbarPos;
}

@Override
@Shadow
public boolean isChatFocused() {
// TODO Auto-generated method stub
return false;
}
public abstract boolean isChatFocused();

@Override
@Shadow
public boolean isChatHidden() {
// TODO Auto-generated method stub
return false;
}
public abstract boolean isChatHidden();

@Override
@Shadow
public int getLinesPerPage() {
// TODO Auto-generated method stub
return 0;
}

// @Override
// public BufferedComponent getChatOverlayBuffer() {
// return chatBufferedComponent;
// }
public abstract int getLinesPerPage();

}

0 comments on commit d4eb427

Please sign in to comment.