-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
242 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,36 @@ | ||
<div align="center"> | ||
<img height="100px" width="100px" alt="logo" src="./common/src/main/resources/icon.png"/> | ||
<h1>VM Translation Update</h1> | ||
</div> | ||
|
||
<a href="https://modrinth.com/project/vmupdate/"> | ||
<img alt="modrinth" height="56" src="https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/cozy/available/modrinth_vector.svg"> | ||
</a> | ||
<a href="https://www.curseforge.com/minecraft/mc-mods/vmtranslationupdate"> | ||
<img alt="curseforge" height="56" src="https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/cozy/available/curseforge_vector.svg"> | ||
</a> | ||
|
||
[MC百科](https://www.mcmod.cn/class/11203.html) | ||
</div> | ||
|
||
## 功能 | ||
1. 对比最新版汉化版本号与本地配置文件中的版本号,在汉化发布新版本时会在游戏里通知玩家去下载更新。 | ||
2. 默认每25分钟在聊天栏发送一条知识。内容包括但不限于汉化组冷知识,汉字易错读音和MC冷知识等。 | ||
3. 每次启动时自动下载VM汉化组通用模组汉化资源包。 | ||
1. 在汉化发布新版本时会在游戏里通知玩家去下载更新。 | ||
2. 可配置默认每25分钟在聊天栏发送一条知识。内容包括但不限于汉化组冷知识,汉字易错读音和MC冷知识等。 | ||
3. 可配置每次启动时自动下载并启用VM汉化组通用模组汉化资源包。 | ||
4. 如果玩家已经下载资源包且发生错误未启用,会在聊天框提示玩家在选项->资源包中手动启用。 | ||
5. 如果玩家名是Zi__Min,会在每次进入世界时发送`欢迎来到籽岷的Minecraft游戏世界!`,且称呼改为岷叔。 | ||
6. 自动修改游戏语言,当安装Stenographer模组后不修改。 | ||
6. 可配置自动修改游戏语言,当安装[Stenographer](https://modrinth.com/mod/stenographer)模组后将禁用。 | ||
|
||
## 使用与配置文件 | ||
|
||
**发布汉化时,请特别注意。在汉化更新时改一下模组配置里的版本号!** | ||
VM汉化组汉化人员请注意:**发布汉化时,请在汉化更新时改一下模组配置里的版本号!** | ||
|
||
详见:[VMTranslationUpdateMod/wiki/Configs](https://github.com/VM-Chinese-translate-group/VMTranslationUpdateMod/wiki/Configs) | ||
详见:[https://beta.vmct-cn.top/others/vmtu/config](https://beta.vmct-cn.top/others/vmtu/config) | ||
|
||
--- | ||
## 支持版本 | ||
详见:[VMTranslationUpdateMod/wiki/Support-versions](https://github.com/VM-Chinese-translate-group/VMTranslationUpdateMod/wiki/Support-versions) | ||
详见:[https://beta.vmct-cn.top/others/vmtu/support](https://beta.vmct-cn.top/others/vmtu/support) | ||
|
||
## 其他 | ||
特别感谢TexTrue跨加载器重构,以及Lichiiiiiii修复部分bug! | ||
作者:Wulian233(捂脸)、TexTrue。以及Lichiiiiiii修复部分bug! | ||
|
||
本模组使用MIT许可证 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 75 additions & 0 deletions
75
common/src/main/java/top/vmctcn/vmtranslationupdate/screen/SuggestModScreen.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
package top.vmctcn.vmtranslationupdate.screen; | ||
|
||
import com.mojang.blaze3d.systems.RenderSystem; | ||
import net.minecraft.client.MinecraftClient; | ||
import net.minecraft.client.gui.DrawContext; | ||
import net.minecraft.client.gui.screen.Screen; | ||
import net.minecraft.client.gui.widget.ButtonWidget; | ||
import net.minecraft.util.Formatting; | ||
import net.minecraft.util.Identifier; | ||
import top.vmctcn.vmtranslationupdate.util.ModConfigUtil; | ||
import top.vmctcn.vmtranslationupdate.util.ScreenUtil; | ||
|
||
public class SuggestModScreen extends Screen { | ||
public final Screen lastScreen; | ||
private int ticksUntilEnable = 20 * 10; | ||
|
||
private static final int HEADER_HEIGHT = 40; | ||
private static final int FOOTER_HEIGHT = 50; | ||
private static final int BORDER = 40; | ||
|
||
public SuggestModScreen(Screen lastScreen) { | ||
super(ScreenUtil.getSuggestScreenTitle().copy().formatted(Formatting.RED).formatted(Formatting.BOLD)); | ||
this.lastScreen = lastScreen; | ||
} | ||
|
||
@Override | ||
protected void init() { | ||
int centerX = this.width / 2; | ||
|
||
super.init(); | ||
|
||
this.addDrawableChild(ButtonWidget.builder(ScreenUtil.downloadButtonText, buttonWidget -> { | ||
if (ModConfigUtil.getConfig().i18nUpdateModCheck && !ScreenUtil.i18nUpdateModPresent) { | ||
ScreenUtil.openUrlOnScreen(this.client, this, "https://modrinth.com/mod/i18nupdatemod"); | ||
} else if (ModConfigUtil.getConfig().vaultPatcherCheck && !ScreenUtil.vaultPatcherPresent) { | ||
ScreenUtil.openUrlOnScreen(this.client, this, "https://modrinth.com/mod/vault-patcher"); | ||
} | ||
}).dimensions(centerX - 5 - 150, this.height - (FOOTER_HEIGHT / 2) - 10, 150, 20).build()); | ||
this.addDrawableChild(ButtonWidget.builder(ScreenUtil.quitButtonText, buttonWidget -> this.client.scheduleStop()).dimensions(centerX + 5, this.height - (FOOTER_HEIGHT / 2) - 10, 150, 20).build()); | ||
} | ||
|
||
@Override | ||
public void render(DrawContext context, int mouseX, int mouseY, float delta) { | ||
super.render(context, mouseX, mouseY, delta); | ||
|
||
context.drawCenteredTextWithShadow(this.textRenderer, this.title, this.width / 2, (HEADER_HEIGHT / 2) - (this.textRenderer.fontHeight / 2), -1); | ||
context.drawCenteredTextWithShadow(this.textRenderer, ScreenUtil.getSuggestScreenText(), this.width / 2, 70, -1); | ||
} | ||
|
||
@Override | ||
public void renderBackground(DrawContext context, int mouseX, int mouseY, float partial) { | ||
|
||
super.renderBackground(context, mouseX, mouseY, partial); | ||
|
||
//Render header and footer separators | ||
RenderSystem.enableBlend(); | ||
ScreenUtil.resetShaderColor(context); | ||
Identifier identifier = MinecraftClient.getInstance().world == null ? Screen.HEADER_SEPARATOR_TEXTURE : Screen.INWORLD_HEADER_SEPARATOR_TEXTURE; | ||
Identifier identifier2 = MinecraftClient.getInstance().world == null ? Screen.FOOTER_SEPARATOR_TEXTURE : Screen.INWORLD_FOOTER_SEPARATOR_TEXTURE; | ||
context.drawTexture(identifier, 0, 40 - 2, 0.0F, 0.0F, this.width, 2, 32, 2); | ||
context.drawTexture(identifier2, 0, this.height - 50, 0.0F, 0.0F, this.width, 2, 32, 2); | ||
ScreenUtil.resetShaderColor(context); | ||
|
||
} | ||
|
||
@Override | ||
public boolean shouldCloseOnEsc() { | ||
return this.ticksUntilEnable <= 0; | ||
} | ||
|
||
@Override | ||
public void close() { | ||
MinecraftClient.getInstance().setScreen(this.lastScreen); | ||
} | ||
} |
84 changes: 84 additions & 0 deletions
84
common/src/main/java/top/vmctcn/vmtranslationupdate/util/ScreenUtil.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
package top.vmctcn.vmtranslationupdate.util; | ||
|
||
import net.minecraft.client.MinecraftClient; | ||
import net.minecraft.client.gui.DrawContext; | ||
import net.minecraft.client.gui.screen.ConfirmLinkScreen; | ||
import net.minecraft.client.gui.screen.Screen; | ||
import net.minecraft.client.gui.screen.TitleScreen; | ||
import net.minecraft.text.Text; | ||
import net.minecraft.util.Util; | ||
import org.apache.commons.lang3.StringUtils; | ||
import top.vmctcn.vmtranslationupdate.screen.SuggestModScreen; | ||
|
||
public class ScreenUtil { | ||
public static boolean i18nUpdateModPresent = false; | ||
public static boolean vaultPatcherPresent = false; | ||
public static boolean firstTitleScreenShown = false; | ||
public static final Text downloadButtonText = Text.translatable("vmtranslationupdate.warn.download.button"); | ||
public static final Text quitButtonText = Text.translatable("vmtranslationupdate.warn.quit.button"); | ||
|
||
public static void screenAfterInitEvent(Screen screen) { | ||
if (firstTitleScreenShown || !(screen instanceof TitleScreen)) { | ||
return; | ||
} | ||
|
||
MinecraftClient.getInstance().setScreen(new SuggestModScreen(screen)); | ||
|
||
firstTitleScreenShown = true; | ||
} | ||
|
||
public static void checkModsLoaded() { | ||
try { | ||
Class.forName("i18nupdatemod.I18nUpdateMod"); | ||
i18nUpdateModPresent = true; | ||
} catch (ClassNotFoundException e) { | ||
i18nUpdateModPresent = false; | ||
} try { | ||
Class.forName("me.fengming.vaultpatcher_asm.VaultPatcher"); | ||
vaultPatcherPresent = true; | ||
} catch (ClassNotFoundException e) { | ||
vaultPatcherPresent = false; | ||
} | ||
} | ||
|
||
public static void openUrlOnScreen(MinecraftClient client, Screen screen, String url) { | ||
if (StringUtils.isNotBlank(url) && client != null) { | ||
client.setScreen(new ConfirmLinkScreen(yes -> { | ||
if (yes) { | ||
Util.getOperatingSystem().open(url); | ||
} | ||
client.setScreen(screen); | ||
}, url, true)); | ||
} | ||
} | ||
|
||
public static void resetShaderColor(DrawContext context) { | ||
context.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); | ||
} | ||
|
||
public static Text getSuggestScreenTitle() { | ||
Text titleText = Text.empty(); | ||
|
||
if (ModConfigUtil.getConfig().i18nUpdateModCheck && !i18nUpdateModPresent) { | ||
titleText = Text.translatable("vmtranslationupdate.warn.title", "I18nUpdateMod"); | ||
} else if (ModConfigUtil.getConfig().vaultPatcherCheck && !vaultPatcherPresent) { | ||
titleText = Text.translatable("vmtranslationupdate.warn.title", "VaultPatcher"); | ||
} else if ((ModConfigUtil.getConfig().i18nUpdateModCheck && !i18nUpdateModPresent) && (ModConfigUtil.getConfig().vaultPatcherCheck && !vaultPatcherPresent)) { | ||
titleText = Text.translatable("vmtranslationupdate.warn.text", "I18nUpdateMod & VaultPatcher"); | ||
} | ||
return titleText; | ||
} | ||
|
||
public static Text getSuggestScreenText() { | ||
Text context = Text.empty(); | ||
|
||
if (ModConfigUtil.getConfig().i18nUpdateModCheck && !i18nUpdateModPresent) { | ||
context = Text.translatable("vmtranslationupdate.warn.text", "I18nUpdateMod"); | ||
} else if (ModConfigUtil.getConfig().vaultPatcherCheck && !vaultPatcherPresent) { | ||
context = Text.translatable("vmtranslationupdate.warn.text", "VaultPatcher"); | ||
} else if ((ModConfigUtil.getConfig().i18nUpdateModCheck && !i18nUpdateModPresent) && (ModConfigUtil.getConfig().vaultPatcherCheck && !vaultPatcherPresent)) { | ||
context = Text.translatable("vmtranslationupdate.warn.text", "I18nUpdateMod & VaultPatcher"); | ||
} | ||
return context; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,7 +28,7 @@ | |
], | ||
"depends": { | ||
"fabric": "*", | ||
"minecraft": ">=1.20.5", | ||
"minecraft": ">=1.21", | ||
"cloth-config": "*" | ||
} | ||
} |
Oops, something went wrong.