Skip to content

Commit 00b95ee

Browse files
committed
[Common] Add documentation to language manager, renamed method
1 parent 4caf86d commit 00b95ee

File tree

2 files changed

+18
-14
lines changed

2 files changed

+18
-14
lines changed

src/main/java/com/minecrafttas/mctcommon/LanguageManager.java

+8-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ public class LanguageManager {
2222
private static final Pattern PATTERN = Pattern.compile("%(\\d+\\$)?[\\d\\.]*[df]");
2323

2424
public static void onResourceManagerReload(Map<String, String> original, IResourceManager iResourceManager, List<String> languageList) {
25-
2625
for (String language : languageList) { // Go through all loaded languages
2726
language = language.toLowerCase(); // Set everything to lowercase which prevents headaches in 1.10.2 and below
2827
for (String modid : modids) { // Iterate through all registered modids
@@ -72,7 +71,14 @@ private static HashMap<String, String> getFromResourcePack(IResourceManager iRes
7271
return out;
7372
}
7473

75-
public static void registerModForLanguageManager(String modid) {
74+
/**
75+
* Registers your mod to be processed by the language manager<br>
76+
* This will allow you to add .json and/or .lang files to assets/modid/lang<br>
77+
* with en_us.lang/en_us.json (<strong>lowercase!</strong>)
78+
*
79+
* @param modid The modid of your mod
80+
*/
81+
public static void registerMod(String modid) {
7682
modids.add(modid);
7783
}
7884

src/main/java/com/minecrafttas/tasmod/TASmodClient.java

+10-12
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,6 @@
11
package com.minecrafttas.tasmod;
22

3-
import static com.minecrafttas.tasmod.TASmod.LOGGER;
4-
5-
import java.io.File;
6-
import java.io.IOException;
7-
import java.util.ArrayList;
8-
import java.util.List;
9-
103
import com.minecrafttas.common.LanguageManager;
11-
import org.apache.logging.log4j.Level;
12-
import org.lwjgl.input.Keyboard;
13-
144
import com.minecrafttas.mctcommon.Configuration;
155
import com.minecrafttas.mctcommon.Configuration.ConfigOptions;
166
import com.minecrafttas.mctcommon.KeybindManager;
@@ -38,7 +28,6 @@
3828
import com.minecrafttas.tasmod.util.ShieldDownloader;
3929
import com.minecrafttas.tasmod.virtual.VirtualInput;
4030
import com.minecrafttas.tasmod.virtual.VirtualKeybindings;
41-
4231
import net.fabricmc.api.ClientModInitializer;
4332
import net.minecraft.client.Minecraft;
4433
import net.minecraft.client.entity.EntityPlayerSP;
@@ -48,6 +37,15 @@
4837
import net.minecraft.client.multiplayer.ServerData;
4938
import net.minecraft.client.settings.KeyBinding;
5039
import net.minecraft.server.MinecraftServer;
40+
import org.apache.logging.log4j.Level;
41+
import org.lwjgl.input.Keyboard;
42+
43+
import java.io.File;
44+
import java.io.IOException;
45+
import java.util.ArrayList;
46+
import java.util.List;
47+
48+
import static com.minecrafttas.tasmod.TASmod.LOGGER;
5149

5250
public class TASmodClient implements ClientModInitializer, EventClientInit, EventPlayerJoinedClientSide, EventOpenGui{
5351

@@ -112,7 +110,7 @@ public void onInitializeClient() {
112110
}
113111
config = new Configuration("TASmod configuration", new File(configDir, "tasmod.cfg"));
114112

115-
LanguageManager.registerModForLanguageManager("tasmod");
113+
LanguageManager.registerMod("tasmod");
116114

117115
// Execute /restartandplay. Load the file to start from the config. If it exists load the playback file on start.
118116
String fileOnStart = config.get(ConfigOptions.FileToOpen);

0 commit comments

Comments
 (0)