Bug fixing and removing unnecessary config options

This commit is contained in:
DarkKronicle committed 2021-10-26 19:34:29 -06:00
1 parent ed019753d9
commit 58bef6ec8d
4 files changed
+78 -38

No files matched your search

+50 -2
View File
@@ -1,3 +1,51 @@
# AdvancedChatModuleTemplate
# AdvancedChatHUD
This repository serves as a way to view use cases of AdvancedChatCore's code, and allow for easy module creation using this repository as a base. To get started clone the project and rename all the necessary files.
AdvancedChatHUD is an overhaul of Minecraft chat HUD adding many new features.
Please submit bugs to the [issue tracker](https://github.com/DarkKronicle/AdvancedChatHUD/issues). Join the [Discord](https://discord.gg/WnaE3uZxDA) for more help!
## Dependencies
[AdvancedChatCore](https://github.com/DarkKronicle/AdvancedChatCore) is required to run the mod.
## Features
Many features to completely change the way how to message in Minecraft.
### Redesigned HUD
- Stripe messages
- Stack messages
- Display player heads *on any server*
- Change padding from top, bottom, left, and right
- Change background color
- Change border color
- Spacing between lines
- Spacing between *separate* messages
- Change fade time
- Change fade type
- Compact or full line backgrounds
- Change scale
- Custom visibilities
- Customize stored amount of lines
- Have multiple chat windows
- Easy resize and different visibility for each chat window
### Chat Tabs
- Send messages with specific content to chat tabs
- Customize the main chat tab
- Add as many chat tabs as you want
- Easily add multiple matches per tab
- Change tab name
- Change specific tabs color
- Change background color
- Change border color
- Show amount of unread messages
- Easily export and share tabs with others
## Credits n' more
Code & Mastermind: DarkKronicle
Language & Proofreading: Chronos22
@@ -262,24 +262,6 @@ public class HudConfigStorage implements IConfigHandler {
)
);
public static final ConfigStorage.SaveableConfig<ConfigBoolean> MORE_TEXT = ConfigStorage.SaveableConfig.fromConfig(
"moreText",
new ConfigBoolean(
translate("moretext"),
false,
translate("info.moretext")
)
);
public static final ConfigStorage.SaveableConfig<ConfigBoolean> SEND_TO_CURRENT_TAB = ConfigStorage.SaveableConfig.fromConfig(
"sendToCurrentTab",
new ConfigBoolean(
translate("sendtocurrenttab"),
false,
translate("info.sendtocurrenttab")
)
);
public static final ImmutableList<ConfigStorage.SaveableConfig<? extends IConfigBase>> OPTIONS = ImmutableList.of(
CHAT_HEADS,
WIDTH,
@@ -302,9 +284,7 @@ public class HudConfigStorage implements IConfigHandler {
HUD_LINE_TYPE,
ALTERNATE_LINES,
SHOW_TIME,
STORED_LINES,
MORE_TEXT,
SEND_TO_CURRENT_TAB
STORED_LINES
);
}
@@ -100,26 +100,28 @@ public class ChatWindow {
.getInstance()
.getMessages();
for (int i = messages.size() - 1; i >= 0; i--) {
addMessage(messages.get(i));
addMessage(messages.get(i), false, false);
}
}
public void addMessage(HudChatMessage message) {
this.addMessage(message, false, false);
this.addMessage(message, false, true);
}
public void addMessage(
HudChatMessage message,
boolean force,
boolean updateCreation
boolean setTicks
) {
if (force || message.getTabs().contains(tab)) {
ChatMessage newMessage = message
.getMessage()
.shallowClone(getPaddedWidth());
newMessage.setCreationTick(
MinecraftClient.getInstance().inGameHud.getTicks()
);
if (setTicks) {
newMessage.setCreationTick(
MinecraftClient.getInstance().inGameHud.getTicks()
);
}
this.lines.add(0, newMessage);
if (scrolledLines > 0) {
scrolledLines++;
@@ -131,10 +133,19 @@ public class ChatWindow {
}
}
public int getTotalLines() {
int count = 0;
for (ChatMessage line : lines) {
count += line.getLineCount();
}
return count;
}
public void scroll(double amount) {
this.scrolledLines = (int) ((double) this.scrolledLines + amount);
if (this.scrolledLines > lines.size()) {
this.scrolledLines = lines.size();
int totalLines = getTotalLines();
if (this.scrolledLines > totalLines) {
this.scrolledLines = totalLines;
}
if (this.scrolledLines <= 0) {
@@ -265,12 +276,13 @@ public class ChatWindow {
}
int lineCount = lines.size();
int totalLines = getTotalLines();
boolean chatFocused =
visibility == HudConfigStorage.Visibility.ALWAYS || focused;
if (scrolledLines > lineCount) {
scrolledLines = lineCount;
if (scrolledLines > totalLines) {
scrolledLines = totalLines;
}
matrixStack.push();
@@ -501,7 +513,7 @@ public class ChatWindow {
tab.getInnerColor().color()
);
// Scroll bar
float add = (float) (scrolledLines) / (lineCount + 1);
float add = (float) (scrolledLines) / (totalLines + 1);
int scrollHeight = (int) (add * getScaledHeight());
drawRect(
matrixStack,
@@ -16,9 +16,9 @@
"advancedchathud.config.match.remove": "§cRemove",
"advancedchathud.config.match.screen.name": "Matches",
"advancedchathud.config.general.width": "Chat Width",
"advancedchathud.config.general.width": "Default Chat Width",
"advancedchathud.config.general.info.width": "The §6width §rof the §9Chat HUD \nOverrides Vanilla chat width!",
"advancedchathud.config.general.height": "Chat Height",
"advancedchathud.config.general.height": "Default Chat Height",
"advancedchathud.config.general.info.height": "The §6height §rof the §9Chat HUD \nOverrides Vanilla chat width!",
"advancedchathud.config.general.showtabs": "Show Chat Tabs",
"advancedchathud.config.general.info.showtabs": "Whether or not §bChat Tabs §rare visible on the §6side§r of the §9Chat HUD",
@@ -39,9 +39,9 @@
"advancedchathud.config.visibility.focus_only": "§cFocus Only",
"advancedchathud.config.general.linespace": "Spacing Between Lines",
"advancedchathud.config.general.info.linespace": "The §6space§r (in pixels) between lines of chat",
"advancedchathud.config.general.x": "Chat X",
"advancedchathud.config.general.x": "Default Chat X",
"advancedchathud.config.general.info.x": "The §6x-coodinate §rof the chat box, starting at the §6bottom-left §rside of the screen",
"advancedchathud.config.general.y": "Chat Y",
"advancedchathud.config.general.y": "Default Chat Y",
"advancedchathud.config.general.info.y": "The §6y-coodinate §rof the chat box, starting at the §6bottom-left §rside of the screen",
"advancedchathud.config.general.messagespace": "Padding Between Messages",
"advancedchathud.config.general.info.messagespace": "How much space should be between §6individual messages",