Stop auto-creating NEI config files, add export buttons instead (#1104)

This commit is contained in:
slprime authored and GitHub committed 2026-11-02 22:20:09 +02:00
1 parent c1a525594c
commit aea4c2866a
16 files changed
+247 -217

No files matched your search

+1 -1
View File
@@ -75,7 +75,7 @@ All items that match `filter` will show your information page. See `config/NEI/c
#### Item Information Config File
If you're a modpack creator and want to make custom item information pages, they can easily be added in `config/NEI/informationpages.cfg`, which has a few more examples.
If you're a modpack creator and want to make custom item information pages, they can easily be added in `config/NEI/informationpages.cfg`, which has a few more examples. The file is not created automatically: use the Export button in the NEI options under Tools > Default Config Files to copy the defaults to `config/NEI`.
## Other items of note:
@@ -2,8 +2,6 @@ package codechicken.nei;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;
@@ -12,7 +10,8 @@ import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.function.BiConsumer;
import java.util.Map;
import java.util.TreeMap;
import java.util.function.Consumer;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
@@ -37,8 +36,10 @@ import net.minecraftforge.client.event.RenderWorldLastEvent;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.world.WorldEvent;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
import codechicken.core.ClassDiscoverer;
@@ -50,7 +51,9 @@ import codechicken.nei.api.IConfigureNEI;
import codechicken.nei.api.ItemInfo;
import codechicken.nei.bookmark.tree.GuiCraftingTree;
import codechicken.nei.guihook.GuiContainerManager;
import codechicken.nei.recipe.GuiRecipeTab;
import codechicken.nei.recipe.GuiCraftingRecipe;
import codechicken.nei.recipe.GuiUsageRecipe;
import codechicken.nei.recipe.IRecipeHandler;
import codechicken.nei.recipe.StackInfo;
import cpw.mods.fml.client.CustomModLoadingErrorDisplayException;
import cpw.mods.fml.common.FMLCommonHandler;
@@ -67,6 +70,22 @@ public class ClientHandler {
private static ClientHandler instance;
private final ArrayList<EntityItem> SMPmagneticItems = new ArrayList<>();
private static final String HANDLER_ORDERING = "handlerordering.csv";
public static final List<String> DEFAULT_CONFIGS = ImmutableList.of(
"serialhandlers.cfg",
"heighthackhandlers.cfg",
"hiddenhandlers.cfg",
"enableautofocus.cfg",
"guicraftablesblacklist.cfg",
"defaultbookmarkcontainers.cfg",
"hiddenitems.cfg",
"guidfilters.cfg",
"informationpages.cfg",
"collapsibleitems.cfg",
"recipeidblacklist.cfg",
"handlers.csv",
"catalysts.csv",
HANDLER_ORDERING);
private World lastworld;
public void addSMPMagneticItem(int i, World world) {
@@ -160,17 +179,30 @@ public class ClientHandler {
StackInfo.loadGuidFilters();
}
public static void loadSettingsFile(String resource, Consumer<Stream<String>> callback) {
loadSettingsFile(resource, (file, writer) -> {
String folder = resource.substring(resource.lastIndexOf(".") + 1);
URL defaultResource = ClientHandler.class.getResource("/assets/nei/" + folder + "/" + resource);
private static URL getDefaultResource(String resource) {
final String folder = resource.substring(resource.lastIndexOf(".") + 1);
return ClientHandler.class.getResource("/assets/nei/" + folder + "/" + resource);
}
if (defaultResource != null) {
try {
IOUtils.copy(defaultResource.openStream(), writer);
} catch (IOException e) {}
}
}, callback);
public static boolean exportDefaultConfig(String resource) {
final File file = new File(NEIClientConfig.configDir, resource);
if (file.exists() && !NEIClientUtils.backupFile(file)) return false;
if (HANDLER_ORDERING.equals(resource)) {
return writeDefaultHandlerOrdering();
}
final URL url = getDefaultResource(resource);
if (url == null) return false;
try {
FileUtils.copyURLToFile(url, file);
NEIClientConfig.logger.info("Exported default '{}' to {}", resource, file);
return true;
} catch (IOException e) {
NEIClientConfig.logger.error("Failed to export default '{}' to file {}", resource, file, e);
return false;
}
}
public static boolean loadSettingsResource(String resource, Consumer<Stream<String>> callback) {
@@ -196,30 +228,24 @@ public class ClientHandler {
return false;
}
public static boolean loadSettingsFile(String resource, BiConsumer<File, FileWriter> createDefault,
Consumer<Stream<String>> callback) {
File file = new File(NEIClientConfig.configDir, resource);
public static boolean loadSettingsFile(String resource, Consumer<Stream<String>> callback) {
final File file = new File(NEIClientConfig.configDir, resource);
final boolean fromJar = !file.exists();
if (!file.exists() && createDefault != null) {
try (FileWriter writer = new FileWriter(file)) {
NEIClientConfig.logger.info("Creating default '{}' {}", resource, file);
createDefault.accept(file, writer);
} catch (IOException e) {
NEIClientConfig.logger.error("Failed to save default '{}' to file {}", resource, file, e);
}
}
try {
final URL url = fromJar ? getDefaultResource(resource) : file.toURI().toURL();
if (url == null) return false;
if (file.exists()) {
try (FileReader reader = new FileReader(file)) {
NEIClientConfig.logger.info("Loading '{}' file {}", resource, file);
try (InputStreamReader reader = new InputStreamReader(url.openStream(), StandardCharsets.UTF_8)) {
NEIClientConfig.logger.info("Loading '{}' from {}", resource, fromJar ? "JAR" : file);
callback.accept(
IOUtils.readLines(reader).stream()
.map(line -> line.contains("#") ? line.substring(0, line.indexOf('#')) : line)
.map(String::trim).filter(line -> !line.isEmpty()));
return true;
} catch (IOException e) {
NEIClientConfig.logger.error("Failed to load '{}' file {}", resource, file, e);
}
} catch (IOException e) {
NEIClientConfig.logger.error("Failed to load '{}' file {}", resource, file, e);
}
return false;
@@ -292,26 +318,46 @@ public class ClientHandler {
}
public static void loadHandlerOrdering() {
final String COMMA_DELIMITER = ",";
final String[] defaultHandlerOrdering = {
loadSettingsFile(
HANDLER_ORDERING,
lines -> lines.map(line -> line.split(",")).filter(parts -> parts.length == 2).forEach(parts -> {
String handlerId = parts[0];
int ordering = Integer.parseInt(parts[1]);
NEIClientConfig.handlerOrdering.put(handlerId, ordering);
}));
}
private static boolean writeDefaultHandlerOrdering() {
final File file = new File(NEIClientConfig.configDir, HANDLER_ORDERING);
final List<String> lines = Lists.newArrayList(
"# Each line in this file should either be a comment (starts with '#') or an ordering.",
"# Ordering lines are <handler ID>,<ordering number>.",
"# Handlers will be sorted in order of number ascending, so smaller numbers first.",
"# Any handlers that are missing from this file will be assigned to 0.", "# Negative numbers are fine.",
"# If you delete this file, it will be regenerated with all registered handler IDs.", };
"# Any handlers that are missing from this file keep their own order, 0 for most of them.",
"# Negative numbers are fine.");
final Map<String, Integer> orders = new TreeMap<>();
final List<IRecipeHandler> handlers = new ArrayList<>();
handlers.addAll(GuiCraftingRecipe.craftinghandlers);
handlers.addAll(GuiCraftingRecipe.serialCraftingHandlers);
handlers.addAll(GuiUsageRecipe.usagehandlers);
handlers.addAll(GuiUsageRecipe.serialUsageHandlers);
loadSettingsFile("handlerordering.csv", (file, writer) -> {
List<String> toWrite = Lists.newArrayList(defaultHandlerOrdering);
GuiRecipeTab.handlerMap.keySet().stream().sorted()
.forEach(handlerId -> toWrite.add(String.format("%s" + COMMA_DELIMITER + "0", handlerId)));
try {
IOUtils.writeLines(toWrite, "\n", writer);
} catch (IOException e) {}
}, lines -> lines.map(line -> line.split(COMMA_DELIMITER)).filter(parts -> parts.length == 2).forEach(parts -> {
String handlerId = parts[0];
int ordering = Integer.parseInt(parts[1]);
NEIClientConfig.handlerOrdering.put(handlerId, ordering);
}));
for (IRecipeHandler handler : handlers) {
orders.putIfAbsent(
NEIClientConfig.HANDLER_ID_FUNCTION.apply(handler),
NEIClientConfig.getHandlerOrder(handler));
}
orders.forEach((handlerId, order) -> lines.add(handlerId + "," + order));
try {
NEIClientConfig.logger.info("Creating default '{}' {}", HANDLER_ORDERING, file);
FileUtils.writeLines(file, StandardCharsets.UTF_8.name(), lines, "\n");
return true;
} catch (IOException e) {
NEIClientConfig.logger.error("Failed to save default '{}' to file {}", HANDLER_ORDERING, file, e);
return false;
}
}
public static void loadPluginsList() {
@@ -24,7 +24,6 @@ import net.minecraft.nbt.NBTTagCompound;
import org.apache.commons.io.IOUtils;
import com.google.common.io.Files;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.google.gson.JsonSyntaxException;
@@ -244,14 +243,7 @@ public class FavoriteRecipes {
if (hasErrors) {
try {
Files.copy(
favoriteFile,
new File(favoriteFile.getAbsolutePath() + ".backup-" + System.currentTimeMillis()));
NEIClientConfig.logger.info("Backed up invalid favorite file to {}", favoriteFile);
} catch (IOException e) {
NEIClientConfig.logger.error("Failed to backup invalid favorite file to {}", favoriteFile, e);
}
NEIClientUtils.backupFile(favoriteFile);
save();
}
@@ -36,7 +36,6 @@ import cpw.mods.fml.common.FMLLog;
public class ItemListLoader {
private static final HashSet<Item> erroredItems = new HashSet<>();
private static final HashSet<String> stackTraces = new HashSet<>();
private static Map<ItemStack, Integer> ordering = new HashMap<>();
private ItemListLoader() {}
@@ -60,11 +59,10 @@ public class ItemListLoader {
} catch (TimeoutException t) {
throw t;
} catch (Throwable t) {
NEIServerUtils.logOnce(
t,
stackTraces,
NEIClientUtils.errorOnce(
"ItemListLoader: " + item.toString(),
"Ommiting " + item + ":" + damage + " " + item.getClass().getSimpleName(),
item.toString());
t);
}
}
}
@@ -15,6 +15,7 @@ import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ChatComponentTranslation;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.world.storage.SaveFormatComparator;
import net.minecraftforge.common.MinecraftForge;
@@ -43,7 +44,9 @@ import codechicken.nei.config.GuiHighlightTips;
import codechicken.nei.config.GuiNEIOptionList;
import codechicken.nei.config.GuiOptionList;
import codechicken.nei.config.GuiPanelSettings;
import codechicken.nei.config.OptionButton;
import codechicken.nei.config.OptionCycled;
import codechicken.nei.config.OptionExportConfig;
import codechicken.nei.config.OptionGamemodes;
import codechicken.nei.config.OptionIntegerField;
import codechicken.nei.config.OptionList;
@@ -54,7 +57,6 @@ import codechicken.nei.config.OptionToggleButtonBoubs;
import codechicken.nei.config.OptionUtilities;
import codechicken.nei.config.preset.GuiPresetList;
import codechicken.nei.event.NEIConfigsLoadedEvent;
import codechicken.nei.recipe.GuiRecipeTab;
import codechicken.nei.recipe.IRecipeHandler;
import codechicken.nei.recipe.InformationHandler;
import codechicken.nei.recipe.RecipeCatalysts;
@@ -525,29 +527,32 @@ public class NEIClientConfig {
});
tag.getTag("tools.handler_load_from_config").setComment("ADVANCED: Load handlers from config")
.getBooleanValue(false);
API.addOption(new OptionToggleButton("tools.handler_load_from_config", true) {
API.addOption(
new OptionButton(
"tools.export_configs.all",
"tools.export_configs.all",
null,
"tools.export_configs.all.tip") {
@Override
public boolean onClick(int button) {
super.onClick(button);
GuiRecipeTab.loadHandlerInfo();
return true;
}
});
@Override
public String getButtonText() {
return translateN("tools.export_configs.button");
}
tag.getTag("tools.catalyst_load_from_config").setComment("ADVANCED: Load catalysts from config")
.getBooleanValue(false);
API.addOption(new OptionToggleButton("tools.catalyst_load_from_config", true) {
@Override
public boolean onClick(int button) {
int exported = 0;
@Override
public boolean onClick(int button) {
super.onClick(button);
RecipeCatalysts.loadCatalystInfo();
return true;
}
});
for (String resource : ClientHandler.DEFAULT_CONFIGS) {
if (ClientHandler.exportDefaultConfig(resource)) exported++;
}
NEIClientUtils.printChatMessage(
new ChatComponentTranslation("nei.options.tools.export_configs.all.done", exported));
return true;
}
});
ClientHandler.DEFAULT_CONFIGS.forEach(fileName -> API.addOption(new OptionExportConfig(fileName)));
setDefaultKeyBindings();
}
@@ -1187,14 +1192,6 @@ public class NEIClientConfig {
return mainNEIConfigLoaded && pluginNEIConfigLoaded;
}
public static boolean loadHandlersFromJar() {
return !getBooleanSetting("tools.handler_load_from_config");
}
public static boolean loadCatalystsFromJar() {
return !getBooleanSetting("tools.catalyst_load_from_config");
}
public static boolean isProfileRecipeEnabled() {
return NEIClientConfig.getBooleanSetting("inventory.guirecipe.profile");
}
@@ -9,9 +9,12 @@ import static codechicken.nei.NEIClientConfig.invCreativeMode;
import static codechicken.nei.NEIClientConfig.world;
import java.awt.Color;
import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.math.RoundingMode;
import java.nio.file.Files;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.text.MessageFormat;
@@ -26,6 +29,7 @@ import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;
import net.minecraft.client.Minecraft;
@@ -64,6 +68,8 @@ import codechicken.nei.util.NEIKeyboardUtils;
public class NEIClientUtils extends NEIServerUtils {
private static final Set<String> REPORTED = ConcurrentHashMap.newKeySet();
public static class Alignment {
public final int x, y;
@@ -639,4 +645,29 @@ public class NEIClientUtils extends NEIServerUtils {
if (!isAlphaTest) GL11.glDisable(GL11.GL_ALPHA_TEST);
}
public static void errorOnce(String key, String message, Throwable error) {
if (REPORTED.add(key)) {
NEIClientConfig.logger.error(message, error);
}
}
public static void warnOnce(String key, String message) {
if (REPORTED.add(key)) {
NEIClientConfig.logger.warn(message);
}
}
public static boolean backupFile(File file) {
final File backup = new File(file.getAbsolutePath() + ".backup-" + System.currentTimeMillis());
try {
Files.copy(file.toPath(), backup.toPath());
NEIClientConfig.logger.info("Backed up file {} to {}", file, backup);
return true;
} catch (IOException e) {
NEIClientConfig.logger.error("Failed to backup file {} to {}", file, backup, e);
return false;
}
}
}
@@ -4,12 +4,9 @@ import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.AbstractList;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.UUID;
import java.util.zip.ZipException;
@@ -509,20 +506,6 @@ public class NEIServerUtils {
return sb;
}
public static void logOnce(Throwable t, Set<String> stackTraces, String message) {
logOnce(t, stackTraces, message, "");
}
public static void logOnce(Throwable t, Set<String> stackTraces, String message, String identifier) {
StringWriter sw = new StringWriter();
t.printStackTrace(new PrintWriter(sw));
String stackTrace = identifier + sw.toString();
if (!stackTraces.contains(stackTrace)) {
NEIServerConfig.logger.error(message, t);
stackTraces.add(stackTrace);
}
}
public static ItemStack getModdedItem(String itemId, String nbtString) {
int meta = -1;
ItemStack itemStack;
@@ -14,7 +14,6 @@ import net.minecraft.nbt.NBTTagCompound;
import org.apache.commons.io.IOUtils;
import com.google.common.io.Files;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
@@ -25,6 +24,7 @@ import com.google.gson.JsonSyntaxException;
import codechicken.nei.BookmarkPanel.BookmarkViewMode;
import codechicken.nei.ItemPanels;
import codechicken.nei.NEIClientConfig;
import codechicken.nei.NEIClientUtils;
import codechicken.nei.recipe.Recipe.RecipeId;
import codechicken.nei.util.NBTJson;
@@ -230,14 +230,7 @@ public class BookmarkStorage {
}
if (wasError) {
try {
Files.copy(
bookmarkFile,
new File(bookmarkFile.getAbsolutePath() + ".backup-" + System.currentTimeMillis()));
NEIClientConfig.logger.info("Backed up invalid bookmark file to {}", bookmarkFile);
} catch (IOException e) {
NEIClientConfig.logger.error("Failed to backup invalid bookmark file to {}", bookmarkFile, e);
}
NEIClientUtils.backupFile(bookmarkFile);
}
for (BookmarkGrid gr : namespaces) {
@@ -0,0 +1,42 @@
package codechicken.nei.config;
import net.minecraft.util.ChatComponentTranslation;
import codechicken.nei.ClientHandler;
import codechicken.nei.NEIClientUtils;
public class OptionExportConfig extends OptionButton {
private final String fileName;
public OptionExportConfig(String fileName) {
super("tools.export_configs." + fileName.substring(0, fileName.lastIndexOf('.')));
this.fileName = fileName;
}
@Override
public String getPrefix() {
return fileName;
}
@Override
public String getButtonText() {
return translateN("tools.export_configs.button");
}
@Override
public String getTooltip() {
return null;
}
@Override
public boolean onClick(int button) {
final boolean exported = ClientHandler.exportDefaultConfig(fileName);
NEIClientUtils.printChatMessage(
new ChatComponentTranslation(
exported ? "nei.options.tools.export_configs.done" : "nei.options.tools.export_configs.skipped",
fileName));
return true;
}
}
@@ -1,15 +1,10 @@
package codechicken.nei.recipe;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URL;
import java.nio.channels.Channels;
import java.nio.channels.FileChannel;
import java.nio.channels.ReadableByteChannel;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
@@ -207,41 +202,27 @@ public abstract class GuiRecipeTab extends Widget {
}
public static void loadHandlerInfo() {
final boolean fromJar = NEIClientConfig.loadHandlersFromJar();
final boolean fromJar = !NEIClientConfig.handlerFile.exists();
NEIClientConfig.logger.info("Loading handler info from " + (fromJar ? "JAR" : "Config"));
handlerMap.clear();
URL handlerUrl = GuiRecipeTab.class.getResource("/assets/nei/csv/handlers.csv");
URL url;
if (fromJar) {
url = handlerUrl;
if (url == null) {
NEIClientConfig.logger.info("Invalid URL for handlers csv.");
return;
}
} else {
File handlerFile = NEIClientConfig.handlerFile;
if (!handlerFile.exists()) {
NEIClientConfig.logger.info("Config file doesn't exist, creating");
try (FileOutputStream fileOutputStream = new FileOutputStream(handlerFile.getAbsoluteFile())) {
assert handlerUrl != null;
ReadableByteChannel readableByteChannel = Channels.newChannel(handlerUrl.openStream());
FileChannel fileChannel = fileOutputStream.getChannel();
fileChannel.transferFrom(readableByteChannel, 0, Long.MAX_VALUE);
} catch (IOException e) {
e.printStackTrace();
return;
}
}
try {
url = NEIClientConfig.handlerFile.toURI().toURL();
} catch (MalformedURLException e) {
NEIClientConfig.logger.info("Invalid URL for handlers csv (via config).");
e.printStackTrace();
return;
}
try {
url = fromJar ? GuiRecipeTab.class.getResource("/assets/nei/csv/handlers.csv")
: NEIClientConfig.handlerFile.toURI().toURL();
} catch (MalformedURLException e) {
NEIClientConfig.logger.info("Invalid URL for handlers csv (via config).");
e.printStackTrace();
return;
}
try (BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()))) {
if (url == null) {
NEIClientConfig.logger.info("Invalid URL for handlers csv.");
return;
}
try (BufferedReader reader = new BufferedReader(
new InputStreamReader(url.openStream(), StandardCharsets.UTF_8))) {
CSVParser csvParser = CSVFormat.EXCEL.builder().setHeader().setSkipHeaderRecord(true).build().parse(reader);
for (CSVRecord record : csvParser) {
final String handler = record.get("handler");
@@ -2,14 +2,10 @@ package codechicken.nei.recipe;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URL;
import java.nio.channels.Channels;
import java.nio.channels.FileChannel;
import java.nio.channels.ReadableByteChannel;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
@@ -97,43 +93,30 @@ public class RecipeCatalysts {
}
public static void loadCatalystInfo() {
final boolean fromJar = NEIClientConfig.loadCatalystsFromJar();
final URL handlerUrl = RecipeCatalysts.class.getResource("/assets/nei/csv/catalysts.csv");
final File catalystFile = NEIClientConfig.catalystFile;
final boolean fromJar = !catalystFile.exists();
final Map<String, CatalystInfoList> calculatedCatalysts = new HashMap<>();
NEIClientConfig.logger.info("Loading catalyst info from " + (fromJar ? "JAR" : "Config"));
resolveAdderQueue(calculatedCatalysts);
URL url;
if (fromJar) {
url = handlerUrl;
if (url == null) {
NEIClientConfig.logger.warn("Invalid URL for catalysts csv.");
return;
}
} else {
File catalystFile = NEIClientConfig.catalystFile;
if (!catalystFile.exists()) {
NEIClientConfig.logger.info("Config file doesn't exist, creating");
try (FileOutputStream fileOutputStream = new FileOutputStream(catalystFile.getAbsoluteFile())) {
assert handlerUrl != null;
ReadableByteChannel readableByteChannel = Channels.newChannel(handlerUrl.openStream());
FileChannel fileChannel = fileOutputStream.getChannel();
fileChannel.transferFrom(readableByteChannel, 0, Long.MAX_VALUE);
} catch (IOException e) {
e.printStackTrace();
return;
}
}
try {
url = NEIClientConfig.catalystFile.toURI().toURL();
} catch (MalformedURLException e) {
NEIClientConfig.logger.warn("Invalid URL for catalysts csv (via config).");
e.printStackTrace();
return;
}
final URL url;
try {
url = fromJar ? RecipeCatalysts.class.getResource("/assets/nei/csv/catalysts.csv")
: catalystFile.toURI().toURL();
} catch (MalformedURLException e) {
NEIClientConfig.logger.warn("Invalid URL for catalysts csv (via config).");
e.printStackTrace();
return;
}
try (BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()))) {
if (url == null) {
NEIClientConfig.logger.warn("Invalid URL for catalysts csv.");
return;
}
try (BufferedReader reader = new BufferedReader(
new InputStreamReader(url.openStream(), StandardCharsets.UTF_8))) {
CSVParser csvParser = CSVFormat.EXCEL.builder().setHeader().setSkipHeaderRecord(true).build().parse(reader);
for (CSVRecord record : csvParser) {
final String handler = record.get("handler");
@@ -141,10 +124,6 @@ public class RecipeCatalysts {
final boolean requiresMod = Boolean.parseBoolean(record.get("modRequired"));
final String excludedModId = record.get("excludedModId");
final int priority = intOrDefault(record.get("priority"), 0);
// todo
final String minVersion = record.get("minVersion");
final String maxVersion = record.get("maxVersion");
//
final boolean forceClassName = Boolean.parseBoolean(record.get("forceClassName"));
if (requiresMod && !Loader.isModLoaded(modId)) continue;
@@ -379,7 +379,7 @@ public class ItemUntranslator {
LanguageRegistryPatch.secondLanguageListCache = null;
this.processedNames.clear();
if (ClientHandler.loadSettingsFile(CONFIG_FILE, null, this::parseStream)
if (ClientHandler.loadSettingsFile(CONFIG_FILE, this::parseStream)
|| ClientHandler.loadSettingsResource(CONFIG_FILE, this::parseStream)) {
NEIClientConfig.logger.info("Untranslator loaded");
}
@@ -571,12 +571,12 @@ nei.options.world.overlays.lock.true=Enabled
nei.options.world.overlays.lock.false=Disabled
nei.options.tools=Tools
nei.options.tools.handler_load_from_config=Load handlers from Config
nei.options.tools.handler_load_from_config.true=Config
nei.options.tools.handler_load_from_config.false=JAR
nei.options.tools.catalyst_load_from_config=Load catalysts from Config
nei.options.tools.catalyst_load_from_config.true=Config
nei.options.tools.catalyst_load_from_config.false=JAR
nei.options.tools.export_configs=Default Config Files
nei.options.tools.export_configs.button=Export
nei.options.tools.export_configs.done=%s was exported to config/NEI
nei.options.tools.export_configs.skipped=%s was not exported, see the log
nei.options.tools.export_configs.all=All files
nei.options.tools.export_configs.all.done=%s default config files were exported to config/NEI
nei.options.tools.dump=Data Dumps
nei.options.tools.dump.dump=Dump
nei.options.tools.dump.dumped=%s IDs dumped to %s
@@ -369,12 +369,12 @@ nei.options.world.panels=Настройки панелей
nei.options.world.presets=Список пресетов
nei.options.tools=Инструменты
nei.options.tools.handler_load_from_config=Загрузить обработчики из конфигурации
nei.options.tools.handler_load_from_config.true=Конфигурация
nei.options.tools.handler_load_from_config.false=JAR
nei.options.tools.catalyst_load_from_config=Загрузить катализаторы из конфигурации
nei.options.tools.catalyst_load_from_config.true=Конфигурация
nei.options.tools.catalyst_load_from_config.false=JAR
nei.options.tools.export_configs=Файлы конфигурации по умолчанию
nei.options.tools.export_configs.button=Экспорт
nei.options.tools.export_configs.done=%s экспортирован в config/NEI
nei.options.tools.export_configs.skipped=%s не экспортирован, см. лог
nei.options.tools.export_configs.all=Все файлы
nei.options.tools.export_configs.all.done=Файлов конфигурации по умолчанию экспортировано в config/NEI: %s
nei.options.tools.dump=Выгрузка данных
nei.options.tools.dump.dump=Выгрузить
nei.options.tools.dump.dumped=%s ID сохранены в %s
@@ -500,12 +500,6 @@ nei.options.world.overlays.lock.true=Увімкнено
nei.options.world.overlays.lock.false=Вимкнено
nei.options.tools=Інструменти
nei.options.tools.handler_load_from_config=Завантажувати обробники з конфігураційного файлу
nei.options.tools.handler_load_from_config.true=Конфігурація
nei.options.tools.handler_load_from_config.false=JAR
nei.options.tools.catalyst_load_from_config=Завантажувати каталізатори з конфігураційного файлу
nei.options.tools.catalyst_load_from_config.true=Конфігурація
nei.options.tools.catalyst_load_from_config.false=JAR
nei.options.tools.dump=Дампи даних
nei.options.tools.dump.dump=Створити дамп
nei.options.tools.dump.dumped=ID %s збережено в %s
@@ -203,12 +203,6 @@ nei.options.world.highlight_tips.sample=样本
nei.options.world.panels=面板布局
nei.options.tools=工具
nei.options.tools.handler_load_from_config=从Config加载handler(加工所使用的机器类别)
nei.options.tools.handler_load_from_config.true=Config
nei.options.tools.handler_load_from_config.false=JAR
nei.options.tools.catalyst_load_from_config=从Config加载catalysts(加工所使用的具体机器等)
nei.options.tools.catalyst_load_from_config.true=Config
nei.options.tools.catalyst_load_from_config.false=JAR
nei.options.tools.dump=数据存储
nei.options.tools.dump.dump=存储
nei.options.tools.dump.dumped=%s ID已保存到.minecraft/%s