diff --git a/build.gradle b/build.gradle index d3a4bc1..dca787e 100644 --- a/build.gradle +++ b/build.gradle @@ -53,7 +53,7 @@ plugins { id 'com.diffplug.spotless' version '6.13.0' apply false // 6.13.0 is the last jvm8 supporting version id 'com.modrinth.minotaur' version '2.+' apply false id 'com.matthewprenger.cursegradle' version '1.4.0' apply false - id 'com.gtnewhorizons.retrofuturagradle' version '1.3.27' + id 'com.gtnewhorizons.retrofuturagradle' version '1.4.9' } print("You might want to check out './gradlew :faq' if your build fails.\n") @@ -1059,28 +1059,6 @@ idea { if (coreModClass) { coreModArgs = ' "-Dfml.coreMods.load=' + modGroup + '.' + coreModClass + '"' } - "Run Client (IJ Native)"(Application) { - mainClass = "GradleStart" - moduleName = project.name + ".ideVirtualMain" - afterEvaluate { - workingDirectory = tasks.runClient.workingDir.absolutePath - programParameters = tasks.runClient.calculateArgs(project).collect { '"' + it + '"' }.join(' ') - jvmArgs = tasks.runClient.calculateJvmArgs(project).collect { '"' + it + '"' }.join(' ') + - ' ' + tasks.runClient.systemProperties.collect { '"-D' + it.key + '=' + it.value.toString() + '"' }.join(' ') + - coreModArgs - } - } - "Run Server (IJ Native)"(Application) { - mainClass = "GradleStartServer" - moduleName = project.name + ".ideVirtualMain" - afterEvaluate { - workingDirectory = tasks.runServer.workingDir.absolutePath - programParameters = tasks.runServer.calculateArgs(project).collect { '"' + it + '"' }.join(' ') - jvmArgs = tasks.runServer.calculateJvmArgs(project).collect { '"' + it + '"' }.join(' ') + - ' ' + tasks.runServer.systemProperties.collect { '"-D' + it.key + '=' + it.value.toString() + '"' }.join(' ') + - coreModArgs - } - } } compiler.javac { afterEvaluate { diff --git a/dependencies.gradle b/dependencies.gradle index 0d0b54c..2ada993 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -34,11 +34,13 @@ * For more details, see https://docs.gradle.org/8.0.1/userguide/java_library_plugin.html#sec:java_library_configurations_graph */ dependencies { - api('com.github.GTNewHorizons:CodeChickenCore:1.3.10:dev') + api('com.github.GTNewHorizons:CodeChickenCore:1.4.10:dev') // api('com.github.CoFH:cofhcore:3.1.4-329:dev') - api("com.github.GTNewHorizons:NotEnoughItems:2.6.52-GTNH:dev") - api('com.github.GTNewHorizons:Hodgepodge:2.5.86:dev') - api('com.github.GTNewHorizons:GT5-Unofficial:5.09.50.111:dev') + api("com.github.GTNewHorizons:NotEnoughItems:2.8.44-GTNH:dev") + api('com.github.GTNewHorizons:Hodgepodge:2.6.112:dev') + api('com.github.GTNewHorizons:GT5-Unofficial:5.09.51.482:dev'){ + exclude group: 'com.github.GTNewHorizons', module: 'CodeChickenLib' + } // Random Extra deps for testing with more items // api('com.github.GTNewHorizons:GTNHLib:0.5.23:dev') diff --git a/src/main/java/com/hermanoid/nerd/RecipeDumper.java b/src/main/java/com/hermanoid/nerd/RecipeDumper.java index f207429..3a3f910 100644 --- a/src/main/java/com/hermanoid/nerd/RecipeDumper.java +++ b/src/main/java/com/hermanoid/nerd/RecipeDumper.java @@ -9,6 +9,7 @@ import java.util.stream.Stream; import net.minecraft.item.ItemStack; +import net.minecraft.util.ChatComponentText; import net.minecraft.util.ChatComponentTranslation; import org.apache.commons.lang3.NotImplementedException; @@ -113,7 +114,18 @@ public Stream getQueryDumps(List items) { // react well return items.stream() .map(this::performQuery) - .map(this::extractJsonRecipeData); + .map(qr -> { + try { + return extractJsonRecipeData(qr); + } catch (Throwable t) { + // One bad handler shouldn't sink the whole (multi-hour) dump; log and keep going. + NEIClientConfig.logger + .error("NERD: failed to dump recipes for item {} (query #{})", qr.targetStack, dumpedQueries, t); + JsonObject fallback = new JsonObject(); + fallback.addProperty("nerdError", t.toString()); + return fallback; + } + }); } @Override @@ -138,6 +150,7 @@ private void doDumpJson(File file) { List items = ItemList.items; totalQueries = items.size(); dumpedQueries = 0; + NEIClientConfig.logger.info("NERD: starting recipe dump, ItemList.items.size() = {}", totalQueries); try { writer = new FileWriter(file); @@ -211,13 +224,24 @@ public void dumpJson(File file) { dumpActive = true; TimerTask progressTask = getProgressTask(); Thread workerThread = new Thread(() -> { + boolean ok = false; try { doDumpJson(file); + ok = true; + } catch (Throwable t) { + // Previously this exception was silently swallowed by the JVM's default uncaught + // exception handler: no crash, no log line, just a truncated output file. Log it properly. + NEIClientConfig.logger.error("NERD: recipe dump failed", t); } finally { dumpActive = false; progressTask.cancel(); } - NEIClientUtils.printChatMessage(new ChatComponentTranslation("nei.options.tools.dump.recipes.complete")); + if (ok) { + NEIClientUtils + .printChatMessage(new ChatComponentTranslation("nei.options.tools.dump.recipes.complete")); + } else { + NEIClientUtils.printChatMessage(new ChatComponentText("NERD: recipe dump failed, see log for details")); + } }); workerThread.start(); } diff --git a/src/main/java/com/hermanoid/nerd/stack_serialization/RecipeDumpContext.java b/src/main/java/com/hermanoid/nerd/stack_serialization/RecipeDumpContext.java index f6830e9..b4c0800 100644 --- a/src/main/java/com/hermanoid/nerd/stack_serialization/RecipeDumpContext.java +++ b/src/main/java/com/hermanoid/nerd/stack_serialization/RecipeDumpContext.java @@ -24,12 +24,15 @@ import com.google.gson.reflect.TypeToken; import codechicken.nei.util.NBTJson; +import cpw.mods.fml.common.registry.GameData; import gregtech.api.enums.Materials; import gregtech.common.fluid.GTFluid; public class RecipeDumpContext { - private static final RegistryNamespaced itemRegistry = Item.itemRegistry; + // Item.itemRegistry is renamed/removed by this modpack's coremods (NoSuchFieldError at runtime); + // GameData.getItemRegistry() is the stable public Forge API for the same registry. + private static final RegistryNamespaced itemRegistry = GameData.getItemRegistry(); private static final Type fluidType = new TypeToken() {}.getType(); public Map dumpedItems = new HashMap<>();