Skip to content

Commit

Permalink
[Common] Add documentation to language manager, renamed method
Browse files Browse the repository at this point in the history
  • Loading branch information
ScribbleTAS committed Jan 5, 2024
1 parent 4caf86d commit 00b95ee
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 14 deletions.
10 changes: 8 additions & 2 deletions src/main/java/com/minecrafttas/mctcommon/LanguageManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ public class LanguageManager {
private static final Pattern PATTERN = Pattern.compile("%(\\d+\\$)?[\\d\\.]*[df]");

public static void onResourceManagerReload(Map<String, String> original, IResourceManager iResourceManager, List<String> languageList) {

for (String language : languageList) { // Go through all loaded languages
language = language.toLowerCase(); // Set everything to lowercase which prevents headaches in 1.10.2 and below
for (String modid : modids) { // Iterate through all registered modids
Expand Down Expand Up @@ -72,7 +71,14 @@ private static HashMap<String, String> getFromResourcePack(IResourceManager iRes
return out;
}

public static void registerModForLanguageManager(String modid) {
/**
* Registers your mod to be processed by the language manager<br>
* This will allow you to add .json and/or .lang files to assets/modid/lang<br>
* with en_us.lang/en_us.json (<strong>lowercase!</strong>)
*
* @param modid The modid of your mod
*/
public static void registerMod(String modid) {
modids.add(modid);
}

Expand Down
22 changes: 10 additions & 12 deletions src/main/java/com/minecrafttas/tasmod/TASmodClient.java
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
package com.minecrafttas.tasmod;

import static com.minecrafttas.tasmod.TASmod.LOGGER;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import com.minecrafttas.common.LanguageManager;
import org.apache.logging.log4j.Level;
import org.lwjgl.input.Keyboard;

import com.minecrafttas.mctcommon.Configuration;
import com.minecrafttas.mctcommon.Configuration.ConfigOptions;
import com.minecrafttas.mctcommon.KeybindManager;
Expand Down Expand Up @@ -38,7 +28,6 @@
import com.minecrafttas.tasmod.util.ShieldDownloader;
import com.minecrafttas.tasmod.virtual.VirtualInput;
import com.minecrafttas.tasmod.virtual.VirtualKeybindings;

import net.fabricmc.api.ClientModInitializer;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityPlayerSP;
Expand All @@ -48,6 +37,15 @@
import net.minecraft.client.multiplayer.ServerData;
import net.minecraft.client.settings.KeyBinding;
import net.minecraft.server.MinecraftServer;
import org.apache.logging.log4j.Level;
import org.lwjgl.input.Keyboard;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import static com.minecrafttas.tasmod.TASmod.LOGGER;

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

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

LanguageManager.registerModForLanguageManager("tasmod");
LanguageManager.registerMod("tasmod");

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

0 comments on commit 00b95ee

Please sign in to comment.