Package dev.jaxydog.astral.datagen
Class JarAccess
java.lang.Object
dev.jaxydog.astral.datagen.JarAccess
Provides safe access to the Minecraft Jar file's assets.
The location of the jar itself should be specified via the "astral.datagen.jar-path" environment variable.
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleancanLoad()Returns whether the Jar can be loaded.static Optional<InputStream> getInputStream(String path) Returns an input stream corresponding to an entry within the Jar, if it exists.static @NotNull JarFilegetJar()Returns the handle for the opened Jar file.getJarEntry(String path, boolean allowDirs) Returns an entry from the Jar, if it exists.
-
Method Details
-
canLoad
public static boolean canLoad()Returns whether the Jar can be loaded.- Returns:
- If the Jar can load;
-
getJar
Returns the handle for the opened Jar file.If closed, the jar will automatically re-open itself when requested again.
- Returns:
- The jar file.
-
getJarEntry
Returns an entry from the Jar, if it exists.- Parameters:
path- The requested Jar path.allowDirs- Whether directories are allowed to be returned.- Returns:
- The optional Jar entry.
-
getInputStream
Returns an input stream corresponding to an entry within the Jar, if it exists.- Parameters:
path- The requested Jar path.- Returns:
- The optional input stream.
-