Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 1 addition & 23 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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 {
Expand Down
10 changes: 6 additions & 4 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
28 changes: 26 additions & 2 deletions src/main/java/com/hermanoid/nerd/RecipeDumper.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -113,7 +114,18 @@ public Stream<JsonObject> getQueryDumps(List<ItemStack> 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
Expand All @@ -138,6 +150,7 @@ private void doDumpJson(File file) {
List<ItemStack> items = ItemList.items;
totalQueries = items.size();
dumpedQueries = 0;
NEIClientConfig.logger.info("NERD: starting recipe dump, ItemList.items.size() = {}", totalQueries);

try {
writer = new FileWriter(file);
Expand Down Expand Up @@ -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();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Fluid>() {}.getType();

public Map<String, JsonObject> dumpedItems = new HashMap<>();
Expand Down
Loading