rename example mixin config

This commit is contained in:
moehreag 2024-05-20 15:30:58 +02:00
parent 6fd6c3ab34
commit 287214acba
4 changed files with 35 additions and 31 deletions

View file

@ -24,9 +24,9 @@ repositories {
dependencies { dependencies {
implementation(libs.remapper) implementation(libs.remapper)
implementation("org.apache.logging.log4j:log4j-slf4j2-impl:3.0.0-beta2") compileOnly("org.apache.logging.log4j:log4j-slf4j2-impl:3.0.0-beta2")
implementation("org.apache.logging.log4j:log4j-api:3.0.0-beta2") compileOnly("org.apache.logging.log4j:log4j-api:3.0.0-beta2")
implementation("org.apache.logging.log4j:log4j-core:3.0.0-beta2") compileOnly("org.apache.logging.log4j:log4j-core:3.0.0-beta2")
api(libs.mixin) api(libs.mixin)
api(libs.nightconfig) api(libs.nightconfig)

View file

@ -17,5 +17,5 @@ breaks = [
[nonsense.extensions] [nonsense.extensions]
pre_launch = "org/ecorous/esnesnon/nonsense/loader/example/ExamplePreLaunchExtension" pre_launch = "org/ecorous/esnesnon/nonsense/loader/example/ExamplePreLaunchExtension"
mixin_config = "example_mod.mixin.config" mixin_config = "example_mod.mixins.json"

View file

@ -7,22 +7,22 @@ import java.net.URLClassLoader;
public class MixinClassloader extends URLClassLoader { public class MixinClassloader extends URLClassLoader {
static { static {
registerAsParallelCapable(); registerAsParallelCapable();
} }
public MixinClassloader(URL[] urls, ClassLoader parent) { public MixinClassloader(URL[] urls, ClassLoader parent) {
super(urls, parent); super(urls, parent);
} }
@Override @Override
public void addURL(URL url) { public void addURL(URL url) {
super.addURL(url); super.addURL(url);
} }
public boolean isClassLoaded(String name){ public boolean isClassLoaded(String name) {
return findLoadedClass(name) != null; return findLoadedClass(name) != null;
} }
@Override @Override
public Class<?> findClass(String name) throws ClassNotFoundException { public Class<?> findClass(String name) throws ClassNotFoundException {
@ -32,19 +32,23 @@ public class MixinClassloader extends URLClassLoader {
throw new ClassNotFoundException(name); throw new ClassNotFoundException(name);
} }
return defineClass(name, bytes, 0, bytes.length); synchronized (getClassLoadingLock(name)) {
} catch (IOException aa) { return defineClass(name, bytes, 0, bytes.length);
throw new ClassNotFoundException(name, aa); }
} } catch (IOException aa) {
} throw new ClassNotFoundException(name, aa);
}
public byte[] getClassBytes(String name) throws IOException { }
String binName = name.replace(".", "/");
String path = binName.concat(".class"); public byte[] getClassBytes(String name) throws IOException {
try (InputStream in = getResourceAsStream(path)) { String path = name.replace(".", "/").concat(".class");
if (in == null) synchronized (getClassLoadingLock(name)) {
return null; try (InputStream in = getResourceAsStream(path)) {
return in.readAllBytes(); if (in == null)
} return null;
} return in.readAllBytes();
}
}
}
} }