From 4f6402335faaf0305444f9207f1f532a9fd44fc3 Mon Sep 17 00:00:00 2001 From: MODKILLER1001 Date: Thu, 15 Sep 2022 00:35:06 -0400 Subject: add modmenu buttons --- .../aizistral/nochatreports/config/ModMenuIntegration.java | 14 ++++++++++++++ src/main/resources/assets/nochatreports/lang/en_pt.json | 7 +++++++ src/main/resources/assets/nochatreports/lang/en_us.json | 4 ++++ 3 files changed, 25 insertions(+) diff --git a/src/main/java/com/aizistral/nochatreports/config/ModMenuIntegration.java b/src/main/java/com/aizistral/nochatreports/config/ModMenuIntegration.java index 9f42b67..d0ee316 100644 --- a/src/main/java/com/aizistral/nochatreports/config/ModMenuIntegration.java +++ b/src/main/java/com/aizistral/nochatreports/config/ModMenuIntegration.java @@ -163,6 +163,20 @@ public final class ModMenuIntegration implements ModMenuApi { .setSaveConsumer(newValue -> NCRConfig.getClient().whitelistAllServers = newValue) .build()); + // Set an option for showNCRButton + technical.addEntry(entryBuilder.startBooleanToggle(Component.translatable("option.NoChatReports.showNCRButton"), NCRConfig.getClient().showNCRButton) + .setDefaultValue(true) + .setTooltip(this.makeTooltip("option.NoChatReports.showNCRButton.tooltip")) + .setSaveConsumer(newValue -> NCRConfig.getClient().showNCRButton = newValue) + .build()); + + // Set an option for enableMod + technical.addEntry(entryBuilder.startBooleanToggle(Component.translatable("option.NoChatReports.enableMod"), NCRConfig.getClient().enableMod) + .setDefaultValue(true) + .setTooltip(this.makeTooltip("option.NoChatReports.enableMod.tooltip")) + .setSaveConsumer(newValue -> NCRConfig.getClient().enableMod = newValue) + .build()); + // Instructions for adding servers whitelistedServers.addEntry(entryBuilder.startTextDescription(Component.translatable("option.NoChatReports.whitelistedServers.instructions")) .build()); diff --git a/src/main/resources/assets/nochatreports/lang/en_pt.json b/src/main/resources/assets/nochatreports/lang/en_pt.json index 03603d3..3b0c8a7 100644 --- a/src/main/resources/assets/nochatreports/lang/en_pt.json +++ b/src/main/resources/assets/nochatreports/lang/en_pt.json @@ -13,6 +13,9 @@ "gui.nochatreports.unsafe_server.check": "Do not show again fer this here server", "gui.nochatrepords.reload_config_tooltip": "Reload No Chat Reports config. Use carefully.", "gui.nochatreports.verified_server": "§a§lSafe Server§r\nWe could verify that there this here server 'as No Chat Reports installed, or prevents chat reports in some other known way. Ye can chat there safely.", + "gui.nochatreports.ncr_toggle_tooltip": "§lNo Chat Reports:§r %1$s\nDisable or enable most o' the mod's client-sided functionality. Ye may 'ave to do this here to join some Paper/Velocity servers, as they be known fer causin' issues with NCR.\nCertain networking-unrelated things, such as chat trust status tweaks an' removal o' vanilla's \"Chat messages can't be verified\" toast will still work; they can be disabled in config individually.", + "gui.nochatreports.ncr_state_on": "§a§lEnabled§r", + "gui.nochatreports.ncr_state_off": "§c§lDisabled§r", "configuration.NoChatReports.config": "No Chat Reports", @@ -50,6 +53,10 @@ "option.NoChatReports.showReloadButton.tooltip": "Adds a button fer config reloadin' to multiplayer menu.", "option.NoChatReports.whitelistAllServers": "Whitelist all servers", "option.NoChatReports.whitelistAllServers.tooltip": "Makes the mod behave as if all servers was added to §oWhitelisted Servers§r list.", + "option.NoChatReports.showNCRButton": "Show NCR button", + "option.NoChatReports.showNCRButton.tooltip": "Adds a button that there toggles most o' the mod's client-sided functionality to multiplayer menu.", + "option.NoChatReports.enableMod": "Enable mod", + "option.NoChatReports.enableMod.tooltip": "Responsible fer enablin' most o' the mod's client-sided functionality, see option above.", "configuration.NoChatReports.category.whitelistedServers": "Whitelisted Servers", diff --git a/src/main/resources/assets/nochatreports/lang/en_us.json b/src/main/resources/assets/nochatreports/lang/en_us.json index 2acdeb4..58d07fd 100644 --- a/src/main/resources/assets/nochatreports/lang/en_us.json +++ b/src/main/resources/assets/nochatreports/lang/en_us.json @@ -53,6 +53,10 @@ "option.NoChatReports.showReloadButton.tooltip": "Adds a button for config reloading to multiplayer menu.", "option.NoChatReports.whitelistAllServers": "Whitelist all servers", "option.NoChatReports.whitelistAllServers.tooltip": "Makes the mod behave as if all servers were added to §oWhitelisted Servers§r list.", + "option.NoChatReports.showNCRButton": "Show NCR button", + "option.NoChatReports.showNCRButton.tooltip": "Adds a button that toggles most of the mod's client-sided functionality to multiplayer menu.", + "option.NoChatReports.enableMod": "Enable mod", + "option.NoChatReports.enableMod.tooltip": "Responsible for enabling most of the mod's client-sided functionality, see option above.", "configuration.NoChatReports.category.whitelistedServers": "Whitelisted Servers", -- cgit v1.2.3 From 0abff1883b3bfabe3e1048fd68b8aaf4f406bcf1 Mon Sep 17 00:00:00 2001 From: MODKILLER1001 Date: Thu, 15 Sep 2022 00:38:03 -0400 Subject: why is this edited --- .../nochatreports/mixins/client/MixinChatOptionsScreen.java | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/main/java/com/aizistral/nochatreports/mixins/client/MixinChatOptionsScreen.java b/src/main/java/com/aizistral/nochatreports/mixins/client/MixinChatOptionsScreen.java index 2d0c9ba..dab16ad 100644 --- a/src/main/java/com/aizistral/nochatreports/mixins/client/MixinChatOptionsScreen.java +++ b/src/main/java/com/aizistral/nochatreports/mixins/client/MixinChatOptionsScreen.java @@ -5,7 +5,6 @@ import java.util.List; import org.jetbrains.annotations.NotNull; import org.spongepowered.asm.mixin.Mixin; -import com.aizistral.nochatreports.config.NCRConfig; import com.mojang.blaze3d.vertex.PoseStack; import net.minecraft.client.Minecraft; @@ -44,10 +43,6 @@ public class MixinChatOptionsScreen extends SimpleOptionsSubScreen { @Override protected void init() { super.init(); - - if (!NCRConfig.getClient().enableMod()) - return; - this.secureChatTooltip = Minecraft.getInstance().font.split(Component.translatable("gui.nochatreport.secureChat"), 200); this.onlyShowSecureChat = this.list.findOption(Minecraft.getInstance().options.onlyShowSecureChat()); @@ -65,10 +60,6 @@ public class MixinChatOptionsScreen extends SimpleOptionsSubScreen { @Override public void render(@NotNull PoseStack poseStack, int x, int y, float f) { super.render(poseStack, x, y, f); - - if (!NCRConfig.getClient().enableMod()) - return; - if (this.onlyShowSecureChat != null && this.onlyShowSecureChat.visible && x >= (double) this.onlyShowSecureChat.x && y >= (double) this.onlyShowSecureChat.y && x < (double) (this.onlyShowSecureChat.x + this.onlyShowSecureChat.getWidth()) && y < (double) (this.onlyShowSecureChat.y + this.onlyShowSecureChat.getHeight())) { this.renderTooltip(poseStack, this.secureChatTooltip, x, y); } -- cgit v1.2.3 From c2af12bece2ca32ef88821f8e5b5f121af48da92 Mon Sep 17 00:00:00 2001 From: MODKILLER1001 Date: Thu, 15 Sep 2022 00:39:51 -0400 Subject: unfuck it up --- .../nochatreports/mixins/client/MixinChatOptionsScreen.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/aizistral/nochatreports/mixins/client/MixinChatOptionsScreen.java b/src/main/java/com/aizistral/nochatreports/mixins/client/MixinChatOptionsScreen.java index dab16ad..6b3d0f5 100644 --- a/src/main/java/com/aizistral/nochatreports/mixins/client/MixinChatOptionsScreen.java +++ b/src/main/java/com/aizistral/nochatreports/mixins/client/MixinChatOptionsScreen.java @@ -5,6 +5,7 @@ import java.util.List; import org.jetbrains.annotations.NotNull; import org.spongepowered.asm.mixin.Mixin; +import com.aizistral.nochatreports.config.NCRConfig; import com.mojang.blaze3d.vertex.PoseStack; import net.minecraft.client.Minecraft; @@ -43,6 +44,10 @@ public class MixinChatOptionsScreen extends SimpleOptionsSubScreen { @Override protected void init() { super.init(); + + if (!NCRConfig.getClient().enableMod()) + return; + this.secureChatTooltip = Minecraft.getInstance().font.split(Component.translatable("gui.nochatreport.secureChat"), 200); this.onlyShowSecureChat = this.list.findOption(Minecraft.getInstance().options.onlyShowSecureChat()); @@ -60,8 +65,12 @@ public class MixinChatOptionsScreen extends SimpleOptionsSubScreen { @Override public void render(@NotNull PoseStack poseStack, int x, int y, float f) { super.render(poseStack, x, y, f); + + if (!NCRConfig.getClient().enableMod()) + return; + if (this.onlyShowSecureChat != null && this.onlyShowSecureChat.visible && x >= (double) this.onlyShowSecureChat.x && y >= (double) this.onlyShowSecureChat.y && x < (double) (this.onlyShowSecureChat.x + this.onlyShowSecureChat.getWidth()) && y < (double) (this.onlyShowSecureChat.y + this.onlyShowSecureChat.getHeight())) { this.renderTooltip(poseStack, this.secureChatTooltip, x, y); } } -} +} \ No newline at end of file -- cgit v1.2.3