slightly nicer error
This commit is contained in:
parent
5839a463cf
commit
fdb41a0411
|
@ -2,6 +2,8 @@
|
|||
# This is required to provide enough memory for the Minecraft decompilation process.
|
||||
org.gradle.jvmargs = -Xmx3G
|
||||
org.gradle.daemon = false
|
||||
org.gradle.caching=true
|
||||
org.gradle.parallel = true
|
||||
|
||||
# mod version info
|
||||
mod_version = 0.5.1.c
|
||||
|
|
|
@ -87,9 +87,16 @@ public class Create {
|
|||
|
||||
public static CreateRegistrate registrate() {
|
||||
Class<?> callerClass = StackWalker.getInstance(StackWalker.Option.RETAIN_CLASS_REFERENCE).getCallerClass();
|
||||
if(callerClass.getPackageName().contains("com.simibubi.create"))
|
||||
if(callerClass.getName().contains("com.simibubi.create"))
|
||||
return REGISTRATE;
|
||||
throw new IllegalCallerException("Create your own registrate!");
|
||||
RuntimeException t = new IllegalCallerException(String.format("Mod %s tried to access Create's registrate! Class: %s", ModLoadingContext.get().getActiveContainer().getModId(), callerClass.getName()));
|
||||
// throw t; // this gets caught by Forge's try-catch, (FMLModContainer line 70)
|
||||
// which makes it harder to pinpoint for new devs
|
||||
// what is going wrong.
|
||||
alternative: // most useful java label
|
||||
t.printStackTrace(); // error shows at bottom of log, clearly indicating what happened
|
||||
System.exit(1);
|
||||
return null;
|
||||
}
|
||||
|
||||
static {
|
||||
|
@ -196,5 +203,4 @@ public class Create {
|
|||
public static ResourceLocation asResource(String path) {
|
||||
return new ResourceLocation(ID, path);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue