aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormakamys <makamys@outlook.com>2023-12-08 18:22:19 +0100
committermakamys <makamys@outlook.com>2023-12-08 18:26:09 +0100
commitb8b2e173656346f2b82eb629a0797c8bd6b0395d (patch)
treeef6250be064787301b6af8b8fd094512120a38de
parent6f273f33f60c8512efdd5a390aca94260742f5cc (diff)
downloadNeodymium-b8b2e173656346f2b82eb629a0797c8bd6b0395d.tar.gz
Neodymium-b8b2e173656346f2b82eb629a0797c8bd6b0395d.tar.bz2
Neodymium-b8b2e173656346f2b82eb629a0797c8bd6b0395d.zip
Un-hardcode package name in VirtualJar
(Makes it easier to drag and drop into other mods.)
-rw-r--r--src/main/java/makamys/neodymium/util/virtualjar/VirtualJar.java7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/main/java/makamys/neodymium/util/virtualjar/VirtualJar.java b/src/main/java/makamys/neodymium/util/virtualjar/VirtualJar.java
index d5049b4..21f5f33 100644
--- a/src/main/java/makamys/neodymium/util/virtualjar/VirtualJar.java
+++ b/src/main/java/makamys/neodymium/util/virtualjar/VirtualJar.java
@@ -30,7 +30,7 @@ public class VirtualJar {
LOGGER.debug("Registering URL protocol handler: " + PROTOCOL);
// We want the Handler to always be loaded by the same class loader.
- Launch.classLoader.addClassLoaderExclusion("makamys." + MODID + ".util.virtualjar.protocol." + PROTOCOL);
+ Launch.classLoader.addClassLoaderExclusion(getPackage() + ".protocol." + PROTOCOL + ".");
// The Handler is loaded by the AppClassLoader, but it needs to access the state of VirtualJar, which is loaded
// by the LaunchClassLoader. The solution? Make the Handler just a proxy that delegates the real work to
@@ -42,6 +42,11 @@ public class VirtualJar {
registered = true;
}
+ private static String getPackage() {
+ String name = VirtualJar.class.getName();
+ return name.substring(0, name.lastIndexOf('.'));
+ }
+
public static void add(IVirtualJar jar) {
registerHandler();