From 54cd3e3a2382a61fb2aa55980763f14ed5cb9403 Mon Sep 17 00:00:00 2001 From: Unknown Date: Wed, 2 Jan 2019 15:26:54 +0800 Subject: More Language Support --- src/main/java/me/shedaniel/ClientListener.java | 20 ++++++++------------ src/main/java/me/shedaniel/gui/ConfigGui.java | 6 +++--- src/main/java/me/shedaniel/gui/REIRenderHelper.java | 2 +- .../shedaniel/listeners/DrawContainerListener.java | 1 + .../assets/roughlyenoughitems/lang/zh_cn.json | 20 ++++++++++++++++++++ .../assets/roughlyenoughitems/lang/zh_tw.json | 10 +++++++--- 6 files changed, 40 insertions(+), 19 deletions(-) create mode 100644 src/main/resources/assets/roughlyenoughitems/lang/zh_cn.json (limited to 'src') diff --git a/src/main/java/me/shedaniel/ClientListener.java b/src/main/java/me/shedaniel/ClientListener.java index abfed4b7f..18fb26130 100755 --- a/src/main/java/me/shedaniel/ClientListener.java +++ b/src/main/java/me/shedaniel/ClientListener.java @@ -6,9 +6,6 @@ import me.shedaniel.impl.REIRecipeManager; import me.shedaniel.library.KeyBindFunction; import me.shedaniel.listenerdefinitions.DoneLoading; import me.shedaniel.listenerdefinitions.RecipeLoadListener; -import net.fabricmc.api.ClientModInitializer; -import net.fabricmc.api.ModInitializer; -import net.minecraft.client.settings.KeyBinding; import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.item.Item; @@ -18,20 +15,19 @@ import net.minecraft.recipe.RecipeManager; import net.minecraft.util.DefaultedList; import net.minecraft.util.registry.Registry; -import java.awt.event.KeyEvent; import java.util.*; public class ClientListener implements DoneLoading, RecipeLoadListener { - public static KeyBindFunction recipeKeybind; - public static KeyBindFunction hideKeybind; - public static KeyBindFunction useKeybind; + public static KeyBindFunction recipeKeyBind; + public static KeyBindFunction hideKeyBind; + public static KeyBindFunction usageKeyBind; public static List keyBinds = new ArrayList<>(); private List plugins; public static List stackList; - public static boolean processGuiKeybinds(int typedChar) { + public static boolean processGuiKeyBinds(int typedChar) { for(KeyBindFunction keyBind : keyBinds) if (keyBind.apply(typedChar)) return true; @@ -47,7 +43,7 @@ public class ClientListener implements DoneLoading, RecipeLoadListener { } public void onInitializeKeyBind() { - recipeKeybind = new KeyBindFunction(Core.config.recipeKeyBind) { + recipeKeyBind = new KeyBindFunction(Core.config.recipeKeyBind) { @Override public boolean apply(int key) { if (key == this.getKey()) @@ -55,7 +51,7 @@ public class ClientListener implements DoneLoading, RecipeLoadListener { return key == this.getKey(); } }; - hideKeybind = new KeyBindFunction(Core.config.hideKeyBind) { + hideKeyBind = new KeyBindFunction(Core.config.hideKeyBind) { @Override public boolean apply(int key) { if (key == this.getKey()) @@ -63,7 +59,7 @@ public class ClientListener implements DoneLoading, RecipeLoadListener { return key == this.getKey(); } }; - useKeybind = new KeyBindFunction(Core.config.usageKeyBind) { + usageKeyBind = new KeyBindFunction(Core.config.usageKeyBind) { @Override public boolean apply(int key) { if (key == this.getKey()) @@ -71,7 +67,7 @@ public class ClientListener implements DoneLoading, RecipeLoadListener { return key == this.getKey(); } }; - keyBinds.addAll(Arrays.asList(recipeKeybind, hideKeybind, useKeybind)); + keyBinds.addAll(Arrays.asList(recipeKeyBind, hideKeyBind, usageKeyBind)); } private void buildItemList() { diff --git a/src/main/java/me/shedaniel/gui/ConfigGui.java b/src/main/java/me/shedaniel/gui/ConfigGui.java index 31a1c3feb..6d67488f8 100644 --- a/src/main/java/me/shedaniel/gui/ConfigGui.java +++ b/src/main/java/me/shedaniel/gui/ConfigGui.java @@ -21,7 +21,7 @@ public class ConfigGui extends Gui { protected void onInitialized() { addButton(new KeyBindButton(997, parent.width / 2 - 20, 30, 80, 20, Core.config.recipeKeyBind, key -> { Core.config.recipeKeyBind = key; - ClientListener.recipeKeybind.setKey(key); + ClientListener.recipeKeyBind.setKey(key); try { Core.saveConfig(); } catch (IOException e) { @@ -30,7 +30,7 @@ public class ConfigGui extends Gui { })); addButton(new KeyBindButton(997, parent.width / 2 - 20, 60, 80, 20, Core.config.usageKeyBind, key -> { Core.config.usageKeyBind = key; - ClientListener.useKeybind.setKey(key); + ClientListener.usageKeyBind.setKey(key); try { Core.saveConfig(); } catch (IOException e) { @@ -39,7 +39,7 @@ public class ConfigGui extends Gui { })); addButton(new KeyBindButton(997, parent.width / 2 - 20, 90, 80, 20, Core.config.hideKeyBind, key -> { Core.config.hideKeyBind = key; - ClientListener.hideKeybind.setKey(key); + ClientListener.hideKeyBind.setKey(key); try { Core.saveConfig(); } catch (IOException e) { diff --git a/src/main/java/me/shedaniel/gui/REIRenderHelper.java b/src/main/java/me/shedaniel/gui/REIRenderHelper.java index a60ca45e4..f4e66808a 100755 --- a/src/main/java/me/shedaniel/gui/REIRenderHelper.java +++ b/src/main/java/me/shedaniel/gui/REIRenderHelper.java @@ -154,7 +154,7 @@ public class REIRenderHelper { handled = true; } if (!handled) { - return ClientListener.processGuiKeybinds(typedChar); + return ClientListener.processGuiKeyBinds(typedChar); } return handled; } diff --git a/src/main/java/me/shedaniel/listeners/DrawContainerListener.java b/src/main/java/me/shedaniel/listeners/DrawContainerListener.java index 66093515b..02eda4b41 100755 --- a/src/main/java/me/shedaniel/listeners/DrawContainerListener.java +++ b/src/main/java/me/shedaniel/listeners/DrawContainerListener.java @@ -2,6 +2,7 @@ package me.shedaniel.listeners; import me.shedaniel.gui.REIRenderHelper; import me.shedaniel.listenerdefinitions.*; +import net.fabricmc.fabric.networking.CustomPayloadPacketRegistry; import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.ContainerGui; import net.minecraft.client.gui.Gui; diff --git a/src/main/resources/assets/roughlyenoughitems/lang/zh_cn.json b/src/main/resources/assets/roughlyenoughitems/lang/zh_cn.json new file mode 100644 index 000000000..01747bb0e --- /dev/null +++ b/src/main/resources/assets/roughlyenoughitems/lang/zh_cn.json @@ -0,0 +1,20 @@ +{ + "key.rei.category": "Roughly Enough Items", + "key.rei.recipe": "显示配方", + "key.rei.hide": "隐藏/显示REI", + "key.rei.use": "显示用途", + "text.rei.cheat": "作弊", + "text.rei.nocheat": "§4§m作弊", + "text.rei.mod": "§9§o%s", + "category.rei.crafting": "合成", + "category.rei.smelting": "冶炼", + "category.rei.smelting.fuel": "§e燃料", + "category.rei.smoking": "烟熏", + "category.rei.blasting": "熔炼", + "category.rei.brewing": "酿造", + "category.rei.brewing.input": "§e输入药水", + "category.rei.brewing.reactant": "§e材料", + "category.rei.brewing.result": "§e输出药水", + "text.rei.config": "设置", + "text.rei.listeningkey": "正聆听按键" +} \ No newline at end of file diff --git a/src/main/resources/assets/roughlyenoughitems/lang/zh_tw.json b/src/main/resources/assets/roughlyenoughitems/lang/zh_tw.json index f81f0dc55..a2b6ff382 100644 --- a/src/main/resources/assets/roughlyenoughitems/lang/zh_tw.json +++ b/src/main/resources/assets/roughlyenoughitems/lang/zh_tw.json @@ -1,5 +1,5 @@ { - "key.rei.category": "大致足夠的物品(REI)", + "key.rei.category": "Roughly Enough Items", "key.rei.recipe": "顯示配方", "key.rei.hide": "隱藏/顯示REI", "key.rei.use": "顯示用途", @@ -9,8 +9,12 @@ "category.rei.crafting": "合成", "category.rei.smelting": "冶煉", "category.rei.smelting.fuel": "§e燃料", + "category.rei.smoking": "煙燻", + "category.rei.blasting": "熔煉", "category.rei.brewing": "釀造", "category.rei.brewing.input": "§e輸入藥水", "category.rei.brewing.reactant": "§e材料", - "category.rei.brewing.result": "§e輸出藥水" -} + "category.rei.brewing.result": "§e輸出藥水", + "text.rei.config": "設置", + "text.rei.listeningkey": "正聆聽按鍵" +} \ No newline at end of file -- cgit