mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-03-15 12:24:28 +07:00
Ignore constructor access modifiers
This commit is contained in:
parent
534f770314
commit
42d96fa356
@ -131,7 +131,7 @@ public class ContentParser{
|
||||
"io.anuke.mindustry.world.blocks.units"
|
||||
);
|
||||
|
||||
block = type.getDeclaredConstructor(String.class).newInstance(mod + "-" + name);
|
||||
block = make(type, mod + "-" + name);
|
||||
}
|
||||
|
||||
currentContent = block;
|
||||
@ -289,6 +289,16 @@ public class ContentParser{
|
||||
}
|
||||
}
|
||||
|
||||
private <T> T make(Class<T> type, String name){
|
||||
try{
|
||||
java.lang.reflect.Constructor<T> cons = type.getDeclaredConstructor(String.class);
|
||||
cons.setAccessible(true);
|
||||
return cons.newInstance(name);
|
||||
}catch(Exception e){
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private <T> Supplier<T> supply(Class<T> type){
|
||||
try{
|
||||
java.lang.reflect.Constructor<T> cons = type.getDeclaredConstructor();
|
||||
|
Loading…
Reference in New Issue
Block a user