Skip to content

Commit

Permalink
• Added Ukrainian translation by Yuraplonka (#117)
Browse files Browse the repository at this point in the history
• Added Chinese translation by MiniDay (#126)
• Fixed #129
  • Loading branch information
Apehum committed Dec 4, 2021
1 parent 41ccd5d commit 97560bc
Show file tree
Hide file tree
Showing 18 changed files with 303 additions and 31 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ classes/
.settings
*.launch
curseforge_key.txt
changelog.txt
modrinth_key.txt
changelog.md
4 changes: 2 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ val minecraftVersion: String by rootProject

plugins {
java
id("com.modrinth.minotaur") version("1.2.1") apply(false)
id("architectury-plugin") version("3.3-SNAPSHOT")
id("dev.architectury.loom") version("0.7.4-SNAPSHOT") apply(false)
id("com.github.johnrengelman.shadow") version("7.0.0") apply(false)
Expand All @@ -29,8 +30,7 @@ allprojects {
apply(plugin = "architectury-plugin")
apply(plugin = "com.github.johnrengelman.shadow")
apply(plugin = "com.matthewprenger.cursegradle")

// java { toolchain { languageVersion.set(JavaLanguageVersion.of(16)) } }
apply(plugin = "com.modrinth.minotaur")

tasks.withType<JavaCompile>().configureEach {
options.encoding = "UTF-8"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ public class AboutTabWidget extends TabWidget {
),
"nl_nl", ImmutableList.of(
new Translator(new GameProfile(UUID.fromString("db7dce6f-3f20-4c35-b8ca-83b51658ac92"), "EEstar"), "GitHub", "/~https://github.com/emielderckx")
),
"uk_ua", ImmutableList.of(
new Translator(new GameProfile(UUID.fromString("b149c762-6da3-41b4-8db7-0e87330fb9aa"), "_ProSplash_"), "GitHub", "/~https://github.com/Yuraplonka")
)
);
private final VoiceSettingsScreen parent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,11 @@ public AdvancedTabWidget(Minecraft client, VoiceSettingsScreen parent) {
this.addEntry(new OptionEntry(
new TranslatableComponent("gui.plasmo_voice.advanced.hrtf"),
new ToggleButton(0, 0, 97, 20, config.hrtf,
toggled -> VoiceClient.getSoundEngine().restart()),
toggled -> VoiceClient.getSoundEngine().init()),
config.hrtf,
TextUtils.multiLine("gui.plasmo_voice.advanced.hrtf.tooltip", 7),
(button, element) -> {
VoiceClient.getSoundEngine().restart();
VoiceClient.getSoundEngine().init();
((ToggleButton) element).updateValue();
})
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public GeneralTabWidget(Minecraft client, VoiceSettingsScreen parent) {
VoiceClient.getClientConfig().save();

// restart sound engine
VoiceClient.getSoundEngine().restart();
VoiceClient.getSoundEngine().init();
}),
VoiceClient.getClientConfig().speaker,
(button, element) -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public static void closeAll() {

private void queuePacket(VoiceServerPacket packet, UUID uuid) {
AbstractSoundQueue ch = audioChannels.get(uuid);
if (ch == null) {
if (ch == null || ch.isClosed()) {
VoiceClient.getServerConfig().getClients().add(uuid);
if (packet instanceof VoiceServerPacket) {
ch = new OpenALPlayerQueue(uuid);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,6 @@ public CustomSoundEngine() {
this.executor = Executors.newScheduledThreadPool(1);
}

public void restart() {
SocketClientUDPQueue.audioChannels
.values()
.forEach(AbstractSoundQueue::closeAndKill);
SocketClientUDPQueue.audioChannels.clear();

this.close();
this.init();
}

public CustomSource createSource() {
return this.initialized ? CustomSource.create() : null;
}
Expand All @@ -73,7 +63,8 @@ public void init() {
this.runInContext(this::initSync);
}

public void initSync() {
private void initSync() {
this.close();
this.preInit();

this.devicePointer = openDevice();
Expand Down Expand Up @@ -150,6 +141,11 @@ public void initSync() {
}

public synchronized void close() {
SocketClientUDPQueue.audioChannels
.values()
.forEach(AbstractSoundQueue::closeAndKill);
SocketClientUDPQueue.audioChannels.clear();

if (this.initialized) {
this.executor.submit(() -> {
if (Minecraft.getInstance().screen instanceof VoiceSettingsScreen screen) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ public void run() {
EXTThreadLocalContext.alcSetThreadContext(VoiceClient.getSoundEngine().getContextPointer());

this.source = VoiceClient.getSoundEngine().createSource();
if (this.source == null) {
stopped = true;
return;
}
this.source.setPitch(1.0F);
this.source.setLooping(false);
this.source.setRelative(false);
Expand Down
192 changes: 192 additions & 0 deletions common/src/main/resources/assets/plasmo_voice/lang/zh_cn.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
{
"key.plasmo_voice.ptt": "按键说话按钮",
"key.plasmo_voice.priority_ptt": "重要发言按钮",
"key.plasmo_voice.settings": "声音设定",
"key.plasmo_voice.mute": "禁用麦克风",
"key.plasmo_voice.mute_chat": "禁用语音聊天",
"key.plasmo_voice.action": "动作按钮",

"key.plasmo_voice.distance": "声音距离",
"key.plasmo_voice.distance.increase": "增加声音距离",
"key.plasmo_voice.distance.decrease": "减少声音距离",

"key.plasmo_voice.occlusion": "声音阻挡",
"key.plasmo_voice.occlusion.toggle": "切换障碍物阻挡声音",

"gui.plasmo_voice.player_volume": "玩家音量: %s",
"gui.plasmo_voice.close": "关闭",
"gui.plasmo_voice.on": "",
"gui.plasmo_voice.off": "",

"gui.plasmo_voice.title": "%s 设置",


"gui.plasmo_voice.toggle.microphone": "麦克风",
"gui.plasmo_voice.toggle.voice": "语音聊天",
"gui.plasmo_voice.toggle.currently": "当前状态: %s",
"gui.plasmo_voice.toggle.enabled": "开启",
"gui.plasmo_voice.toggle.disabled": "关闭",



"gui.plasmo_voice.general": "通用",


"gui.plasmo_voice.general.audio": "音频",
"gui.plasmo_voice.general.output_device": "输出设备",
"gui.plasmo_voice.general.voice_chat_volume": "普通聊天音量",
"gui.plasmo_voice.general.voice_chat_volume.tooltip_1": "将音量设置到超过 100%",
"gui.plasmo_voice.general.voice_chat_volume.tooltip_2": "可能会导致声音失真.",
"gui.plasmo_voice.general.voice_chat_volume.priority": "重要发言音量",
"gui.plasmo_voice.general.occlusion": "声音阻挡",
"gui.plasmo_voice.general.occlusion.tooltip_1": "从玩家向每个声源投射一条射线,",
"gui.plasmo_voice.general.occlusion.tooltip_2": "并在有障碍物的情况下消减声音.",
"gui.plasmo_voice.general.occlusion.tooltip_3": "",
"gui.plasmo_voice.general.occlusion.tooltip_4": "如果你不想听到隔壁房间里的玩家的声音,那就很有用",
"gui.plasmo_voice.general.occlusion.tooltip_5": "但有时候可能会无法正常工作,",
"gui.plasmo_voice.general.occlusion.tooltip_6": "所以当你不需要时最好禁用该选项.",

"gui.plasmo_voice.general.microphone": "麦克风",
"gui.plasmo_voice.general.microphone.volume": "麦克风音量",
"gui.plasmo_voice.general.voice_distance": "声音距离",
"gui.plasmo_voice.general.voice_distance.tooltip_1": "设定在多少距离内的玩家能够听到你的声音,",
"gui.plasmo_voice.general.voice_distance.tooltip_2": "这个距离的单位为方块.",
"gui.plasmo_voice.general.priority_distance": "重要发言声音距离",
"gui.plasmo_voice.general.priority_distance.tooltip_1": "重要发言有一个单独的按钮",
"gui.plasmo_voice.general.priority_distance.tooltip_2": "可以设置更大的音量和更远的收听距离.",
"gui.plasmo_voice.general.priority_distance.tooltip_3": "",
"gui.plasmo_voice.general.priority_distance.tooltip_4": "需要在服务器上拥有权限,",
"gui.plasmo_voice.general.priority_distance.tooltip_5": "而且不要忘记给它绑定一个按键.",
"gui.plasmo_voice.general.not_available": "无法使用",

"gui.plasmo_voice.general.activation": "激活",
"gui.plasmo_voice.general.activation.type": "麦克风激活类型",
"gui.plasmo_voice.general.activation.type.tooltip_1": "按键发言:",
"gui.plasmo_voice.general.activation.type.tooltip_2": "你需要按下按键才能让别人听到你的声音。",
"gui.plasmo_voice.general.activation.type.tooltip_3": "自由发言:",
"gui.plasmo_voice.general.activation.type.tooltip_4": "当你的麦克风声音超过设定阈值时,",
"gui.plasmo_voice.general.activation.type.tooltip_5": "其他玩家就能听到你的声音.",
"gui.plasmo_voice.general.activation.ptt": "按键发言",
"gui.plasmo_voice.general.activation.voice": "自由发言",
"gui.plasmo_voice.general.activation.threshold": "激活阈值",
"gui.plasmo_voice.general.activation.threshold.tooltip_1": "只有当激活类型为 '自由发言'时,",
"gui.plasmo_voice.general.activation.threshold.tooltip_2": "这个选项才会启用.",
"gui.plasmo_voice.general.activation.threshold.tooltip_3": "",
"gui.plasmo_voice.general.activation.threshold.tooltip_4": "将滑块移动到一个合适的位置,",
"gui.plasmo_voice.general.activation.threshold.tooltip_5": "来让你的麦克风音量仅在你说话时超过它.",
"gui.plasmo_voice.general.activation.threshold.tooltip_6": "",
"gui.plasmo_voice.general.activation.threshold.tooltip_7": "你可以点击右方的麦克风按钮",
"gui.plasmo_voice.general.activation.threshold.tooltip_8": "来测试你的麦克风声音.",


"gui.plasmo_voice.general.icons": "图标",
"gui.plasmo_voice.general.icons.tooltip_1": "仅界面: 麦克风启用提示会一直显示",
"gui.plasmo_voice.general.icons.tooltip_2": "除非你按下 F1 关闭界面.",
"gui.plasmo_voice.general.icons.tooltip_3": "",
"gui.plasmo_voice.general.icons.tooltip_4": "总是显示: 麦克风启用提示会一直显示,",
"gui.plasmo_voice.general.icons.tooltip_5": "即使你已经按下了 F1 关闭界面.",
"gui.plasmo_voice.general.icons.tooltip_6": "",
"gui.plasmo_voice.general.icons.tooltip_7": "隐藏: 麦克风启用提示不会显示.",
"gui.plasmo_voice.general.icons.show": "显示图标",
"gui.plasmo_voice.general.icons.hud": "仅界面",
"gui.plasmo_voice.general.icons.always": "总是显示",
"gui.plasmo_voice.general.icons.hidden": "隐藏",
"gui.plasmo_voice.general.icons.position": "图标位置",
"gui.plasmo_voice.general.icons.position.choose": "选择麦克风启用提示图标的显示位置",
"gui.plasmo_voice.general.icons.position.top_left": "左上方",
"gui.plasmo_voice.general.icons.position.top_center": "中上方",
"gui.plasmo_voice.general.icons.position.top_right": "右上方",
"gui.plasmo_voice.general.icons.position.bottom_left": "左下方",
"gui.plasmo_voice.general.icons.position.bottom_center": "中下方",
"gui.plasmo_voice.general.icons.position.bottom_right": "右下方",


"gui.plasmo_voice.advanced": "高级",

"gui.plasmo_voice.advanced.noise_reduction": "噪音抑制",
"gui.plasmo_voice.advanced.rnnoise": "RNNoise",
"gui.plasmo_voice.advanced.rnnoise.tooltip_1": "RNNoise 噪声抑制.",
"gui.plasmo_voice.advanced.rnnoise.tooltip_2": "",
"gui.plasmo_voice.advanced.rnnoise.tooltip_3": "使用 AI 神经网络来抑制噪声,",
"gui.plasmo_voice.advanced.rnnoise.tooltip_4": "效果很好,但是对 CPU 有一定的负担.",
"gui.plasmo_voice.advanced.rnnoise.tooltip_5": "",
"gui.plasmo_voice.advanced.rnnoise.tooltip_6": "用于对你的麦克风录制的声音进行处理.",
"gui.plasmo_voice.advanced.microphone_testing": "麦克风测试",

"gui.plasmo_voice.advanced.engine": "音频引擎",
"gui.plasmo_voice.advanced.hrtf": "HRTF",
"gui.plasmo_voice.advanced.hrtf.tooltip_1": "提高音频定位的准确性,",
"gui.plasmo_voice.advanced.hrtf.tooltip_2": "让你更容易理解发出声音的玩家在那里",
"gui.plasmo_voice.advanced.hrtf.tooltip_3": "听起来就像声音来自 3D 空间.",
"gui.plasmo_voice.advanced.hrtf.tooltip_4": "",
"gui.plasmo_voice.advanced.hrtf.tooltip_5": "可能会略微降低音频质量.",
"gui.plasmo_voice.advanced.hrtf.tooltip_6": "",
"gui.plasmo_voice.advanced.hrtf.tooltip_7": "用于对其他玩家的声音进行处理.",
"gui.plasmo_voice.advanced.directional_sources": "音源定向",
"gui.plasmo_voice.advanced.directional_sources.tooltip_1": "如果说话的玩家没有直视你,",
"gui.plasmo_voice.advanced.directional_sources.tooltip_2": "或视线与你的位置超出了一定的角度,",
"gui.plasmo_voice.advanced.directional_sources.tooltip_3": "那么就会会让你听到的声音稍微降低一点.",
"gui.plasmo_voice.advanced.directional_sources.tooltip_4": "",
"gui.plasmo_voice.advanced.directional_sources.tooltip_5": "用于对其他玩家的声音进行处理.",
"gui.plasmo_voice.advanced.directional_sources_angle": "音源角度",
"gui.plasmo_voice.advanced.directional_sources_angle.tooltip_1": "当你的位置与发出声音的玩家的视线角度小于该值时",
"gui.plasmo_voice.advanced.directional_sources_angle.tooltip_2": "你将能听到 100% 音量的声音。",
"gui.plasmo_voice.advanced.directional_sources_angle.tooltip_3": "",
"gui.plasmo_voice.advanced.directional_sources_angle.tooltip_4": "设置成 360 就相当于把 '音源定向' 它关闭了.",

"gui.plasmo_voice.advanced.compressor": "压缩器 & 限制器",
"gui.plasmo_voice.advanced.compressor.tooltip_1": "让声音更安静,",
"gui.plasmo_voice.advanced.compressor.tooltip_2": "避免你的耳朵受到噪音的伤害.",
"gui.plasmo_voice.advanced.compressor.tooltip_3": "",
"gui.plasmo_voice.advanced.compressor.tooltip_4": "用于对其他玩家的声音进行处理.",
"gui.plasmo_voice.advanced.compressor.threshold": "压缩器阈值",
"gui.plasmo_voice.advanced.compressor.threshold.tooltip_1": "如果声音的音量超过阈值",
"gui.plasmo_voice.advanced.compressor.threshold.tooltip_2": "则降低音量以保护你的耳朵.",
"gui.plasmo_voice.advanced.compressor.threshold.tooltip_3": "",
"gui.plasmo_voice.advanced.compressor.threshold.tooltip_4": "推荐数值: -16 dB 到 -6 dB 之间",
"gui.plasmo_voice.advanced.limiter.threshold": "限制器阈值",
"gui.plasmo_voice.advanced.limiter.threshold.tooltip_1": "声音始终不可能超过该值.",
"gui.plasmo_voice.advanced.limiter.threshold.tooltip_2": "",
"gui.plasmo_voice.advanced.limiter.threshold.tooltip_3": "推荐数值: -6 dB",

"gui.plasmo_voice.advanced.visual_ui": "可视界面",
"gui.plasmo_voice.advanced.visual_ui.distance": "可视化语音距离",
"gui.plasmo_voice.advanced.visual_ui.distance.join": "在加入时显示语音距离",
"gui.plasmo_voice.advanced.visual_ui.priority": "Separate priority volume",
"gui.plasmo_voice.advanced.visual_ui.priority.tooltip_1": "In the general tab there will be",
"gui.plasmo_voice.advanced.visual_ui.priority.tooltip_2": "two volume sliders, instead of one",


"gui.plasmo_voice.hotkeys": "热键",


"gui.plasmo_voice.about.made_by": "%s 由以下人员制作",
"gui.plasmo_voice.about.huix": "概念 & 设计",
"gui.plasmo_voice.about.programming": "程序设计",
"gui.plasmo_voice.about.artist": "艺术设计",
"gui.plasmo_voice.about.translator": "%s 翻译",

"gui.plasmo_voice.about.links": "%s",
"gui.plasmo_voice.about.copyright": "请仅使用官方来源,未经我们许可,请勿重新发布该模组",


"gui.plasmo_voice.not_available": "此服务器上未安装 Plasmo Voice",
"gui.plasmo_voice.connecting": "连接到 UDP 服务器中...",
"gui.plasmo_voice.cannot_connect_to_udp_1": "无法连接至 UDP 服务器,",
"gui.plasmo_voice.cannot_connect_to_udp_2": "UDP 端口可能已关闭。请查阅维基资料: ",
"gui.plasmo_voice.cannot_connect_to_udp_3": "%s",

"message.plasmo_voice.min_version": "§6[Plasmo Voice]§7 版本已过时。服务器支持的最低版本为 %s",
"message.plasmo_voice.version_not_supported": "§6[Plasmo Voice]§7 版本还不受支持。当前支持的版本为 %s",
"message.plasmo_voice.new_version_available": "§6[Plasmo Voice]§7 有新版本可用 [%s§7]. 下载地址: %s",

"message.plasmo_voice.distance_changed": "语音聊天距离已设置为: %d",
"message.plasmo_voice.occlusion_changed": "声音阻挡: %s",

"commands.plasmo_voice.whitelist_on": "全体禁言已开启.",
"commands.plasmo_voice.whitelist_off": "全体禁言已关闭.",

"commands.plasmo_voice.min_priority_distance": "§6[Plasmo Voice]§7 重要发言距离必须大于 %d",
"commands.plasmo_voice.max_priority_distance": "§6[Plasmo Voice]§7 重要发言距离必须小于 %d",
"commands.plasmo_voice.priority_distance_set": "§6[Plasmo Voice]§7 重要发言距离已设置为: %d"
}
32 changes: 31 additions & 1 deletion fabric/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,25 @@ import com.matthewprenger.cursegradle.CurseArtifact
import com.matthewprenger.cursegradle.CurseProject
import com.matthewprenger.cursegradle.CurseRelation
import com.matthewprenger.cursegradle.Options
import com.modrinth.minotaur.TaskModrinthUpload
import com.modrinth.minotaur.request.VersionType
import net.fabricmc.loom.task.RemapJarTask

val minecraftVersion: String by rootProject
val fabricLoaderVersion: String by rootProject
val fabricVersion: String by rootProject
val modVersion: String by rootProject
val mavenGroup: String by rootProject

val curseProjectId: String by rootProject
val curseFabricRelease: String by rootProject
val curseDisplayVersion: String by rootProject
val curseSupportedVersions: String by rootProject

val modrinthVersionType: String by rootProject
val modrinthSupportedVersions: String by rootProject
val modrinthProjectId: String by rootProject

configurations {
create("shadowCommon")
}
Expand Down Expand Up @@ -129,6 +136,27 @@ tasks {

val remapJar = tasks.getByName<RemapJarTask>("remapJar")

tasks.register<TaskModrinthUpload>("publishModrinth") {
token = if (file("${rootDir}/modrinth_key.txt").exists()) {
file("${rootDir}/modrinth_key.txt").readText()
} else {
""
}

projectId = modrinthProjectId

versionNumber = "fabric-$curseDisplayVersion-$version"
versionName = "[Fabric ${curseDisplayVersion}] Plasmo Voice $version"
versionType = VersionType.valueOf(modrinthVersionType)

modrinthSupportedVersions.split(",").forEach {
addGameVersion(it)
}
changelog = file("${rootDir}/changelog.md").readText()
addLoader("fabric")
uploadFile = file("${project.buildDir}/libs/${remapJar.archiveBaseName.get()}-${version}.jar")
}

curseforge {
apiKey = if (file("${rootDir}/curseforge_key.txt").exists()) {
file("${rootDir}/curseforge_key.txt").readText()
Expand All @@ -138,7 +166,8 @@ curseforge {

project(closureOf<CurseProject> {
id = curseProjectId
changelog = file("${rootDir}/changelog.txt")
changelogType = "markdown"
changelog = file("${rootDir}/changelog.md")
releaseType = curseFabricRelease
curseSupportedVersions.split(",").forEach {
addGameVersion(it)
Expand All @@ -162,5 +191,6 @@ curseforge {

options(closureOf<Options> {
forgeGradleIntegration = false
javaVersionAutoDetect = false
})
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

@Mixin(Library.class)
public abstract class MixinSoundEngine {
@Inject(method = "init", at = @At("HEAD"))
@Inject(method = "init", at = @At("RETURN"))
private void init(CallbackInfo ci) {
VoiceClient.getSoundEngine().init();
}
Expand Down
Loading

0 comments on commit 97560bc

Please sign in to comment.