diff --git a/src/main/java/net/geforcemods/securitycraft/screen/SCManualScreen.java b/src/main/java/net/geforcemods/securitycraft/screen/SCManualScreen.java index c6a1dd29b6..b7f697a2e2 100644 --- a/src/main/java/net/geforcemods/securitycraft/screen/SCManualScreen.java +++ b/src/main/java/net/geforcemods/securitycraft/screen/SCManualScreen.java @@ -36,13 +36,14 @@ import net.geforcemods.securitycraft.screen.components.TextHoverChecker; import net.geforcemods.securitycraft.util.BlockUtils; import net.geforcemods.securitycraft.util.Utils; +import net.minecraft.ChatFormatting; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.Button; import net.minecraft.client.gui.components.Renderable; import net.minecraft.client.gui.narration.NarrationElementOutput; import net.minecraft.client.gui.screens.Screen; -import net.minecraft.client.resources.language.I18n; +import net.minecraft.client.resources.sounds.SimpleSoundInstance; import net.minecraft.core.NonNullList; import net.minecraft.core.RegistryAccess; import net.minecraft.network.chat.ClickEvent; @@ -52,6 +53,7 @@ import net.minecraft.network.chat.MutableComponent; import net.minecraft.network.chat.Style; import net.minecraft.resources.ResourceLocation; +import net.minecraft.sounds.SoundEvents; import net.minecraft.util.FormattedCharSequence; import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.Item; @@ -95,13 +97,15 @@ public class SCManualScreen extends Screen { private static int lastPage = -1; private final MutableComponent intro1 = Utils.localize("gui.securitycraft:scManual.intro.1").setStyle(Style.EMPTY.withUnderlined(true)); private final Component ourPatrons = Utils.localize("gui.securitycraft:scManual.patreon.title"); + private final Style crowdinLinkStyle = Style.EMPTY.withClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "https://crowdin.com/project/securitycraft")); + private final HoverChecker translationCreditsArea = new HoverChecker(180, 200, 135, 290); private List hoverCheckers = new ArrayList<>(); private int currentPage = lastPage; private NonNullList recipe; private IngredientDisplay[] displays = new IngredientDisplay[9]; private int startX = -1; private List subpages = new ArrayList<>(); - private List author = new ArrayList<>(); + private List translationCredits; private int currentSubpage = 0; private List intro2; private PatronList patronList; @@ -142,6 +146,7 @@ public void init() { return key1.compareTo(key2); }); + translationCredits = font.split(Utils.localize("gui.securitycraft:scManual.crowdin").withStyle(ChatFormatting.BLUE, ChatFormatting.UNDERLINE), 180); } @Override @@ -200,8 +205,8 @@ else if (i < displays.length && !displays[i].getCurrentStack().isEmpty()) { guiGraphics.drawString(font, text, width / 2 - font.width(text) / 2, 150 + 10 * i, 0, false); } - for (int i = 0; i < author.size(); i++) { - FormattedCharSequence text = author.get(i); + for (int i = 0; i < translationCredits.size(); i++) { + FormattedCharSequence text = translationCredits.get(i); guiGraphics.drawString(font, text, width / 2 - font.width(text) / 2, 180 + 10 * i, 0, false); } @@ -317,12 +322,6 @@ private void updateRecipeAndIcons() { recipe = null; nextSubpage.visible = false; previousSubpage.visible = false; - - if (I18n.exists("gui.securitycraft:scManual.author")) - author = font.split(Utils.localize("gui.securitycraft:scManual.author"), 180); - else - author.clear(); - intro2 = font.split(Utils.localize("gui.securitycraft:scManual.intro.2"), 202); patronList.fetchPatrons(); return; @@ -573,6 +572,11 @@ public boolean mouseClicked(double mouseX, double mouseY, int button) { if (patronList != null) patronList.mouseClicked(mouseX, mouseY, button); + if (translationCreditsArea.checkHover(mouseX, mouseY)) { + handleComponentClicked(crowdinLinkStyle); + minecraft.getSoundManager().play(SimpleSoundInstance.forUI(SoundEvents.UI_BUTTON_CLICK, 1.0F)); + } + return super.mouseClicked(mouseX, mouseY, button); } diff --git a/src/main/resources/assets/securitycraft/lang/de_de.json b/src/main/resources/assets/securitycraft/lang/de_de.json index 0da6e0c35e..42fb2998ab 100644 --- a/src/main/resources/assets/securitycraft/lang/de_de.json +++ b/src/main/resources/assets/securitycraft/lang/de_de.json @@ -748,6 +748,7 @@ "gui.securitycraft:scManual.author": "Übersetzt von bl4ckscor3 und Redstone_Dubstep", "gui.securitycraft:scManual.block_mines": "Blockminen", "gui.securitycraft:scManual.block_reinforcers": "Universelle Blockverstärker", + "gui.securitycraft:scManual.crowdin": "Vielen Dank unseren Übersetzern auf Crowdin!", "gui.securitycraft:scManual.customizableBlock": "Anpassbar: Du kannst den Universellen Blockmodifizierer verwenden, um die Funktionen hiervon anzupassen.", "gui.securitycraft:scManual.designedBy": "Entworfen von: %s", "gui.securitycraft:scManual.disabled": "Deaktiviert", diff --git a/src/main/resources/assets/securitycraft/lang/en_us.json b/src/main/resources/assets/securitycraft/lang/en_us.json index 934e574002..e0f04403d3 100644 --- a/src/main/resources/assets/securitycraft/lang/en_us.json +++ b/src/main/resources/assets/securitycraft/lang/en_us.json @@ -755,6 +755,7 @@ "gui.securitycraft:rift_stabilizer.toggle": "Click the entries in the list below to toggle the detection of that specific teleportation type.", "gui.securitycraft:scManual.block_mines": "Block Mines", "gui.securitycraft:scManual.block_reinforcers": "Universal Block Reinforcers", + "gui.securitycraft:scManual.crowdin": "Thanks to our translators on Crowdin!", "gui.securitycraft:scManual.customizableBlock": "Customizable: You may use the Universal Block Modifier and the various modules added by SecurityCraft to customize the functions of this.", "gui.securitycraft:scManual.designedBy": "Designed by: %s", "gui.securitycraft:scManual.disabled": "Disabled",