Skip to content

Instantly share code, notes, and snippets.

View jhcato's full-sized avatar

John Cato jhcato

View GitHub Profile
@jhcato
jhcato / ResourceLoader.java
Created November 17, 2021 18:26
This Java class will read a file from the resources directory in a jar or from off of the file system. I was planning on using this to create a Minecraft mod that runs on both Forge and Fabric, but Forge uses something called the UnionFileSystem while in dev mode, which this doesn't work with at all. So, back to the drawing board with that, but …
package dakota.common.util;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;
import java.io.IOException;
import java.io.InputStream;