mirror of
https://github.com/GTNewHorizons/Mantle.git
synced 2026-11-27 23:32:59 +00:00
Change the tooltip rendering in books over to forge tooltip rendering
This commit is contained in:
1 parent
1c670116e4
commit
7c9f7906a8
2 files changed
+8
-54
No files matched your search
@@ -6,6 +6,7 @@ import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.gui.IProgressMeter;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.texture.TextureManager;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -184,6 +185,7 @@ public class GuiBook extends GuiScreen implements IProgressMeter {
|
||||
|
||||
if(page == -1) {
|
||||
render.bindTexture(TEX_BOOKFRONT);
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
|
||||
GlStateManager.color(coverR, coverG, coverB);
|
||||
drawModalRectWithCustomSizedTexture(width / 2 - PAGE_WIDTH_UNSCALED / 2, height / 2 - PAGE_HEIGHT_UNSCALED / 2, 0, 0, PAGE_WIDTH_UNSCALED, PAGE_HEIGHT_UNSCALED, TEX_SIZE, TEX_SIZE);
|
||||
@@ -211,6 +213,7 @@ public class GuiBook extends GuiScreen implements IProgressMeter {
|
||||
}
|
||||
} else {
|
||||
render.bindTexture(TEX_BOOK);
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
|
||||
GlStateManager.color(coverR, coverG, coverB);
|
||||
drawModalRectWithCustomSizedTexture(width / 2 - PAGE_WIDTH_UNSCALED, height / 2 - PAGE_HEIGHT_UNSCALED / 2, 0, 0, PAGE_WIDTH_UNSCALED * 2, PAGE_HEIGHT_UNSCALED, TEX_SIZE, TEX_SIZE);
|
||||
@@ -256,6 +259,7 @@ public class GuiBook extends GuiScreen implements IProgressMeter {
|
||||
render.bindTexture(TEX_BOOK);
|
||||
// Set color back to white
|
||||
GlStateManager.color(1F, 1F, 1F, 1F);
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
|
||||
if((page < book.getFullPageCount(statFile) - 1 || book.getPageCount(statFile) % 2 != 0) && page < book
|
||||
.getFullPageCount(statFile)) {
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package slimeknights.mantle.client.gui.book;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
@@ -7,6 +9,7 @@ import net.minecraft.client.renderer.VertexBuffer;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
import net.minecraftforge.fml.client.config.GuiUtils;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@@ -211,60 +214,7 @@ public class TextDataRenderer {
|
||||
|
||||
//BEGIN METHODS FROM GUI
|
||||
private static void drawHoveringText(String[] textLines, int x, int y, FontRenderer font) {
|
||||
if(textLines.length > 0) {
|
||||
GlStateManager.disableDepth();
|
||||
int i = 0;
|
||||
|
||||
for(String s : textLines) {
|
||||
int j = font.getStringWidth(s);
|
||||
|
||||
if(j > i) {
|
||||
i = j;
|
||||
}
|
||||
}
|
||||
|
||||
int l1 = x + 12;
|
||||
int i2 = y - 12;
|
||||
int k = 8;
|
||||
|
||||
if(textLines.length > 1) {
|
||||
k += 2 + (textLines.length - 1) * 10;
|
||||
}
|
||||
|
||||
if(l1 + i > GuiBook.PAGE_WIDTH) {
|
||||
l1 -= 28 + i;
|
||||
}
|
||||
|
||||
if(i2 + k + 6 > GuiBook.PAGE_HEIGHT) {
|
||||
i2 = GuiBook.PAGE_HEIGHT - k - 6;
|
||||
}
|
||||
|
||||
int l = -267386864;
|
||||
drawGradientRect(l1 - 3, i2 - 4, l1 + i + 3, i2 - 3, l, l);
|
||||
drawGradientRect(l1 - 3, i2 + k + 3, l1 + i + 3, i2 + k + 4, l, l);
|
||||
drawGradientRect(l1 - 3, i2 - 3, l1 + i + 3, i2 + k + 3, l, l);
|
||||
drawGradientRect(l1 - 4, i2 - 3, l1 - 3, i2 + k + 3, l, l);
|
||||
drawGradientRect(l1 + i + 3, i2 - 3, l1 + i + 4, i2 + k + 3, l, l);
|
||||
int i1 = 1347420415;
|
||||
int j1 = (i1 & 16711422) >> 1 | i1 & -16777216;
|
||||
drawGradientRect(l1 - 3, i2 - 3 + 1, l1 - 3 + 1, i2 + k + 3 - 1, i1, j1);
|
||||
drawGradientRect(l1 + i + 2, i2 - 3 + 1, l1 + i + 3, i2 + k + 3 - 1, i1, j1);
|
||||
drawGradientRect(l1 - 3, i2 - 3, l1 + i + 3, i2 - 3 + 1, i1, i1);
|
||||
drawGradientRect(l1 - 3, i2 + k + 2, l1 + i + 3, i2 + k + 3, j1, j1);
|
||||
|
||||
for(int k1 = 0; k1 < textLines.length; ++k1) {
|
||||
String s1 = textLines[k1];
|
||||
font.drawStringWithShadow(s1, (float) l1, (float) i2, -1);
|
||||
|
||||
if(k1 == 0) {
|
||||
i2 += 2;
|
||||
}
|
||||
|
||||
i2 += 10;
|
||||
}
|
||||
|
||||
GlStateManager.enableDepth();
|
||||
}
|
||||
GuiUtils.drawHoveringText(ImmutableList.copyOf(textLines), x, y, GuiBook.PAGE_WIDTH, GuiBook.PAGE_HEIGHT, GuiBook.PAGE_WIDTH, font);
|
||||
}
|
||||
|
||||
public static void drawScaledString(FontRenderer font, String text, float x, float y, int color, boolean dropShadow, float scale) {
|
||||
|
||||
Reference in new issue
Block a user