diff options
author | olim <bobq4582@gmail.com> | 2024-02-18 18:40:50 +0000 |
---|---|---|
committer | olim <bobq4582@gmail.com> | 2024-02-18 18:40:50 +0000 |
commit | a48b32d58d1a425d3dd120de12351de89f7659a1 (patch) | |
tree | 0fc84c1c87386f18414c00646be547ce090cae68 | |
parent | 076522fa33965fce1345bbea8cb80f82645fc201 (diff) | |
download | Skyblocker-a48b32d58d1a425d3dd120de12351de89f7659a1.tar.gz Skyblocker-a48b32d58d1a425d3dd120de12351de89f7659a1.tar.bz2 Skyblocker-a48b32d58d1a425d3dd120de12351de89f7659a1.zip |
add tooltips
add tool-tips for the config ui
4 files changed, 31 insertions, 2 deletions
diff --git a/src/main/java/de/hysky/skyblocker/skyblock/chat/ChatRuleConfigScreen.java b/src/main/java/de/hysky/skyblocker/skyblock/chat/ChatRuleConfigScreen.java index 7d2280f0..cb9a2da6 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/chat/ChatRuleConfigScreen.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/chat/ChatRuleConfigScreen.java @@ -4,6 +4,7 @@ import it.unimi.dsi.fastutil.ints.IntIntPair; import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.screen.Screen; +import net.minecraft.client.gui.tooltip.Tooltip; import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.gui.widget.TextFieldWidget; import net.minecraft.sound.SoundEvent; @@ -30,7 +31,7 @@ public class ChatRuleConfigScreen extends Screen { entry(Text.translatable("text.autoconfig.skyblocker.option.messages.chatRules.screen.ruleScreen.sounds.arrowHit"), SoundEvents.ENTITY_ARROW_HIT_PLAYER), entry(Text.translatable("text.autoconfig.skyblocker.option.messages.chatRules.screen.ruleScreen.sounds.amethyst"), SoundEvents.BLOCK_AMETHYST_BLOCK_HIT), entry(Text.translatable("text.autoconfig.skyblocker.option.messages.chatRules.screen.ruleScreen.sounds.anvil"), SoundEvents.BLOCK_ANVIL_LAND) - );//todo amathis / more sounds + ); private final int chatRuleIndex; private final ChatRule chatRule; @@ -96,6 +97,7 @@ public class ChatRuleConfigScreen extends Screen { lineXOffset = client.textRenderer.getWidth(Text.translatable("text.autoconfig.skyblocker.option.messages.chatRules.screen.ruleScreen.name")) + SPACER_X; nameInput = new TextFieldWidget(MinecraftClient.getInstance().textRenderer, currentPos.leftInt() + lineXOffset, currentPos.rightInt(), 100, 20, Text.of("")); nameInput.setText(chatRule.getName()); + nameInput.setTooltip(Tooltip.of(Text.translatable("text.autoconfig.skyblocker.option.messages.chatRules.screen.ruleScreen.name.@Tooltip"))); currentPos = IntIntPair.of(currentPos.leftInt(),currentPos.rightInt() + SPACER_Y); inputsLabelTextPos = currentPos; @@ -106,6 +108,7 @@ public class ChatRuleConfigScreen extends Screen { filterInput = new TextFieldWidget(MinecraftClient.getInstance().textRenderer, currentPos.leftInt() + lineXOffset, currentPos.rightInt(), 200, 20, Text.of("")); filterInput.setMaxLength(96); filterInput.setText(chatRule.getFilter()); + filterInput.setTooltip(Tooltip.of(Text.translatable("text.autoconfig.skyblocker.option.messages.chatRules.screen.ruleScreen.filter.@Tooltip"))); currentPos = IntIntPair.of(currentPos.leftInt(),currentPos.rightInt() + SPACER_Y); lineXOffset = 0; @@ -117,6 +120,7 @@ public class ChatRuleConfigScreen extends Screen { }) .position(currentPos.leftInt() + lineXOffset, currentPos.rightInt()) .size(75,20) + .tooltip(Tooltip.of(Text.translatable("text.autoconfig.skyblocker.option.messages.chatRules.screen.ruleScreen.partialMatch.@Tooltip"))) .build(); lineXOffset += 75 + SPACER_X; regexTextPos = IntIntPair.of(currentPos.leftInt() + lineXOffset,currentPos.rightInt()); @@ -127,6 +131,7 @@ public class ChatRuleConfigScreen extends Screen { }) .position(currentPos.leftInt() + lineXOffset, currentPos.rightInt()) .size(75,20) + .tooltip(Tooltip.of(Text.translatable("text.autoconfig.skyblocker.option.messages.chatRules.screen.ruleScreen.regex.@Tooltip"))) .build(); lineXOffset += 75 + SPACER_X; ignoreCaseTextPos = IntIntPair.of(currentPos.leftInt() + lineXOffset,currentPos.rightInt()); @@ -137,6 +142,7 @@ public class ChatRuleConfigScreen extends Screen { }) .position(currentPos.leftInt() + lineXOffset, currentPos.rightInt()) .size(75,20) + .tooltip(Tooltip.of(Text.translatable("text.autoconfig.skyblocker.option.messages.chatRules.screen.ruleScreen.ignoreCase.@Tooltip"))) .build(); currentPos = IntIntPair.of(currentPos.leftInt(),currentPos.rightInt() + SPACER_Y); @@ -144,6 +150,9 @@ public class ChatRuleConfigScreen extends Screen { lineXOffset = client.textRenderer.getWidth(Text.translatable("text.autoconfig.skyblocker.option.messages.chatRules.screen.ruleScreen.locations")) + SPACER_X; locationsInput = new TextFieldWidget(MinecraftClient.getInstance().textRenderer, currentPos.leftInt() + lineXOffset, currentPos.rightInt(), 200, 20, Text.of("")); locationsInput.setText(chatRule.getValidLocations()); + MutableText locationToolTip = Text.translatable("text.autoconfig.skyblocker.option.messages.chatRules.screen.ruleScreen.locations.@Tooltip"); + ChatRulesHandler.locationsList.forEach(location -> locationToolTip.append(" " + location + ",\n")); + locationsInput.setTooltip(Tooltip.of(locationToolTip)); currentPos = IntIntPair.of(currentPos.leftInt(),currentPos.rightInt() + SPACER_Y); outputsLabelTextPos = IntIntPair.of(currentPos.leftInt() - 10,currentPos.rightInt()); @@ -157,6 +166,7 @@ public class ChatRuleConfigScreen extends Screen { }) .position(currentPos.leftInt() + lineXOffset, currentPos.rightInt()) .size(75,20) + .tooltip(Tooltip.of(Text.translatable("text.autoconfig.skyblocker.option.messages.chatRules.screen.ruleScreen.hideMessage.@Tooltip"))) .build(); lineXOffset += 75 + SPACER_X; actionBarTextPos = IntIntPair.of(currentPos.leftInt() + lineXOffset,currentPos.rightInt()); @@ -167,6 +177,7 @@ public class ChatRuleConfigScreen extends Screen { }) .position(currentPos.leftInt() + lineXOffset, currentPos.rightInt()) .size(75,20) + .tooltip(Tooltip.of(Text.translatable("text.autoconfig.skyblocker.option.messages.chatRules.screen.ruleScreen.actionBar.@Tooltip"))) .build(); lineXOffset = 0; currentPos = IntIntPair.of(currentPos.leftInt(),currentPos.rightInt() + SPACER_Y); @@ -179,6 +190,7 @@ public class ChatRuleConfigScreen extends Screen { }) .position(currentPos.leftInt() + lineXOffset, currentPos.rightInt()) .size(75,20) + .tooltip(Tooltip.of(Text.translatable("text.autoconfig.skyblocker.option.messages.chatRules.screen.ruleScreen.announcement.@Tooltip"))) .build(); lineXOffset += 75 + SPACER_X; customSoundLabelTextPos = IntIntPair.of(currentPos.leftInt() + lineXOffset,currentPos.rightInt()); @@ -198,6 +210,7 @@ public class ChatRuleConfigScreen extends Screen { }) .position(currentPos.leftInt() + lineXOffset, currentPos.rightInt()) .size(100,20) + .tooltip(Tooltip.of(Text.translatable("text.autoconfig.skyblocker.option.messages.chatRules.screen.ruleScreen.sound.@Tooltip"))) .build(); currentPos = IntIntPair.of(currentPos.leftInt(),currentPos.rightInt() + SPACER_Y); @@ -205,6 +218,7 @@ public class ChatRuleConfigScreen extends Screen { lineXOffset = client.textRenderer.getWidth(Text.translatable("text.autoconfig.skyblocker.option.messages.chatRules.screen.ruleScreen.replace")) + SPACER_X; replaceMessageInput = new TextFieldWidget(MinecraftClient.getInstance().textRenderer, currentPos.leftInt() + lineXOffset, currentPos.rightInt(), 200, 20, Text.of("")); replaceMessageInput.setMaxLength(96); + replaceMessageInput.setTooltip(Tooltip.of(Text.translatable("text.autoconfig.skyblocker.option.messages.chatRules.screen.ruleScreen.replace.@Tooltip"))); replaceMessageInput.setText(chatRule.getReplaceMessage()); finishButton = ButtonWidget.builder(Text.translatable("text.autoconfig.skyblocker.option.messages.chatRules.screen.ruleScreen.finish"), a -> { diff --git a/src/main/java/de/hysky/skyblocker/skyblock/chat/ChatRulesConfigListWidget.java b/src/main/java/de/hysky/skyblocker/skyblock/chat/ChatRulesConfigListWidget.java index 84e9082d..87455a2b 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/chat/ChatRulesConfigListWidget.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/chat/ChatRulesConfigListWidget.java @@ -7,6 +7,7 @@ import net.minecraft.client.gui.Selectable; import net.minecraft.client.gui.screen.ConfirmScreen; import net.minecraft.client.gui.screen.narration.NarrationMessageBuilder; import net.minecraft.client.gui.screen.narration.NarrationPart; +import net.minecraft.client.gui.tooltip.Tooltip; import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.gui.widget.ElementListWidget; import net.minecraft.screen.ScreenTexts; @@ -132,6 +133,7 @@ public class ChatRulesConfigListWidget extends ElementListWidget<ChatRulesConfig }) .size(50,20) .position(width / 2 + 45,5) + .tooltip(Tooltip.of(Text.translatable("text.autoconfig.skyblocker.option.messages.chatRules.screen.editRule.@Tooltip"))) .build() ; deleteButton = ButtonWidget.builder(Text.translatable("selectServer.delete"), a -> { diff --git a/src/main/java/de/hysky/skyblocker/skyblock/chat/ChatRulesHandler.java b/src/main/java/de/hysky/skyblocker/skyblock/chat/ChatRulesHandler.java index 29faa856..c9efe749 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/chat/ChatRulesHandler.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/chat/ChatRulesHandler.java @@ -37,6 +37,7 @@ public class ChatRulesHandler { * list of possible locations still formatted for the tool tip */ protected static final List<String> locationsList = new ArrayList<>(); + protected static final List<ChatRule> chatRuleList = new ArrayList<>(); public static void init() { diff --git a/src/main/resources/assets/skyblocker/lang/en_us.json b/src/main/resources/assets/skyblocker/lang/en_us.json index 079d060e..52cc52c4 100644 --- a/src/main/resources/assets/skyblocker/lang/en_us.json +++ b/src/main/resources/assets/skyblocker/lang/en_us.json @@ -377,23 +377,35 @@ "text.autoconfig.skyblocker.option.messages.chatRules.screen.ruleEnabled": "Rule Enabled", "text.autoconfig.skyblocker.option.messages.chatRules.screen.modify": "Modify", "text.autoconfig.skyblocker.option.messages.chatRules.screen.editRule": "Edit", - "text.autoconfig.skyblocker.option.messages.chatRules.screen.ruleScreen": "Chat Rules Config...", + "text.autoconfig.skyblocker.option.messages.chatRules.screen.editRule.@Tooltip": "Open config for rule.", + "text.autoconfig.skyblocker.option.messages.chatRules.screen.ruleScreen": "Chat Rule Config...", "text.autoconfig.skyblocker.option.messages.chatRules.screen.ruleScreen.true": "True", "text.autoconfig.skyblocker.option.messages.chatRules.screen.ruleScreen.false": "False", "text.autoconfig.skyblocker.option.messages.chatRules.screen.ruleScreen.inputs": "Inputs:", "text.autoconfig.skyblocker.option.messages.chatRules.screen.ruleScreen.name": "Name:", + "text.autoconfig.skyblocker.option.messages.chatRules.screen.ruleScreen.name.@Tooltip": "The name of the rule.", "text.autoconfig.skyblocker.option.messages.chatRules.screen.ruleScreen.filter": "ChatFilter:", + "text.autoconfig.skyblocker.option.messages.chatRules.screen.ruleScreen.filter.@Tooltip": "The string/regex to match a chat message to.", "text.autoconfig.skyblocker.option.messages.chatRules.screen.ruleScreen.partialMatch": "Allow Partial Match:", + "text.autoconfig.skyblocker.option.messages.chatRules.screen.ruleScreen.partialMatch.@Tooltip": "If the filter can match part of the chat message.", "text.autoconfig.skyblocker.option.messages.chatRules.screen.ruleScreen.regex": "Is Regex:", + "text.autoconfig.skyblocker.option.messages.chatRules.screen.ruleScreen.regex.@Tooltip": "If the filter uses regex or is just a string.", "text.autoconfig.skyblocker.option.messages.chatRules.screen.ruleScreen.ignoreCase": "Ignore Case:", + "text.autoconfig.skyblocker.option.messages.chatRules.screen.ruleScreen.ignoreCase.@Tooltip": "if the filter is case sensitive.", "text.autoconfig.skyblocker.option.messages.chatRules.screen.ruleScreen.locations": "Valid Locations:", + "text.autoconfig.skyblocker.option.messages.chatRules.screen.ruleScreen.locations.@Tooltip": "List of locations where the filter will work. Separate each location with a \",\" and use a \"!\" if you want it to work anywhere but a location. Location Names:", "text.autoconfig.skyblocker.option.messages.chatRules.screen.ruleScreen.outputs": "Outputs:", "text.autoconfig.skyblocker.option.messages.chatRules.screen.ruleScreen.hideMessage": "Hide Message:", + "text.autoconfig.skyblocker.option.messages.chatRules.screen.ruleScreen.hideMessage.@Tooltip": "Remove the message from chat.", "text.autoconfig.skyblocker.option.messages.chatRules.screen.ruleScreen.actionBar": "Show In Action Bar:", + "text.autoconfig.skyblocker.option.messages.chatRules.screen.ruleScreen.actionBar.@Tooltip": "Show the message in your action bar.", "text.autoconfig.skyblocker.option.messages.chatRules.screen.ruleScreen.announcement": "Show Announcement:", + "text.autoconfig.skyblocker.option.messages.chatRules.screen.ruleScreen.announcement.@Tooltip": "Show the message in the middle of the screen.", "text.autoconfig.skyblocker.option.messages.chatRules.screen.ruleScreen.replace": "Replace Message With:", + "text.autoconfig.skyblocker.option.messages.chatRules.screen.ruleScreen.replace.@Tooltip": "Input a new message to output (can be formatted using minecraft color codes).", "text.autoconfig.skyblocker.option.messages.chatRules.screen.ruleScreen.finish": "finish", "text.autoconfig.skyblocker.option.messages.chatRules.screen.ruleScreen.sounds": "Play Sound:", + "text.autoconfig.skyblocker.option.messages.chatRules.screen.ruleScreen.sounds.@Tooltip": "Play a sound when the message is sent.", "text.autoconfig.skyblocker.option.messages.chatRules.screen.ruleScreen.sounds.none": "None", "text.autoconfig.skyblocker.option.messages.chatRules.screen.ruleScreen.sounds.pling": "Pling", "text.autoconfig.skyblocker.option.messages.chatRules.screen.ruleScreen.sounds.cave": "Cave", |