Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add friendly error message if non-deobf and the MekanismApi class is …
…loaded from the api jar
- Loading branch information
Showing
4 changed files
with
65 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package mekanism.client; | ||
|
||
import net.minecraft.client.gui.FontRenderer; | ||
import net.minecraft.client.gui.GuiErrorScreen; | ||
import net.minecraftforge.fml.client.CustomModLoadingErrorDisplayException; | ||
|
||
import javax.annotation.Nonnull; | ||
import javax.annotation.Nullable; | ||
|
||
/** | ||
* Copied from EnderCore | ||
*/ | ||
public class ApiJarPresentException extends CustomModLoadingErrorDisplayException | ||
{ | ||
private static final long serialVersionUID = 1L; | ||
|
||
private final @Nonnull String[] msgs; | ||
|
||
public ApiJarPresentException(@Nonnull String[] msgs) { | ||
super(msgs[0], new RuntimeException()); | ||
this.msgs = msgs; | ||
} | ||
|
||
@Override | ||
public void initGui(GuiErrorScreen errorScreen, FontRenderer fontRenderer) { | ||
} | ||
|
||
@Override | ||
public void drawScreen(@Nullable GuiErrorScreen errorScreen, @Nullable FontRenderer fontRenderer, int mouseRelX, int mouseRelY, float tickTime) { | ||
if (errorScreen == null || fontRenderer == null) { | ||
return; | ||
} | ||
int y = errorScreen.height / 2 - msgs.length * 5; | ||
for (String msg : msgs) { | ||
if (msg != null) { | ||
errorScreen.drawCenteredString(fontRenderer, msg, errorScreen.width / 2, y, 0xFFFFFF); | ||
y += 10; | ||
} else { | ||
y += 5; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
f523000
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love this. Saves a bunch of issues!