Fix serverlang loading issue, by frontloading MC and Forge langs,
so error messaging works. Signed-off-by: cpw <cpw+github@weeksfamily.ca>
This commit is contained in:
parent
1e6f3fc893
commit
36ccb3bbfe
3 changed files with 18 additions and 3 deletions
|
@ -105,8 +105,11 @@ public class LoadingModList
|
|||
return null;
|
||||
}
|
||||
|
||||
public URL findURLForResource(final String resourceName) {
|
||||
public URL findURLForResource(String resourceName) {
|
||||
for (ModFileInfo mf : modFiles) {
|
||||
// strip a leading slash
|
||||
if (resourceName.startsWith("/")) resourceName = resourceName.substring(1);
|
||||
|
||||
final Path resource = mf.getFile().findResource(resourceName);
|
||||
if (Files.exists(resource)) {
|
||||
try {
|
||||
|
|
|
@ -26,7 +26,7 @@ import net.minecraft.resources.IResource;
|
|||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.util.JsonUtils;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fml.packs.ResourcePackLoader;
|
||||
import net.minecraftforge.fml.ForgeI18n;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
@ -91,6 +91,17 @@ public class LanguageHook
|
|||
});
|
||||
|
||||
}
|
||||
|
||||
static void loadForgeAndMCLangs() {
|
||||
modTable = new HashMap<>(5000);
|
||||
final InputStream mc = Thread.currentThread().getContextClassLoader().getResourceAsStream("assets/minecraft/lang/en_us.json");
|
||||
final InputStream forge = Thread.currentThread().getContextClassLoader().getResourceAsStream("assets/forge/lang/en_us.json");
|
||||
loadLocaleData(mc);
|
||||
loadLocaleData(forge);
|
||||
capturedTables.forEach(t->t.putAll(modTable));
|
||||
ForgeI18n.loadLanguageData(modTable);
|
||||
}
|
||||
|
||||
static void loadLanguagesOnServer(MinecraftServer server) {
|
||||
modTable = new HashMap<>(5000);
|
||||
// Possible multi-language server support?
|
||||
|
@ -98,5 +109,6 @@ public class LanguageHook
|
|||
loadLanguage(lang, server);
|
||||
}
|
||||
capturedTables.forEach(t->t.putAll(modTable));
|
||||
ForgeI18n.loadLanguageData(modTable);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,6 @@ import net.minecraft.server.dedicated.DedicatedServer;
|
|||
import net.minecraftforge.fml.LogicalSidedProvider;
|
||||
import net.minecraftforge.fml.ModLoader;
|
||||
import net.minecraftforge.fml.SidedProvider;
|
||||
import net.minecraftforge.fml.packs.ResourcePackLoader;
|
||||
|
||||
public class ServerModLoader
|
||||
{
|
||||
|
@ -32,6 +31,7 @@ public class ServerModLoader
|
|||
ServerModLoader.server = dedicatedServer;
|
||||
SidedProvider.setServer(()->dedicatedServer);
|
||||
LogicalSidedProvider.setServer(()->dedicatedServer);
|
||||
LanguageHook.loadForgeAndMCLangs();
|
||||
ModLoader.get().loadMods();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue