Skip to content

Commit

Permalink
fix using lotr code without proxy, move to .getDeclaredConstructor().…
Browse files Browse the repository at this point in the history
…newInstance()
  • Loading branch information
mist475 committed Aug 20, 2023
1 parent 88654e3 commit d766eee
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions src/main/java/org/blockartistry/mod/DynSurround/Module.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import org.blockartistry.mod.DynSurround.proxy.Proxy;

import java.io.File;
import java.lang.reflect.InvocationTargetException;

@Mod(modid = Module.MOD_ID, useMetadata = true, dependencies = Module.DEPENDENCIES, version = Module.VERSION, guiFactory = Module.GUI_FACTORY)
public class Module {
Expand All @@ -49,7 +50,7 @@ public class Module {
public static final String DEPENDENCIES = "required-after:Forge@[10.13.4.1614,);required-after:gtnhmixins@[2.0.0,)";
public static final String GUI_FACTORY = "org.blockartistry.mod.DynSurround.client.gui.ConfigGuiFactory";

public static final String LOTR_PROXY_LOCATION = "org.blockartistry.mod.DynSurround.compat.ILotrProxy";
public static final String LOTR_PROXY_LOCATION = "org.blockartistry.mod.DynSurround.compat.LotrProxy";

public static ILOTRProxy LOTR_PROXY;

Expand Down Expand Up @@ -112,9 +113,10 @@ public void postInit(final FMLPostInitializationEvent event) {
proxy.postInit(event);
if (Proxy.LOTR) {
try {
LOTR_PROXY = Class.forName(LOTR_PROXY_LOCATION).asSubclass(ILOTRProxy.class).newInstance();
LOTR_PROXY = Class.forName(LOTR_PROXY_LOCATION).asSubclass(ILOTRProxy.class).getDeclaredConstructor().newInstance();
}
catch (ClassNotFoundException | InstantiationException | IllegalAccessException ignored) {
catch (ClassNotFoundException | InstantiationException | IllegalAccessException | NoSuchMethodException |
InvocationTargetException ignored) {
LOTR_PROXY = new NoLotrProxy();
}
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public static <T> T load(final String modId, final Class<T> clazz) throws Except
if (stream != null)
return load(stream, clazz);
}
return clazz.newInstance();
return clazz.getDeclaredConstructor().newInstance();
}

public static <T> T load(final InputStream stream, final Class<T> clazz) {
Expand Down

0 comments on commit d766eee

Please sign in to comment.