-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b01203e
commit 230d0f7
Showing
2 changed files
with
48 additions
and
26 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
33 changes: 33 additions & 0 deletions
33
src/main/java/com/falsepattern/falsetweaks/MultiLineLoadingException.java
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,33 @@ | ||
package com.falsepattern.falsetweaks; | ||
|
||
import lombok.val; | ||
|
||
import net.minecraft.client.gui.FontRenderer; | ||
import net.minecraft.client.gui.GuiErrorScreen; | ||
import cpw.mods.fml.client.CustomModLoadingErrorDisplayException; | ||
import cpw.mods.fml.relauncher.Side; | ||
import cpw.mods.fml.relauncher.SideOnly; | ||
|
||
@SideOnly(Side.CLIENT) | ||
class MultiLineLoadingException extends CustomModLoadingErrorDisplayException { | ||
private final String[] lines; | ||
|
||
public MultiLineLoadingException(String text) { | ||
lines = text.split("\n"); | ||
} | ||
|
||
@Override | ||
public void initGui(GuiErrorScreen errorScreen, FontRenderer fontRenderer) { | ||
|
||
} | ||
|
||
@Override | ||
public void drawScreen(GuiErrorScreen errorScreen, FontRenderer fontRenderer, int mouseRelX, int mouseRelY, float tickTime) { | ||
int offset = errorScreen.height / 2 - (lines.length * 5); | ||
int x = errorScreen.width / 2; | ||
for (val line : lines) { | ||
errorScreen.drawCenteredString(fontRenderer, line, x, offset, 0xFFFFFF); | ||
offset += 10; | ||
} | ||
} | ||
} |