Skip to content

Commit

Permalink
1.5.8 1.18.2 (#258) (#259)
Browse files Browse the repository at this point in the history
  • Loading branch information
SiongSng authored Jul 25, 2023
1 parent b963aa4 commit f3112d1
Show file tree
Hide file tree
Showing 32 changed files with 366 additions and 329 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ common/build
/*/build/
build/

/fabric/src/main/resources/rpmtw_platform_mod.accesswidener
/quilt/src/main/resources/rpmtw_platform_mod.accesswidener
fabric/src/generated/
quilt/src/generated/

.architectury-transformer/
.idea
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
# RPMTW Platform Mod

[![](https://img.shields.io/github/license/RPMTW/RPMTW-Platform-Mod.svg)](LICENSE)
[![](https://img.shields.io/github/release/RPMTW/RPMTW-Platform-Mod.svg)](https://github.com/RPMTW/RPMTW-Platform-Mod/releases)
![](http://cf.way2muchnoise.eu/versions/minecraft_rpmtw-update-mod_all.svg)
[![](http://cf.way2muchnoise.eu/rpmtw-update-mod.svg)](https://www.curseforge.com/minecraft/mc-mods/rpmtw-update-mod)
[![](https://img.shields.io/github/release/RPMTW/RPMTW-Platform-Mod.svg)](../../releases)
![](https://cf.way2muchnoise.eu/versions/rpmtw-platform.svg)
[![](https://cf.way2muchnoise.eu/rpmtw-platform.svg)](https://www.curseforge.com/minecraft/mc-mods/rpmtw-platform)
[![](https://img.shields.io/modrinth/dt/ZukQzaRP?label=Modrinth%20Downloads)](https://modrinth.com/mod/ZukQzaRP)
<p>&nbsp;</p>

#### 🌐 README Languages

- English (Current Language)
- [繁體中文](https://github.com/RPMTW/RPMTW-Platform-Mod/blob/main/README/zh_tw.md)
- [简体中文](https://github.com/RPMTW/RPMTW-Platform-Mod/blob/main/README/zh_cn.md)
- [繁體中文](README/zh_tw.md)
- [简体中文](README/zh_cn.md)

## 📚 Introduction

Expand Down
20 changes: 10 additions & 10 deletions README/zh_cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@

# RPMTW 平台

[![](https://img.shields.io/github/license/RPMTW/RPMTW-Platform-Mod.svg)](LICENSE)
[![](https://img.shields.io/github/release/RPMTW/RPMTW-Platform-Mod.svg)](https://github.com/RPMTW/RPMTW-Platform-Mod/releases)
![](http://cf.way2muchnoise.eu/versions/minecraft_rpmtw-update-mod_all.svg)
[![](http://cf.way2muchnoise.eu/rpmtw-update-mod.svg)](https://www.curseforge.com/minecraft/mc-mods/rpmtw-update-mod)
[![](https://img.shields.io/github/license/RPMTW/RPMTW-Platform-Mod.svg)](../LICENSE)
[![](https://img.shields.io/github/release/RPMTW/RPMTW-Platform-Mod.svg)](../../../releases)
![](https://cf.way2muchnoise.eu/versions/rpmtw-platform.svg)
[![](https://cf.way2muchnoise.eu/rpmtw-platform.svg)](https://www.curseforge.com/minecraft/mc-mods/rpmtw-update-mod)
[![](https://img.shields.io/modrinth/dt/ZukQzaRP?label=Modrinth%20Downloads)](https://modrinth.com/mod/ZukQzaRP)
<p>&nbsp;</p>
<p>&nbsp;</p>

#### 🌐 自叙文件语言

- [English](https://github.com/RPMTW/RPMTW-Platform-Mod/blob/main/README.md)
- [繁體中文](https://github.com/RPMTW/RPMTW-Platform-Mod/blob/main/README/zh_tw.md)
- 简体中文 (当前语言)
- [English](../../README.md)
- [繁體中文](zh_tw.md)
- 简体中文当前语言

## 📚 介绍

整合了RPMTW各项服务的MOD,涵盖翻译、百科、宇宙通信、中文输入优化等功能,让 Minecraft 中文玩家获得更好的游戏体验。
整合了 RPMTW 各项服务的 MOD,涵盖翻译、百科、宇宙通信、中文输入优化等功能,让 Minecraft 中文玩家获得更好的游戏体验。

## 🎨 特色功能

Expand All @@ -41,7 +41,7 @@

- ### 机器翻译

遇到没人工翻译的内容吗?全部交给 AI 吧!不再被语言隔阂导致无法游玩MOD
遇到没人工翻译的内容吗?全部交给 AI 吧!不再被语言隔阂导致无法游玩 MOD

- ### 开启 Crowdin 页面

Expand Down Expand Up @@ -73,4 +73,4 @@

## 🎓 许可证

[GNU 通用公共许可证 3.0 版 (GPL3)](https://www.gnu.org/licenses/gpl-3.0.html)
[GNU 通用公共许可证 3.0 版GPL3](https://www.gnu.org/licenses/gpl-3.0.html)
20 changes: 10 additions & 10 deletions README/zh_tw.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@

# RPMTW 平台

[![](https://img.shields.io/github/license/RPMTW/RPMTW-Platform-Mod.svg)](LICENSE)
[![](https://img.shields.io/github/release/RPMTW/RPMTW-Platform-Mod.svg)](https://github.com/RPMTW/RPMTW-Platform-Mod/releases)
![](http://cf.way2muchnoise.eu/versions/minecraft_rpmtw-update-mod_all.svg)
[![](http://cf.way2muchnoise.eu/rpmtw-update-mod.svg)](https://www.curseforge.com/minecraft/mc-mods/rpmtw-update-mod)
[![](https://img.shields.io/github/license/RPMTW/RPMTW-Platform-Mod.svg)](../LICENSE)
[![](https://img.shields.io/github/release/RPMTW/RPMTW-Platform-Mod.svg)](../../../releases)
![](https://cf.way2muchnoise.eu/versions/rpmtw-platform.svg)
[![](https://cf.way2muchnoise.eu/rpmtw-platform.svg)](https://www.curseforge.com/minecraft/mc-mods/rpmtw-update-mod)
[![](https://img.shields.io/modrinth/dt/ZukQzaRP?label=Modrinth%20Downloads)](https://modrinth.com/mod/ZukQzaRP)
<p></p>
<p>&nbsp;</p>

#### 🌐 說明檔案語言

- [English](https://github.com/RPMTW/RPMTW-Platform-Mod/blob/main/README.md)
- 繁體中文 (目前語言)
- [简体中文](https://github.com/RPMTW/RPMTW-Platform-Mod/blob/main/README/zh_cn.md)
- [English](../README.md)
- 繁體中文目前語言
- [简体中文](zh_cn.md)

## 📚 介紹

整合了RPMTW各項服務的模組,涵蓋翻譯、百科、宇宙通訊、中文輸入優化等功能,讓 Minecraft 中文玩家獲得更好的遊戲體驗。
整合了 RPMTW 各項服務的模組,涵蓋翻譯、百科、宇宙通訊、中文輸入優化等功能,讓 Minecraft 中文玩家獲得更好的遊戲體驗。

## 🎨 特色功能

Expand Down Expand Up @@ -64,7 +64,7 @@

### ️ 使用的技術

- [Kotlin](https://kotlinlang.org/)
- [Kotlin](https://kotlinlang.org)
- Java
- JVM
- [Architectury](https://github.com/architectury)
Expand All @@ -73,4 +73,4 @@

## 🎓 授權條款

[GNU 通用公眾授權條款 3.0 版 (GPL3)](https://www.gnu.org/licenses/gpl-3.0.html)
[GNU 通用公眾授權條款 3.0 版GPL3](https://www.gnu.org/licenses/gpl-3.0.html)
4 changes: 2 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
base
id("org.jetbrains.kotlin.jvm") version "1.6.10"
id("architectury-plugin") version "3.4.143"
id("dev.architectury.loom") version "1.0.+" apply false
id("architectury-plugin") version "3.4.146"
id("dev.architectury.loom") version "1.2.+" apply false
id("com.github.johnrengelman.shadow") version "7.1.2"
}

Expand Down
5 changes: 4 additions & 1 deletion common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,14 @@ dependencies {
// Remove the next line if you don't want to depend on the API
modApi("dev.architectury:architectury:${project.property("architectury_version").toString()}")
modApi("me.shedaniel.cloth:cloth-config:${project.property("cloth_config_version").toString()}")
modApi(
implementation(
group = "com.github.RPMTW",
name = "RPMTW-API-Client-Kotlin",
version = project.property("rpmtw_api_client_version").toString()
)
implementation("com.github.kittinunf.fuel:fuel:2.3.1")
implementation("com.github.kittinunf.fuel:fuel-gson:2.3.1")
implementation("com.github.kittinunf.fuel:fuel-coroutines:2.3.1")
modApi(group = "io.sentry", name = "sentry", version = project.property("sentry_version").toString())
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ public void handleComponentClick(Screen instance, String command, boolean bl) {

instance.sendMessage(command);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import com.rpmtw.rpmtw_platform_mod.command.CommandHandler
import com.rpmtw.rpmtw_platform_mod.config.RPMTWConfig
import com.rpmtw.rpmtw_platform_mod.handlers.EventHandler
import com.rpmtw.rpmtw_platform_mod.handlers.SentryHandler
import com.rpmtw.rpmtw_platform_mod.translation.GameLanguage
import dev.architectury.platform.Platform
import org.apache.logging.log4j.LogManager
import org.apache.logging.log4j.Logger
Expand All @@ -21,6 +22,7 @@ object RPMTWPlatformMod {
@JvmStatic
fun init() {
LOGGER.info("Initializing RPMTW Platform Mod")
GameLanguage.initialize()
if (RPMTWConfig.get().advanced.sendExceptionToSentry) {
SentryHandler.init()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ object CommandHandler {

fun init() {
val mainCommand = literal("rpmtw")
val commandList = listOf(UniverseMessageActionCommand(), LoginRPMTWAccountCommand())
val commandList =
listOf(UniverseMessageActionCommand(), LoginRPMTWAccountCommand(), LogoutRPMTWAccountCommand())

commandList.forEach {
mainCommand.then(it.register())
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.rpmtw.rpmtw_platform_mod.command

import com.mojang.brigadier.builder.LiteralArgumentBuilder
import com.rpmtw.rpmtw_platform_mod.handlers.RPMTWAuthHandler
import net.minecraft.commands.SharedSuggestionProvider

class LogoutRPMTWAccountCommand : RPMTWCommand() {
override fun register(): LiteralArgumentBuilder<SharedSuggestionProvider> {
val command = literal("logout").executes {
RPMTWAuthHandler.logout()

return@executes CommandHandler.success
}

return command
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ class ConfigObject : ConfigData {
val advanced = Advanced()

class Translate {
@ConfigEntry.Gui.Tooltip(count = 1)
@ConfigEntry.Gui.RequiresRestart
var loadTranslateResourcePack = GameLanguage.getSystem() == GameLanguage.TraditionalChinese

@ConfigEntry.Gui.Tooltip(count = 1)
@ConfigEntry.Gui.RequiresRestart
var machineTranslation = true
Expand All @@ -45,16 +49,6 @@ class ConfigObject : ConfigData {
}
}

@ConfigEntry.Gui.Tooltip(count = 1)
@ConfigEntry.Gui.RequiresRestart
var loadTranslateResourcePack = false
get() {
return if (GameLanguage.getSystem() == GameLanguage.TraditionalChinese) {
true
} else {
field
}
}

@ConfigEntry.Gui.Tooltip(count = 1)
@ConfigEntry.Gui.RequiresRestart
Expand Down Expand Up @@ -106,6 +100,8 @@ class ConfigObject : ConfigData {
var sendExceptionToSentry = true
}

@ConfigEntry.Gui.Excluded
var protocolVersion : Int? = null

@ConfigEntry.Gui.Excluded
var rpmtwAuthToken: String? = null
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
package com.rpmtw.rpmtw_platform_mod.config

import com.mojang.blaze3d.vertex.PoseStack
import com.rpmtw.rpmtw_platform_mod.handlers.RPMTWAuthHandler
import me.shedaniel.clothconfig2.api.AbstractConfigListEntry
import net.minecraft.client.Minecraft
import net.minecraft.client.gui.components.AbstractWidget
import net.minecraft.client.gui.components.Button
import net.minecraft.client.gui.components.events.GuiEventListener
import net.minecraft.client.gui.narration.NarratableEntry
import net.minecraft.client.resources.language.I18n
import net.minecraft.network.chat.TextComponent
import net.minecraft.network.chat.TranslatableComponent
import java.util.*


class RPMTWAccountEntry : AbstractConfigListEntry<Any?>(
TextComponent(
UUID.randomUUID().toString()
), false
) {
private val widgets: MutableList<AbstractWidget?> = ArrayList()
override fun getItemHeight(): Int {
return 48
}

override fun narratables(): List<NarratableEntry?> {
return widgets
}

override fun getValue(): Any {
return Any()
}

@Suppress("UNCHECKED_CAST")
override fun getDefaultValue(): Optional<Any?> {
return Optional.of(Any()) as Optional<Any?>
}

override fun save() {

}

override fun isMouseInside(mouseX: Int, mouseY: Int, x: Int, y: Int, entryWidth: Int, entryHeight: Int): Boolean {
return false
}

override fun render(
matrices: PoseStack,
index: Int,
y: Int,
x: Int,
entryWidth: Int,
entryHeight: Int,
mouseX: Int,
mouseY: Int,
isHovered: Boolean,
delta: Float
) {
super.render(matrices, index, y, x, entryWidth, entryHeight, mouseX, mouseY, isHovered, delta)

val title = TranslatableComponent("auth.rpmtw_platform_mod.title")
val isLogin = RPMTWConfig.get().isLogin()
val authStatus: String = if (isLogin) {
I18n.get("auth.rpmtw_platform_mod.status.logged_in")
} else {
I18n.get("auth.rpmtw_platform_mod.status.not_logged_in")
}

if (!isLogin) {
val loginButton = Button(entryWidth / 2 + 20,
y + 10,
65,
20,
TranslatableComponent("auth.rpmtw_platform_mod.button.login"),
{
RPMTWAuthHandler.login()
},
{ _, matrixStack, i, j ->
Minecraft.getInstance().screen?.renderTooltip(
matrixStack, TranslatableComponent("auth.rpmtw_platform_mod.button.login.tooltip"), i, j
)
})

widgets.add(loginButton)
loginButton.render(matrices, mouseX, mouseY, delta)
} else {
val logoutButton = Button(
entryWidth / 2 + 20, y + 10, 65, 20, TranslatableComponent("auth.rpmtw_platform_mod.button.logout")
) {
RPMTWAuthHandler.logout()
}

widgets.add(logoutButton)
logoutButton.render(matrices, mouseX, mouseY, delta)
}

val font = Minecraft.getInstance().font

font.drawShadow(
matrices,
title,
(x - 4 + entryWidth / 2 - Minecraft.getInstance().font.width(title) / 2).toFloat(),
(y).toFloat(),
-1
)

font.drawShadow(
matrices,
authStatus,
(x - 4 + entryWidth / 2 - Minecraft.getInstance().font.width(authStatus) / 2).toFloat(),
(y + 33).toFloat(),
-1
)
}

override fun children(): List<GuiEventListener?> {
return widgets
}
}
Loading

0 comments on commit f3112d1

Please sign in to comment.