96 lines
2.3 KiB
Java
96 lines
2.3 KiB
Java
package io.gitlab.jfronny.libjf.unsafe.inject;
|
|
|
|
import io.gitlab.jfronny.libjf.unsafe.*;
|
|
import net.fabricmc.api.*;
|
|
import net.fabricmc.loader.impl.launch.*;
|
|
|
|
import java.io.*;
|
|
import java.nio.file.*;
|
|
import java.util.*;
|
|
import java.util.jar.*;
|
|
|
|
public record FabricLauncherClassUnlocker(KnotClassLoaderInterfaceAccessor classLoader) implements FabricLauncher {
|
|
@Override
|
|
public MappingConfiguration getMappingConfiguration() {
|
|
return invalidCall();
|
|
}
|
|
|
|
@Override
|
|
public void addToClassPath(Path path, String... allowedPrefixes) {
|
|
SafeLog.debug("Adding " + path + " to classpath.");
|
|
|
|
classLoader.getDelegate().setAllowedPrefixes(path, allowedPrefixes);
|
|
classLoader.getDelegate().addCodeSource(path);
|
|
}
|
|
|
|
@Override
|
|
public void setAllowedPrefixes(Path path, String... prefixes) {
|
|
classLoader.getDelegate().setAllowedPrefixes(path, prefixes);
|
|
}
|
|
|
|
@Override
|
|
public void setValidParentClassPath(Collection<Path> paths) {
|
|
invalidCall();
|
|
}
|
|
|
|
@Override
|
|
public EnvType getEnvironmentType() {
|
|
return invalidCall();
|
|
}
|
|
|
|
@Override
|
|
public boolean isClassLoaded(String name) {
|
|
return invalidCall();
|
|
}
|
|
|
|
@Override
|
|
public Class<?> loadIntoTarget(String name) throws ClassNotFoundException {
|
|
return invalidCall();
|
|
}
|
|
|
|
@Override
|
|
public InputStream getResourceAsStream(String name) {
|
|
return invalidCall();
|
|
}
|
|
|
|
@Override
|
|
public ClassLoader getTargetClassLoader() {
|
|
return invalidCall();
|
|
}
|
|
|
|
@Override
|
|
public byte[] getClassByteArray(String name, boolean runTransformers) throws IOException {
|
|
return invalidCall();
|
|
}
|
|
|
|
@Override
|
|
public Manifest getManifest(Path originPath) {
|
|
return invalidCall();
|
|
}
|
|
|
|
@Override
|
|
public boolean isDevelopment() {
|
|
return invalidCall();
|
|
}
|
|
|
|
@Override
|
|
public String getEntrypoint() {
|
|
return invalidCall();
|
|
}
|
|
|
|
@Override
|
|
public String getTargetNamespace() {
|
|
return invalidCall();
|
|
}
|
|
|
|
@Override
|
|
public List<Path> getClassPath() {
|
|
return invalidCall();
|
|
}
|
|
|
|
private <T> T invalidCall() {
|
|
SafeLog.warn("Attempted invalid call in class path unlocker");
|
|
throw new IllegalStateException("unlockClassPath attempted to call a method not implemented here");
|
|
}
|
|
}
|