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 {
implementation(libs.remapper)
implementation("org.apache.logging.log4j:log4j-slf4j2-impl:3.0.0-beta2")
implementation("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-slf4j2-impl:3.0.0-beta2")
compileOnly("org.apache.logging.log4j:log4j-api:3.0.0-beta2")
compileOnly("org.apache.logging.log4j:log4j-core:3.0.0-beta2")
api(libs.mixin)
api(libs.nightconfig)

View file

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