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

@ -20,7 +20,7 @@ public class MixinClassloader extends URLClassLoader {
super.addURL(url); super.addURL(url);
} }
public boolean isClassLoaded(String name){ public boolean isClassLoaded(String name) {
return findLoadedClass(name) != null; return findLoadedClass(name) != null;
} }
@ -32,19 +32,23 @@ public class MixinClassloader extends URLClassLoader {
throw new ClassNotFoundException(name); throw new ClassNotFoundException(name);
} }
synchronized (getClassLoadingLock(name)) {
return defineClass(name, bytes, 0, bytes.length); return defineClass(name, bytes, 0, bytes.length);
}
} catch (IOException aa) { } catch (IOException aa) {
throw new ClassNotFoundException(name, aa); throw new ClassNotFoundException(name, aa);
} }
} }
public byte[] getClassBytes(String name) throws IOException { public byte[] getClassBytes(String name) throws IOException {
String binName = name.replace(".", "/"); String path = name.replace(".", "/").concat(".class");
String path = binName.concat(".class"); synchronized (getClassLoadingLock(name)) {
try (InputStream in = getResourceAsStream(path)) { try (InputStream in = getResourceAsStream(path)) {
if (in == null) if (in == null)
return null; return null;
return in.readAllBytes(); return in.readAllBytes();
} }
} }
}
} }