mirror of
https://github.com/GTNewHorizons/Mantle.git
synced 2026-11-26 23:03:15 +00:00
Use ElementText fontrenderer for rendering and add support fro dropshadows
This commit is contained in:
1 parent
ccc2131c15
commit
34e251b49b
3 files changed
+6
-6
No files matched your search
@@ -15,6 +15,7 @@ public class TextData {
|
||||
public boolean strikethrough = false;
|
||||
public boolean obfuscated = false;
|
||||
public boolean paragraph = false;
|
||||
public boolean dropshadow = false;
|
||||
public float scale = 1.F;
|
||||
public String action = "";
|
||||
public String[] tooltip = null;
|
||||
|
||||
@@ -10,18 +10,17 @@ import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import javafx.scene.effect.DropShadow;
|
||||
import slimeknights.mantle.client.book.data.element.TextData;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class TextDataRenderer {
|
||||
|
||||
public static String drawText(int x, int y, int boxWidth, int boxHeight, TextData[] data, int mouseX, int mouseY) {
|
||||
public static String drawText(int x, int y, int boxWidth, int boxHeight, TextData[] data, int mouseX, int mouseY, FontRenderer fr) {
|
||||
String action = "";
|
||||
|
||||
String[] drawLabel = null;
|
||||
|
||||
FontRenderer fr = Minecraft.getMinecraft().fontRendererObj;
|
||||
|
||||
int atX = x;
|
||||
int atY = y;
|
||||
|
||||
@@ -77,7 +76,7 @@ public class TextDataRenderer {
|
||||
}
|
||||
|
||||
String s = split[i];
|
||||
drawScaledString(fr, modifiers + s, atX, atY, 0, false, item.scale);
|
||||
drawScaledString(fr, modifiers + s, atX, atY, 0, item.dropshadow, item.scale);
|
||||
|
||||
if(i < split.length - 1) {
|
||||
atY += fr.FONT_HEIGHT;
|
||||
@@ -125,7 +124,7 @@ public class TextDataRenderer {
|
||||
}
|
||||
|
||||
if(atY >= y + boxHeight) {
|
||||
fr.drawString("...", atX, atY, 0, false);
|
||||
fr.drawString("...", atX, atY, 0, item.dropshadow);
|
||||
break;
|
||||
}
|
||||
y = atY;
|
||||
|
||||
@@ -26,7 +26,7 @@ public class ElementText extends SizedBookElement {
|
||||
|
||||
@Override
|
||||
public void draw(int mouseX, int mouseY, float partialTicks) {
|
||||
String action = TextDataRenderer.drawText(x, y, width, height, text, mouseX, mouseY);
|
||||
String action = TextDataRenderer.drawText(x, y, width, height, text, mouseX, mouseY, fontRenderer);
|
||||
|
||||
if(doAction) {
|
||||
doAction = false;
|
||||
|
||||
Reference in new issue
Block a user