mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-12-27 13:29:24 +01:00
Fixed Optifine breaking the booklet text
Closes https://github.com/Ellpeck/ActuallyAdditions/issues/14
This commit is contained in:
parent
4ede6fc608
commit
267546eff4
10 changed files with 45 additions and 34 deletions
|
@ -18,12 +18,10 @@ import ellpeck.actuallyadditions.update.UpdateChecker;
|
|||
import ellpeck.actuallyadditions.util.*;
|
||||
import ellpeck.actuallyadditions.util.playerdata.PersistentClientData;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.gui.GuiTextField;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
@ -40,7 +38,6 @@ public class GuiBooklet extends GuiScreen{
|
|||
public static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiBooklet");
|
||||
public static final int CHAPTER_BUTTONS_AMOUNT = 13;
|
||||
public static final int TOOLTIP_SPLIT_LENGTH = 200;
|
||||
public FontRenderer unicodeRenderer;
|
||||
public int xSize;
|
||||
public int ySize;
|
||||
public int guiLeft;
|
||||
|
@ -79,6 +76,9 @@ public class GuiBooklet extends GuiScreen{
|
|||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void drawScreen(int x, int y, float f){
|
||||
boolean unicodeBefore = this.fontRendererObj.getUnicodeFlag();
|
||||
this.fontRendererObj.setUnicodeFlag(true);
|
||||
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.mc.getTextureManager().bindTexture(resLoc);
|
||||
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, this.isGimmicky() ? 256 : this.xSize, this.isGimmicky() ? 256 : this.ySize);
|
||||
|
@ -87,6 +87,7 @@ public class GuiBooklet extends GuiScreen{
|
|||
this.drawTexturedModalRect(this.guiLeft+146, this.guiTop+160, 146, 80, 70, 14);
|
||||
}
|
||||
|
||||
this.fontRendererObj.setUnicodeFlag(false);
|
||||
if(this.currentIndexEntry != null){
|
||||
if(this.currentChapter == null){
|
||||
this.drawCenteredString(this.fontRendererObj, this.currentIndexEntry.getLocalizedName(), this.guiLeft+this.xSize/2, this.guiTop-8, StringUtil.DECIMAL_COLOR_WHITE);
|
||||
|
@ -98,26 +99,27 @@ public class GuiBooklet extends GuiScreen{
|
|||
else{
|
||||
this.drawCenteredString(this.fontRendererObj, StringUtil.localize("itemGroup."+ModUtil.MOD_ID_LOWER), this.guiLeft+this.xSize/2, this.guiTop-8, StringUtil.DECIMAL_COLOR_WHITE);
|
||||
}
|
||||
this.fontRendererObj.setUnicodeFlag(true);
|
||||
|
||||
if(this.currentIndexEntry != null){
|
||||
if(this.currentChapter != null && this.currentPage != null){
|
||||
this.drawCenteredString(this.unicodeRenderer, this.currentPage.getID()+"/"+this.currentChapter.pages.length, this.guiLeft+this.xSize/2, this.guiTop+172, StringUtil.DECIMAL_COLOR_WHITE);
|
||||
this.drawCenteredString(this.fontRendererObj, this.currentPage.getID()+"/"+this.currentChapter.pages.length, this.guiLeft+this.xSize/2, this.guiTop+172, StringUtil.DECIMAL_COLOR_WHITE);
|
||||
this.currentPage.renderPre(this, x, y, this.mouseClicked, this.ticksElapsed);
|
||||
}
|
||||
else{
|
||||
this.drawCenteredString(this.unicodeRenderer, this.pageOpenInIndex+"/"+this.indexPageAmount, this.guiLeft+this.xSize/2, this.guiTop+172, StringUtil.DECIMAL_COLOR_WHITE);
|
||||
this.drawCenteredString(this.fontRendererObj, this.pageOpenInIndex+"/"+this.indexPageAmount, this.guiLeft+this.xSize/2, this.guiTop+172, StringUtil.DECIMAL_COLOR_WHITE);
|
||||
}
|
||||
}
|
||||
|
||||
if(this.isGimmicky()){
|
||||
this.unicodeRenderer.drawSplitString("This book looks a lot like the one from Botania, doesn't it? Well, I think it does, too, and I'm kind of annoyed by it to be honest. Wasn't really meant to be that way. I guess I just kind of had the design of the Botania Book in mind when designing this. Well. I made the Code on my own, so I don't really care. Also: How did you find this gimmick? :P -Peck", this.guiLeft-80-3, this.guiTop+25, 80, StringUtil.DECIMAL_COLOR_WHITE);
|
||||
this.fontRendererObj.drawSplitString("This book looks a lot like the one from Botania, doesn't it? Well, I think it does, too, and I'm kind of annoyed by it to be honest. Wasn't really meant to be that way. I guess I just kind of had the design of the Botania Book in mind when designing this. Well. I made the Code on my own, so I don't really care. Also: How did you find this gimmick? :P -Peck", this.guiLeft-80-3, this.guiTop+25, 80, StringUtil.DECIMAL_COLOR_WHITE);
|
||||
|
||||
String strg = "Click this! I need followaz #Pathetic #DontTakeSeriously ->";
|
||||
this.unicodeRenderer.drawString(strg, this.guiLeft-this.unicodeRenderer.getStringWidth(strg)-3, this.guiTop, StringUtil.DECIMAL_COLOR_WHITE);
|
||||
this.fontRendererObj.drawString(strg, this.guiLeft-this.fontRendererObj.getStringWidth(strg)-3, this.guiTop, StringUtil.DECIMAL_COLOR_WHITE);
|
||||
|
||||
if(this.currentChapter == InitBooklet.chapterIntro && this.currentPage == InitBooklet.chapterIntro.pages[1]){
|
||||
strg = "Hey Hose, I kind of hate you a bit for that Ellopecko thing. (Not really! It's fun and games and stuff! :D)";
|
||||
this.unicodeRenderer.drawString(strg, this.guiLeft+this.xSize/2-this.unicodeRenderer.getStringWidth(strg)/2, this.guiTop-20, StringUtil.DECIMAL_COLOR_WHITE);
|
||||
this.fontRendererObj.drawString(strg, this.guiLeft+this.xSize/2-this.fontRendererObj.getStringWidth(strg)/2, this.guiTop-20, StringUtil.DECIMAL_COLOR_WHITE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -128,6 +130,7 @@ public class GuiBooklet extends GuiScreen{
|
|||
this.currentPage.render(this, x, y, this.mouseClicked, this.ticksElapsed);
|
||||
}
|
||||
|
||||
this.fontRendererObj.setUnicodeFlag(false);
|
||||
//Achievements Hover Text
|
||||
if(x >= this.guiLeft+138 && x <= this.guiLeft+138+7 && y >= this.guiTop && y <= this.guiTop+7){
|
||||
this.func_146283_a(Collections.singletonList(EnumChatFormatting.GOLD+"Show Achievements"), x, y);
|
||||
|
@ -163,6 +166,8 @@ public class GuiBooklet extends GuiScreen{
|
|||
if(this.mouseClicked){
|
||||
this.mouseClicked = false;
|
||||
}
|
||||
|
||||
this.fontRendererObj.setUnicodeFlag(unicodeBefore);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
@ -193,11 +198,6 @@ public class GuiBooklet extends GuiScreen{
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderToolTip(ItemStack stack, int x, int y){
|
||||
super.renderToolTip(stack, x, y);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(int par1, int par2, int par3){
|
||||
this.searchField.mouseClicked(par1, par2, par3);
|
||||
|
@ -318,8 +318,6 @@ public class GuiBooklet extends GuiScreen{
|
|||
this.guiLeft = (this.width-this.xSize)/2;
|
||||
this.guiTop = (this.height-this.ySize)/2;
|
||||
|
||||
this.unicodeRenderer = new FontRenderer(this.mc.gameSettings, new ResourceLocation("textures/font/ascii.png"), this.mc.renderEngine, true);
|
||||
|
||||
this.buttonForward = new TexturedButton(0, this.guiLeft+this.xSize, this.guiTop+this.ySize+2, 164, 0, 18, 10);
|
||||
this.buttonList.add(this.buttonForward);
|
||||
|
||||
|
@ -353,7 +351,7 @@ public class GuiBooklet extends GuiScreen{
|
|||
this.buttonList.add(this.chapterButtons[i]);
|
||||
}
|
||||
|
||||
this.searchField = new GuiTextField(this.unicodeRenderer, guiLeft+148, guiTop+162, 66, 10);
|
||||
this.searchField = new GuiTextField(this.fontRendererObj, guiLeft+148, guiTop+162, 66, 10);
|
||||
this.searchField.setMaxStringLength(30);
|
||||
this.searchField.setEnableBackgroundDrawing(false);
|
||||
|
||||
|
@ -539,7 +537,7 @@ public class GuiBooklet extends GuiScreen{
|
|||
}
|
||||
}
|
||||
|
||||
this.gui.unicodeRenderer.drawString((this.field_146123_n ? EnumChatFormatting.UNDERLINE : "")+this.displayString, this.xPosition+textOffsetX, this.yPosition+(this.height-8)/2, color);
|
||||
this.gui.fontRendererObj.drawString((this.field_146123_n ? EnumChatFormatting.UNDERLINE : "")+this.displayString, this.xPosition+textOffsetX, this.yPosition+(this.height-8)/2, color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,8 +51,13 @@ public class BookletPage{
|
|||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x, y, 0);
|
||||
GL11.glScalef(scale, scale, scale);
|
||||
RenderItem.getInstance().renderItemAndEffectIntoGUI(gui.unicodeRenderer, gui.mc.getTextureManager(), stack, 0, 0);
|
||||
|
||||
boolean flagBefore = gui.mc.fontRenderer.getUnicodeFlag();
|
||||
gui.mc.fontRenderer.setUnicodeFlag(false);
|
||||
RenderItem.getInstance().renderItemAndEffectIntoGUI(gui.mc.fontRenderer, gui.mc.getTextureManager(), stack, 0, 0);
|
||||
RenderItem.getInstance().renderItemOverlayIntoGUI(gui.mc.fontRenderer, gui.mc.getTextureManager(), stack, 0, 0);
|
||||
gui.mc.fontRenderer.setUnicodeFlag(flagBefore);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
GL11.glPopMatrix();
|
||||
|
@ -104,6 +109,9 @@ public class BookletPage{
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
protected void renderTooltipAndTransfer(GuiBooklet gui, ItemStack stack, int x, int y, boolean checkAndTransfer, boolean mouseClick){
|
||||
boolean flagBefore = gui.mc.fontRenderer.getUnicodeFlag();
|
||||
gui.mc.fontRenderer.setUnicodeFlag(false);
|
||||
|
||||
List list = stack.getTooltip(gui.mc.thePlayer, gui.mc.gameSettings.advancedItemTooltips);
|
||||
|
||||
for(int k = 0; k < list.size(); ++k){
|
||||
|
@ -132,6 +140,8 @@ public class BookletPage{
|
|||
}
|
||||
|
||||
gui.drawHoveringText(list, x, y);
|
||||
|
||||
gui.mc.fontRenderer.setUnicodeFlag(flagBefore);
|
||||
}
|
||||
|
||||
public ItemStack[] getItemStacksForPage(){
|
||||
|
|
|
@ -36,15 +36,15 @@ public class PageCoffeeRecipe extends BookletPage{
|
|||
@Override
|
||||
public void render(GuiBooklet gui, int mouseX, int mouseY, boolean mouseClick, int ticksElapsed){
|
||||
String strg = "Coffee Machine Recipe";
|
||||
gui.unicodeRenderer.drawString(strg, gui.guiLeft+gui.xSize/2-gui.unicodeRenderer.getStringWidth(strg)/2, gui.guiTop+10, 0);
|
||||
gui.mc.fontRenderer.drawString(strg, gui.guiLeft+gui.xSize/2-gui.mc.fontRenderer.getStringWidth(strg)/2, gui.guiTop+10, 0);
|
||||
|
||||
String text = gui.currentPage.getText();
|
||||
if(text != null && !text.isEmpty()){
|
||||
gui.unicodeRenderer.drawSplitString(text, gui.guiLeft+14, gui.guiTop+100, 115, 0);
|
||||
gui.mc.fontRenderer.drawSplitString(text, gui.guiLeft+14, gui.guiTop+100, 115, 0);
|
||||
}
|
||||
|
||||
if(this.ingredient.maxAmplifier > 0){
|
||||
gui.unicodeRenderer.drawString("Maximum Amplifier: "+this.ingredient.maxAmplifier, gui.guiLeft+19+5, gui.guiTop+20+60, 0);
|
||||
gui.mc.fontRenderer.drawString("Maximum Amplifier: "+this.ingredient.maxAmplifier, gui.guiLeft+19+5, gui.guiTop+20+60, 0);
|
||||
}
|
||||
|
||||
for(int i = 0; i < 2; i++){
|
||||
|
|
|
@ -55,16 +55,16 @@ public class PageCrafting extends BookletPage{
|
|||
IRecipe recipe = this.recipes[this.recipePos];
|
||||
|
||||
if(recipe == null){
|
||||
gui.unicodeRenderer.drawSplitString(EnumChatFormatting.DARK_RED+StringUtil.localize("booklet."+ModUtil.MOD_ID_LOWER+".recipeDisabled"), gui.guiLeft+14, gui.guiTop+15, 115, 0);
|
||||
gui.mc.fontRenderer.drawSplitString(EnumChatFormatting.DARK_RED+StringUtil.localize("booklet."+ModUtil.MOD_ID_LOWER+".recipeDisabled"), gui.guiLeft+14, gui.guiTop+15, 115, 0);
|
||||
}
|
||||
else{
|
||||
String strg = StringUtil.localize("booklet."+ModUtil.MOD_ID_LOWER+"."+(recipe instanceof ShapedRecipes ? "shapedRecipe" : (recipe instanceof ShapelessRecipes ? "shapelessRecipe" : (recipe instanceof ShapelessOreRecipe ? "shapelessOreRecipe" : "shapedOreRecipe"))));
|
||||
gui.unicodeRenderer.drawString(strg, gui.guiLeft+gui.xSize/2-gui.unicodeRenderer.getStringWidth(strg)/2, gui.guiTop+10, 0);
|
||||
gui.mc.fontRenderer.drawString(strg, gui.guiLeft+gui.xSize/2-gui.mc.fontRenderer.getStringWidth(strg)/2, gui.guiTop+10, 0);
|
||||
}
|
||||
|
||||
String text = gui.currentPage.getText();
|
||||
if(text != null && !text.isEmpty()){
|
||||
gui.unicodeRenderer.drawSplitString(text, gui.guiLeft+14, gui.guiTop+90, 115, 0);
|
||||
gui.mc.fontRenderer.drawSplitString(text, gui.guiLeft+14, gui.guiTop+90, 115, 0);
|
||||
}
|
||||
|
||||
if(recipe != null){
|
||||
|
@ -131,7 +131,7 @@ public class PageCrafting extends BookletPage{
|
|||
}
|
||||
}
|
||||
if(mouseX >= xShowOutput && mouseX <= xShowOutput+16 && mouseY >= yShowOutput && mouseY <= yShowOutput+16){
|
||||
gui.renderToolTip(recipe.getRecipeOutput(), mouseX, mouseY);
|
||||
this.renderTooltipAndTransfer(gui, recipe.getRecipeOutput(), mouseX, mouseY, false, mouseClick);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,20 +41,20 @@ public class PageCrusherRecipe extends BookletPage{
|
|||
@Override
|
||||
public void render(GuiBooklet gui, int mouseX, int mouseY, boolean mouseClick, int ticksElapsed){
|
||||
if(recipe == null){
|
||||
gui.unicodeRenderer.drawSplitString(EnumChatFormatting.DARK_RED+StringUtil.localize("booklet."+ModUtil.MOD_ID_LOWER+".recipeDisabled"), gui.guiLeft+14, gui.guiTop+15, 115, 0);
|
||||
gui.mc.fontRenderer.drawSplitString(EnumChatFormatting.DARK_RED+StringUtil.localize("booklet."+ModUtil.MOD_ID_LOWER+".recipeDisabled"), gui.guiLeft+14, gui.guiTop+15, 115, 0);
|
||||
}
|
||||
else{
|
||||
String strg = "Crusher Recipe";
|
||||
gui.unicodeRenderer.drawString(strg, gui.guiLeft+gui.xSize/2-gui.unicodeRenderer.getStringWidth(strg)/2, gui.guiTop+10, 0);
|
||||
gui.mc.fontRenderer.drawString(strg, gui.guiLeft+gui.xSize/2-gui.mc.fontRenderer.getStringWidth(strg)/2, gui.guiTop+10, 0);
|
||||
}
|
||||
|
||||
String text = gui.currentPage.getText();
|
||||
if(text != null && !text.isEmpty()){
|
||||
gui.unicodeRenderer.drawSplitString(text, gui.guiLeft+14, gui.guiTop+100, 115, 0);
|
||||
gui.mc.fontRenderer.drawSplitString(text, gui.guiLeft+14, gui.guiTop+100, 115, 0);
|
||||
}
|
||||
|
||||
if(recipe.secondChance > 0){
|
||||
gui.unicodeRenderer.drawString(recipe.secondChance+"%", gui.guiLeft+37+62, gui.guiTop+20+33, 0);
|
||||
gui.mc.fontRenderer.drawString(recipe.secondChance+"%", gui.guiLeft+37+62, gui.guiTop+20+33, 0);
|
||||
}
|
||||
|
||||
if(recipe.firstOutput != null){
|
||||
|
|
|
@ -50,16 +50,16 @@ public class PageFurnace extends BookletPage{
|
|||
public void render(GuiBooklet gui, int mouseX, int mouseY, boolean mouseClick, int ticksElapsed){
|
||||
ItemStack input = this.input != null ? this.input : this.getInputForOutput(this.result);
|
||||
if(input == null){
|
||||
gui.unicodeRenderer.drawSplitString(EnumChatFormatting.DARK_RED+StringUtil.localize("booklet."+ModUtil.MOD_ID_LOWER+".recipeDisabled"), gui.guiLeft+14, gui.guiTop+15, 115, 0);
|
||||
gui.mc.fontRenderer.drawSplitString(EnumChatFormatting.DARK_RED+StringUtil.localize("booklet."+ModUtil.MOD_ID_LOWER+".recipeDisabled"), gui.guiLeft+14, gui.guiTop+15, 115, 0);
|
||||
}
|
||||
else{
|
||||
String strg = "Furnace Recipe";
|
||||
gui.unicodeRenderer.drawString(strg, gui.guiLeft+gui.xSize/2-gui.unicodeRenderer.getStringWidth(strg)/2, gui.guiTop+10, 0);
|
||||
gui.mc.fontRenderer.drawString(strg, gui.guiLeft+gui.xSize/2-gui.mc.fontRenderer.getStringWidth(strg)/2, gui.guiTop+10, 0);
|
||||
}
|
||||
|
||||
String text = gui.currentPage.getText();
|
||||
if(text != null && !text.isEmpty()){
|
||||
gui.unicodeRenderer.drawSplitString(text, gui.guiLeft+14, gui.guiTop+100, 115, 0);
|
||||
gui.mc.fontRenderer.drawSplitString(text, gui.guiLeft+14, gui.guiTop+100, 115, 0);
|
||||
}
|
||||
|
||||
if(input != null){
|
||||
|
|
|
@ -34,7 +34,7 @@ public class PageTextOnly extends BookletPage{
|
|||
public void renderPre(GuiBooklet gui, int mouseX, int mouseY, boolean mouseClick, int ticksElapsed){
|
||||
String text = gui.currentPage.getText();
|
||||
if(text != null && !text.isEmpty()){
|
||||
gui.unicodeRenderer.drawSplitString(text, gui.guiLeft+14, gui.guiTop+9, 115, 0);
|
||||
gui.mc.fontRenderer.drawSplitString(text, gui.guiLeft+14, gui.guiTop+9, 115, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ import ellpeck.actuallyadditions.booklet.GuiBooklet;
|
|||
import ellpeck.actuallyadditions.booklet.InitBooklet;
|
||||
import ellpeck.actuallyadditions.booklet.page.BookletPage;
|
||||
import ellpeck.actuallyadditions.util.ItemUtil;
|
||||
import ellpeck.actuallyadditions.util.ModUtil;
|
||||
import ellpeck.actuallyadditions.util.StringUtil;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraftforge.client.event.GuiScreenEvent;
|
||||
|
@ -42,7 +43,7 @@ public class NeiScreenEvents{
|
|||
public void drawButton(Minecraft minecraft, int x, int y){
|
||||
super.drawButton(minecraft, x, y);
|
||||
if(this.visible && this.field_146123_n){
|
||||
this.drawString(Minecraft.getMinecraft().fontRenderer, "View more Information", this.xPosition+this.width+5, this.yPosition+this.height/2-Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT/2, StringUtil.DECIMAL_COLOR_WHITE);
|
||||
this.drawString(Minecraft.getMinecraft().fontRenderer, StringUtil.localize("booklet."+ModUtil.MOD_ID_LOWER+".clickToSeeRecipe"), this.xPosition+this.width+5, this.yPosition+this.height/2-Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT/2, StringUtil.DECIMAL_COLOR_WHITE);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -15,6 +15,7 @@ import net.minecraftforge.oredict.OreDictionary;
|
|||
|
||||
import java.util.ArrayList;
|
||||
|
||||
//TODO REDO COMPLETELY
|
||||
public class CrusherRecipeAutoRegistry{
|
||||
|
||||
public static ArrayList<SearchCase> searchCases = new ArrayList<SearchCase>();
|
||||
|
|
|
@ -18,6 +18,7 @@ import net.minecraftforge.oredict.OreDictionary;
|
|||
|
||||
import java.util.ArrayList;
|
||||
|
||||
//TODO REDO COMPLETELY
|
||||
public class CrusherRecipeManualRegistry{
|
||||
|
||||
public static ArrayList<CrusherRecipe> recipes = new ArrayList<CrusherRecipe>();
|
||||
|
|
Loading…
Reference in a new issue