Class ModClassLoader

All Implemented Interfaces:
Closeable, AutoCloseable

public final class ModClassLoader extends URLClassLoader
One instance per mod jar, so two mods bundling different (and differently-versioned) copies of the same library never collide - each mod's own dependency classes are only ever visible through its own loader, not to any other mod.

This can't isolate everything: hloader's agent transforms game classes in place rather than loading them through a custom classloader, so any class a mixin weaves into a game class - the mixin's own class, and anything its injected method body references - still resolves through whatever classloader actually defines that game class (the shared parent), not this mod's own loader. What this isolates is a mod's "normal" code - its entrypoint and anything only it calls into directly - which is where real dependency collisions between mods actually happen.