Skip to content

Commit

Permalink
Some configuration and a README that is fairly optimistic about how m…
Browse files Browse the repository at this point in the history
…uch I'm going to accomplish
  • Loading branch information
Hermanoid committed Jan 10, 2024
1 parent 3691a73 commit 6a93df7
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 14 deletions.
File renamed without changes.
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
## NERD - Not Enough Recipe Dumps

---

At long last, you can finally export all that delicious recipe data from just about every mod, automatically, into one huge and hideous dump file!


This (somewhat) simple project adds an extra dump option to the NEI data dumps screen (Lower-left of inventory screen>Tools>Dumps).
Why would you ever want this? Well, sometimes, those of us foolish enough to take on the GTNewHorizons modpack look up from our sprawling platline/titanium/whatever spreadsheets (I know, this is already sounding unrealistic), and we think, "boy wouldn't it be nice if I could write a script to calculate this crap." But to manually enter recipe data into a script like some sort of __plebian?__ *scoff*

### But why do it this ugly way?

Other methods of accessing recipe data are limited. You can:
1. Dig up crafting .json files, but those are almost strictly limited to vanilla shaped/shapeless crafting recipes. Most mods don't even do this, and instead add crafting recipes programmatically at game startup.
2. Dig into the mod's source code. Some mods (notably AE2) have non-sucky ways of storing recipes in nice config files.
3. Write a mods that interfaces with a mod's own recipe implementation. GT5-Unofficial sports a *chonking* RecipeMap that's actually quite nice.
4. Probably something else I didn't see while spiralling through layers of there-has-to-be-a-path-where-I-don't-write-Java denial.

But each of these approaches are limited in how many recipes they can dig up. If you really want *all* recipes for something, there's only one end-all place to get it - NotEnoughItem's GUI. And so that's exactly where this mod looks.

Every mod that integrates with NEI provides one or more recipe handlers. When you ask for how to make/use an item, NEI queries all registered handlers (in the GTNH fork of NEI, this happens [mostly] in parallel). Each handler that offers at least one recipe for that query, becomes a tab in the resulting GUI.

These handlers are rich with all sorts of UI stuff - we're digging into a UI system, after all. But this dumper ain't got time for that. It iterates through every item in the item panel (the list of all items you can see/search) and queries all recipe handlers for how to craft that item. They return a bunch of UI stuff for drawing those recipes to the screen. NERD ignores all that stuff and scrapes item details, other associated items (e.g. fuel), and some extra metadata when it's available (mostly targeted at Gregtech b/c that's what the author cares about, sorry). This all gets dumped into one chonky-lad JSON file.

This JSON file is hideous and has a number of problems. Fuel, for example, cycles on-screen through everything you could use as fuel. This dumper just grabs the first item in that cycle, the sapling. There's a lot of work that could be done to pretty things up. If you're willing to do that and PR it, by all means. I've elected to do this cleaning in Python because Python less suck.
12 changes: 6 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
modName = MyMod
modName = NotEnoughRecipeDumps

# This is a case-sensitive string to identify your mod. Convention is to use lower case.
modId = mymodid
modId = notenoughrecipedumps

modGroup = com.myname.mymodid
modGroup = com.hermanoid.nerd

# WHY is there no version field?
# The build script relies on git to provide a version via tags. It is super easy and will enable you to always know the
Expand Down Expand Up @@ -37,7 +37,7 @@ enableModernJavaSyntax = true
enableGenericInjection = false

# Generate a class with String fields for the mod id, name, version and group name named with the fields below
generateGradleTokenClass = com.myname.mymodid.Tags
generateGradleTokenClass = com.hermanoid.nerd.Tags
gradleTokenModId = MODID
gradleTokenModName = MODNAME
gradleTokenVersion = VERSION
Expand All @@ -52,7 +52,7 @@ replaceGradleTokenInFile =

# In case your mod provides an API for other mods to implement you may declare its package here. Otherwise, you can
# leave this property empty.
# Example value: apiPackage = api + modGroup = com.myname.mymodid -> com.myname.mymodid.api
# Example value: apiPackage = api + modGroup = com.hermanoid.nerd -> com.hermanoid.nerd.api
apiPackage =

# Specify the configuration file for Forge's access transformers here. It must be placed into /src/main/resources/META-INF/
Expand All @@ -70,7 +70,7 @@ mixinPlugin =
mixinsPackage =
# Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin!
# This parameter is for legacy compatibility only
# Example value: coreModClass = asm.FMLPlugin + modGroup = com.myname.mymodid -> com.myname.mymodid.asm.FMLPlugin
# Example value: coreModClass = asm.FMLPlugin + modGroup = com.hermanoid.nerd -> com.hermanoid.nerd.asm.FMLPlugin
coreModClass =
# If your project is only a consolidation of mixins or a core mod and does NOT contain a 'normal' mod ( = some class
# that is annotated with @Mod) you want this to be true. When in doubt: leave it on false!
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.myname.mymodid;
package com.hermanoid.nerd;

public class ClientProxy extends CommonProxy {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.myname.mymodid;
package com.hermanoid.nerd;

import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
Expand All @@ -12,8 +12,8 @@ public class CommonProxy {
public void preInit(FMLPreInitializationEvent event) {
Config.synchronizeConfiguration(event.getSuggestedConfigurationFile());

MyMod.LOG.info(Config.greeting);
MyMod.LOG.info("I am " + Tags.MODNAME + " at version " + Tags.VERSION);
NotEnoughRecipeDumps.LOG.info(Config.greeting);
NotEnoughRecipeDumps.LOG.info("I am " + Tags.MODNAME + " at version " + Tags.VERSION);
}

// load "Do your mod setup. Build whatever data structures you care about. Register recipes." (Remove if not needed)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.myname.mymodid;
package com.hermanoid.nerd;

import java.io.File;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.myname.mymodid;
package com.hermanoid.nerd;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
Expand All @@ -11,11 +11,11 @@
import cpw.mods.fml.common.event.FMLServerStartingEvent;

@Mod(modid = Tags.MODID, version = Tags.VERSION, name = Tags.MODNAME, acceptedMinecraftVersions = "[1.7.10]")
public class MyMod {
public class NotEnoughRecipeDumps {

public static final Logger LOG = LogManager.getLogger(Tags.MODID);

@SidedProxy(clientSide = "com.myname.mymodid.ClientProxy", serverSide = "com.myname.mymodid.CommonProxy")
@SidedProxy(clientSide = "com.hermanoid.nerd.ClientProxy", serverSide = "com.hermanoid.nerd.CommonProxy")
public static CommonProxy proxy;

@Mod.EventHandler
Expand Down

0 comments on commit 6a93df7

Please sign in to comment.