mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-22 15:18:34 +01:00
You can now change the booklet's font size in the lang file
Closes #461
This commit is contained in:
parent
b0d3ee66a2
commit
91dc0f4ce1
14 changed files with 68 additions and 20 deletions
|
@ -33,4 +33,10 @@ public abstract class GuiBookletBase extends GuiScreen{
|
|||
public abstract int getSizeY();
|
||||
|
||||
public abstract void addOrModifyItemRenderer(ItemStack renderedStack, int x, int y, float scale, boolean shouldTryTransfer);
|
||||
|
||||
public abstract float getSmallFontSize();
|
||||
|
||||
public abstract float getMediumFontSize();
|
||||
|
||||
public abstract float getLargeFontSize();
|
||||
}
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.booklet.button;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
|
||||
import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiBooklet;
|
||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||
|
@ -23,10 +25,12 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
|||
@SideOnly(Side.CLIENT)
|
||||
public class EntryButton extends GuiButton{
|
||||
|
||||
public ItemStack stackToRender;
|
||||
private final GuiBookletBase gui;
|
||||
private final ItemStack stackToRender;
|
||||
|
||||
public EntryButton(int id, int x, int y, int width, int height, String text, ItemStack stackToRender){
|
||||
public EntryButton(GuiBookletBase gui, int id, int x, int y, int width, int height, String text, ItemStack stackToRender){
|
||||
super(id, x, y, width, height, text);
|
||||
this.gui = gui;
|
||||
this.stackToRender = stackToRender;
|
||||
}
|
||||
|
||||
|
@ -48,7 +52,7 @@ public class EntryButton extends GuiButton{
|
|||
textOffsetX = 10;
|
||||
}
|
||||
|
||||
float scale = 0.75F;
|
||||
float scale = this.gui.getMediumFontSize();
|
||||
|
||||
if(this.hovered){
|
||||
GlStateManager.pushMatrix();
|
||||
|
|
|
@ -18,6 +18,7 @@ import de.ellpeck.actuallyadditions.mod.data.PlayerData.PlayerSave;
|
|||
import de.ellpeck.actuallyadditions.mod.inventory.gui.TexturedButton;
|
||||
import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper;
|
||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
|
@ -53,6 +54,10 @@ public abstract class GuiBooklet extends GuiBookletBase{
|
|||
private GuiButton buttonRight;
|
||||
private GuiButton buttonBack;
|
||||
|
||||
private float smallFontSize;
|
||||
private float mediumFontSize;
|
||||
private float largeFontSize;
|
||||
|
||||
public GuiBooklet(GuiScreen previousScreen, GuiBookletBase parentPage){
|
||||
this.previousScreen = previousScreen;
|
||||
this.parentPage = parentPage;
|
||||
|
@ -68,6 +73,19 @@ public abstract class GuiBooklet extends GuiBookletBase{
|
|||
this.guiLeft = (this.width-this.xSize)/2;
|
||||
this.guiTop = (this.height-this.ySize)/2;
|
||||
|
||||
try{
|
||||
this.smallFontSize = Float.parseFloat(StringUtil.localize("booklet."+ModUtil.MOD_ID+".fontSize.small"));
|
||||
this.mediumFontSize = Float.parseFloat(StringUtil.localize("booklet."+ModUtil.MOD_ID+".fontSize.medium"));
|
||||
this.largeFontSize = Float.parseFloat(StringUtil.localize("booklet."+ModUtil.MOD_ID+".fontSize.large"));
|
||||
}
|
||||
catch(Exception e){
|
||||
ModUtil.LOGGER.error("Getting the booklet font size from the lang file failed!", e);
|
||||
|
||||
this.smallFontSize = 0.5F;
|
||||
this.mediumFontSize = 0.75F;
|
||||
this.largeFontSize = 0.8F;
|
||||
}
|
||||
|
||||
if(this.hasPageLeftButton()){
|
||||
List<String> hoverText = Arrays.asList(TextFormatting.GOLD+"Previous Page", TextFormatting.ITALIC+"Or scroll up");
|
||||
this.buttonLeft = new TexturedButton(RES_LOC_GADGETS, -2000, this.guiLeft-12, this.guiTop+this.ySize-8, 18, 54, 18, 10, hoverText);
|
||||
|
@ -247,6 +265,21 @@ public abstract class GuiBooklet extends GuiBookletBase{
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getSmallFontSize(){
|
||||
return this.smallFontSize;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getMediumFontSize(){
|
||||
return this.mediumFontSize;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getLargeFontSize(){
|
||||
return this.largeFontSize;
|
||||
}
|
||||
|
||||
public void onSearchBarChanged(String searchBarText){
|
||||
GuiBookletBase parent = !(this instanceof GuiEntry) ? this : this.parentPage;
|
||||
this.mc.displayGuiScreen(new GuiEntry(this.previousScreen, parent, ActuallyAdditionsAPI.allAndSearch, 0, searchBarText, true));
|
||||
|
|
|
@ -71,7 +71,7 @@ public class GuiEntry extends GuiBooklet{
|
|||
|
||||
for(int i = 0; i < 2; i++){
|
||||
String pageStrg = "Page "+(this.entryPage*2+i+1)+"/"+this.pageAmount*2;
|
||||
this.renderScaledAsciiString(pageStrg, this.guiLeft+25+i*136, this.guiTop+this.ySize-7, 0xFFFFFF, false, 0.8F);
|
||||
this.renderScaledAsciiString(pageStrg, this.guiLeft+25+i*136, this.guiTop+this.ySize-7, 0xFFFFFF, false, this.getLargeFontSize());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -92,7 +92,7 @@ public class GuiEntry extends GuiBooklet{
|
|||
int id = y+x*BUTTONS_PER_PAGE;
|
||||
if(this.chapters.size() > id+idOffset){
|
||||
IBookletChapter chapter = this.chapters.get(id+idOffset);
|
||||
this.buttonList.add(new EntryButton(id, this.guiLeft+14+x*142, this.guiTop+11+y*13, 115, 10, chapter.getLocalizedNameWithFormatting(), chapter.getDisplayItemStack()));
|
||||
this.buttonList.add(new EntryButton(this, id, this.guiLeft+14+x*142, this.guiTop+11+y*13, 115, 10, chapter.getLocalizedNameWithFormatting(), chapter.getDisplayItemStack()));
|
||||
}
|
||||
else{
|
||||
return;
|
||||
|
|
|
@ -125,7 +125,7 @@ public class GuiMainPage extends GuiBooklet{
|
|||
for(int i = 0; i < BUTTONS_PER_PAGE; i++){
|
||||
if(ActuallyAdditionsAPI.BOOKLET_ENTRIES.size() > i){
|
||||
IBookletEntry entry = ActuallyAdditionsAPI.BOOKLET_ENTRIES.get(i);
|
||||
this.buttonList.add(new EntryButton(i, this.guiLeft+156, this.guiTop+11+i*13, 115, 10, "- "+entry.getLocalizedNameWithFormatting(), null));
|
||||
this.buttonList.add(new EntryButton(this, i, this.guiLeft+156, this.guiTop+11+i*13, 115, 10, "- "+entry.getLocalizedNameWithFormatting(), null));
|
||||
}
|
||||
else{
|
||||
return;
|
||||
|
@ -230,15 +230,15 @@ public class GuiMainPage extends GuiBooklet{
|
|||
|
||||
if(this.showTutorial){
|
||||
String text = TextFormatting.BLUE+"It looks like this is the first time you are using this manual. \nIf you click the button below, some useful bookmarks will be stored at the bottom of the GUI. You should definitely check them out to get started with "+ModUtil.NAME+"! \nIf you don't want this, shift-click the button.";
|
||||
this.renderSplitScaledAsciiString(text, this.guiLeft+11, this.guiTop+55, 0, false, 0.75F, 120);
|
||||
this.renderSplitScaledAsciiString(text, this.guiLeft+11, this.guiTop+55, 0, false, this.getMediumFontSize(), 120);
|
||||
}
|
||||
else if(this.quote != null && !this.quote.isEmpty() && this.quoteGuy != null){
|
||||
int quoteSize = this.quote.size();
|
||||
|
||||
for(int i = 0; i < quoteSize; i++){
|
||||
this.renderScaledAsciiString(TextFormatting.ITALIC+this.quote.get(i), this.guiLeft+25, this.guiTop+90+(i*8), 0, false, 0.75F);
|
||||
this.renderScaledAsciiString(TextFormatting.ITALIC+this.quote.get(i), this.guiLeft+25, this.guiTop+90+(i*8), 0, false, this.getMediumFontSize());
|
||||
}
|
||||
this.renderScaledAsciiString("- "+this.quoteGuy, this.guiLeft+60, this.guiTop+93+quoteSize*8, 0, false, 0.8F);
|
||||
this.renderScaledAsciiString("- "+this.quoteGuy, this.guiLeft+60, this.guiTop+93+quoteSize*8, 0, false, this.getLargeFontSize());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -174,7 +174,7 @@ public class GuiPage extends GuiBooklet{
|
|||
if(page != null){
|
||||
IBookletChapter chapter = this.pages[i].getChapter();
|
||||
String pageStrg = "Page "+(chapter.getPageIndex(this.pages[i])+1)+"/"+chapter.getAllPages().length;
|
||||
this.renderScaledAsciiString(pageStrg, this.guiLeft+25+i*136, this.guiTop+this.ySize-7, 0xFFFFFF, false, 0.8F);
|
||||
this.renderScaledAsciiString(pageStrg, this.guiLeft+25+i*136, this.guiTop+this.ySize-7, 0xFFFFFF, false, this.getLargeFontSize());
|
||||
|
||||
GlStateManager.color(1F, 1F, 1F);
|
||||
page.drawScreenPre(this, this.guiLeft+6+i*142, this.guiTop+7, mouseX, mouseY, partialTicks);
|
||||
|
|
|
@ -41,8 +41,8 @@ public class PageCoffeeMachine extends BookletPage{
|
|||
gui.mc.getTextureManager().bindTexture(GuiBooklet.RES_LOC_GADGETS);
|
||||
GuiUtils.drawTexturedModalRect(startX+5, startY+10, 0, 74, 117, 72, 0);
|
||||
|
||||
gui.renderScaledAsciiString("(Coffee Maker Recipe)", startX+6, startY+78, 0, false, 0.65F);
|
||||
gui.renderSplitScaledAsciiString("Hover over this to see the effect!", startX+5, startY+51, 0, false, 0.5F, 35);
|
||||
gui.renderScaledAsciiString("(Coffee Maker Recipe)", startX+6, startY+78, 0, false, gui.getMediumFontSize());
|
||||
gui.renderSplitScaledAsciiString("Hover over this to see the effect!", startX+5, startY+51, 0, false, gui.getSmallFontSize(), 35);
|
||||
|
||||
PageTextOnly.renderTextToPage(gui, this, startX+6, startY+90);
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ public class PageCrafting extends BookletPage{
|
|||
gui.mc.getTextureManager().bindTexture(GuiBooklet.RES_LOC_GADGETS);
|
||||
GuiUtils.drawTexturedModalRect(startX+5, startY+6, 20, 0, 116, 54, 0);
|
||||
|
||||
gui.renderScaledAsciiString("("+StringUtil.localize(this.recipeTypeLocKey)+")", startX+6, startY+65, 0, false, 0.65F);
|
||||
gui.renderScaledAsciiString("("+StringUtil.localize(this.recipeTypeLocKey)+")", startX+6, startY+65, 0, false, gui.getMediumFontSize());
|
||||
|
||||
PageTextOnly.renderTextToPage(gui, this, startX+6, startY+80);
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ public class PageCrusherRecipe extends BookletPage{
|
|||
gui.mc.getTextureManager().bindTexture(GuiBooklet.RES_LOC_GADGETS);
|
||||
GuiUtils.drawTexturedModalRect(startX+38, startY+6, 136, 0, 52, 74, 0);
|
||||
|
||||
gui.renderScaledAsciiString("(Crusher Recipe)", startX+36, startY+85, 0, false, 0.65F);
|
||||
gui.renderScaledAsciiString("(Crusher Recipe)", startX+36, startY+85, 0, false, gui.getMediumFontSize());
|
||||
|
||||
PageTextOnly.renderTextToPage(gui, this, startX+6, startY+100);
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ public class PageEmpowerer extends BookletPage{
|
|||
gui.mc.getTextureManager().bindTexture(GuiBooklet.RES_LOC_GADGETS);
|
||||
GuiUtils.drawTexturedModalRect(startX+5, startY+10, 117, 74, 116, 72, 0);
|
||||
|
||||
gui.renderScaledAsciiString("(Empowerer Recipe)", startX+6, startY+85, 0, false, 0.65F);
|
||||
gui.renderScaledAsciiString("(Empowerer Recipe)", startX+6, startY+85, 0, false, gui.getMediumFontSize());
|
||||
|
||||
PageTextOnly.renderTextToPage(gui, this, startX+6, startY+100);
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ public class PageFurnace extends BookletPage{
|
|||
gui.mc.getTextureManager().bindTexture(GuiBooklet.RES_LOC_GADGETS);
|
||||
GuiUtils.drawTexturedModalRect(startX+23, startY+10, 0, 146, 80, 26, 0);
|
||||
|
||||
gui.renderScaledAsciiString("(Furnace Recipe)", startX+32, startY+42, 0, false, 0.65F);
|
||||
gui.renderScaledAsciiString("(Furnace Recipe)", startX+32, startY+42, 0, false, gui.getMediumFontSize());
|
||||
|
||||
PageTextOnly.renderTextToPage(gui, this, startX+6, startY+57);
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ public class PageReconstructor extends BookletPage{
|
|||
gui.mc.getTextureManager().bindTexture(GuiBooklet.RES_LOC_GADGETS);
|
||||
GuiUtils.drawTexturedModalRect(startX+30, startY+10, 80, 146, 68, 48, 0);
|
||||
|
||||
gui.renderScaledAsciiString("(Atomic Reconstructor Recipe)", startX+12, startY+63, 0, false, 0.65F);
|
||||
gui.renderScaledAsciiString("(Atomic Reconstructor Recipe)", startX+12, startY+63, 0, false, gui.getMediumFontSize());
|
||||
|
||||
PageTextOnly.renderTextToPage(gui, this, startX+6, startY+88);
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ public class PageTextOnly extends BookletPage{
|
|||
public static void renderTextToPage(GuiBookletBase gui, BookletPage page, int x, int y){
|
||||
String text = page.getInfoText();
|
||||
if(text != null && !text.isEmpty()){
|
||||
gui.renderSplitScaledAsciiString(text, x, y, 0, false, 0.75F, 120);
|
||||
gui.renderSplitScaledAsciiString(text, x, y, 0, false, gui.getMediumFontSize(), 120);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -751,8 +751,8 @@ achievement.actuallyadditions.getUnProbed.desc=Be probed by someone but sneak an
|
|||
#Booklet Recipe Names
|
||||
booklet.actuallyadditions.shapelessRecipe=Shapeless Recipe
|
||||
booklet.actuallyadditions.shapedRecipe=Shaped Recipe
|
||||
booklet.actuallyadditions.shapelessOreRecipe=Shapeless OreDictionary Recipe
|
||||
booklet.actuallyadditions.shapedOreRecipe=Shaped OreDictionary Recipe
|
||||
booklet.actuallyadditions.shapelessOreRecipe=Shapeless OreDict Recipe
|
||||
booklet.actuallyadditions.shapedOreRecipe=Shaped OreDict Recipe
|
||||
|
||||
#Booklet Entries
|
||||
booklet.actuallyadditions.indexEntry.gettingStarted.name=Getting Started
|
||||
|
@ -768,6 +768,11 @@ booklet.actuallyadditions.indexEntry.reconstruction.name=Reconstruction
|
|||
booklet.actuallyadditions.indexEntry.laserRelays.name=Laser Transport
|
||||
booklet.actuallyadditions.indexEntry.updatesAndInfos.name=Updates and Infos
|
||||
|
||||
#Booklet Font Size
|
||||
booklet.actuallyadditions.fontSize.small=0.5
|
||||
booklet.actuallyadditions.fontSize.medium=0.75
|
||||
booklet.actuallyadditions.fontSize.large=0.8
|
||||
|
||||
#Booklet Info
|
||||
booklet.actuallyadditions.recipeDisabled=The crafting recipe for this item is disabled in the Config File! If you're on a server, ask the server author to enable it in the config. If you're on a client, press the 'Open Config'-Button on the top right and enable the recipe!
|
||||
booklet.actuallyadditions.unavailable=Parts of this feature are currently disabled or incomplete due to the not fully complete 1.8.9 and 1.9 Port. You may experience something that's missing or doesn't fully work. Please use this item with caution!
|
||||
|
|
Loading…
Reference in a new issue