mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-22 15:18:34 +01:00
parent
b972e9433b
commit
ccb88fd416
3 changed files with 24 additions and 14 deletions
|
@ -13,6 +13,7 @@ package de.ellpeck.actuallyadditions.mod.booklet.gui;
|
||||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||||
import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
|
import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
|
||||||
import de.ellpeck.actuallyadditions.mod.booklet.button.BookmarkButton;
|
import de.ellpeck.actuallyadditions.mod.booklet.button.BookmarkButton;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues;
|
||||||
import de.ellpeck.actuallyadditions.mod.data.PlayerData;
|
import de.ellpeck.actuallyadditions.mod.data.PlayerData;
|
||||||
import de.ellpeck.actuallyadditions.mod.data.PlayerData.PlayerSave;
|
import de.ellpeck.actuallyadditions.mod.data.PlayerData.PlayerSave;
|
||||||
import de.ellpeck.actuallyadditions.mod.inventory.gui.TexturedButton;
|
import de.ellpeck.actuallyadditions.mod.inventory.gui.TexturedButton;
|
||||||
|
@ -66,6 +67,21 @@ public abstract class GuiBooklet extends GuiBookletBase{
|
||||||
this.ySize = 180;
|
this.ySize = 180;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static float getFontSize(String lang, ConfigIntValues config, float defaultValue){
|
||||||
|
int conf = config.getValue();
|
||||||
|
if(conf <= 0){
|
||||||
|
try{
|
||||||
|
return Float.parseFloat(StringUtil.localize("booklet."+ModUtil.MOD_ID+".fontSize."+lang));
|
||||||
|
}
|
||||||
|
catch(Exception e){
|
||||||
|
return defaultValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
return (float)conf/100F;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initGui(){
|
public void initGui(){
|
||||||
super.initGui();
|
super.initGui();
|
||||||
|
@ -73,18 +89,9 @@ public abstract class GuiBooklet extends GuiBookletBase{
|
||||||
this.guiLeft = (this.width-this.xSize)/2;
|
this.guiLeft = (this.width-this.xSize)/2;
|
||||||
this.guiTop = (this.height-this.ySize)/2;
|
this.guiTop = (this.height-this.ySize)/2;
|
||||||
|
|
||||||
try{
|
this.smallFontSize = getFontSize("small", ConfigIntValues.FONT_SIZE_SMALL, 0.5F);
|
||||||
this.smallFontSize = Float.parseFloat(StringUtil.localize("booklet."+ModUtil.MOD_ID+".fontSize.small"));
|
this.mediumFontSize = getFontSize("medium", ConfigIntValues.FONT_SIZE_MEDIUM, 0.75F);
|
||||||
this.mediumFontSize = Float.parseFloat(StringUtil.localize("booklet."+ModUtil.MOD_ID+".fontSize.medium"));
|
this.largeFontSize = getFontSize("large", ConfigIntValues.FONT_SIZE_LARGE, 0.8F);
|
||||||
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()){
|
if(this.hasPageLeftButton()){
|
||||||
List<String> hoverText = Arrays.asList(TextFormatting.GOLD+"Previous Page", TextFormatting.ITALIC+"Or scroll up");
|
List<String> hoverText = Arrays.asList(TextFormatting.GOLD+"Previous Page", TextFormatting.ITALIC+"Or scroll up");
|
||||||
|
|
|
@ -14,7 +14,6 @@ import java.util.Locale;
|
||||||
|
|
||||||
public enum ConfigCategories{
|
public enum ConfigCategories{
|
||||||
|
|
||||||
PERFORMANCE("Performance", "Performance Settings"),
|
|
||||||
TOOL_VALUES("Tool Values", "Values for Tools"),
|
TOOL_VALUES("Tool Values", "Values for Tools"),
|
||||||
MACHINE_VALUES("Machine Values", "Values for Machines"),
|
MACHINE_VALUES("Machine Values", "Values for Machines"),
|
||||||
MOB_DROPS("Mob Drops", "Everything regarding Item drops from mobs"),
|
MOB_DROPS("Mob Drops", "Everything regarding Item drops from mobs"),
|
||||||
|
|
|
@ -25,7 +25,11 @@ public enum ConfigIntValues{
|
||||||
WORMS_DIE_TIME("Worm Death Time", ConfigCategories.OTHER, 0, 0, 10000000, "The amount of ticks it takes for a worm to die. When at 0 ticks, it will not die."),
|
WORMS_DIE_TIME("Worm Death Time", ConfigCategories.OTHER, 0, 0, 10000000, "The amount of ticks it takes for a worm to die. When at 0 ticks, it will not die."),
|
||||||
|
|
||||||
TILE_ENTITY_UPDATE_INTERVAL("Tile Entities: Update Interval", ConfigCategories.OTHER, 5, 1, 100, "The amount of ticks waited before a TileEntity sends an additional Update to the Client"),
|
TILE_ENTITY_UPDATE_INTERVAL("Tile Entities: Update Interval", ConfigCategories.OTHER, 5, 1, 100, "The amount of ticks waited before a TileEntity sends an additional Update to the Client"),
|
||||||
CTRL_INFO_NBT_CHAR_LIMIT("Advanced Info NBT Character Limit", ConfigCategories.OTHER, 1000, 0, 100000000, "The maximum amount of characters that is displayed by the NBT view of the CTRL Advanced Info. Set to a zero to have no limit");
|
CTRL_INFO_NBT_CHAR_LIMIT("Advanced Info NBT Character Limit", ConfigCategories.OTHER, 1000, 0, 100000000, "The maximum amount of characters that is displayed by the NBT view of the CTRL Advanced Info. Set to a zero to have no limit"),
|
||||||
|
|
||||||
|
FONT_SIZE_SMALL("Booklet Small Font Size", ConfigCategories.OTHER, 0, 0, 500, "The size of the booklet's small font in percent. Set to 0 to use defaults from the lang file."),
|
||||||
|
FONT_SIZE_MEDIUM("Booklet Medium Font Size", ConfigCategories.OTHER, 0, 0, 500, "The size of the booklet's medium font in percent. Set to 0 to use defaults from the lang file."),
|
||||||
|
FONT_SIZE_LARGE("Booklet Large Font Size", ConfigCategories.OTHER, 0, 0, 500, "The size of the booklet's large font in percent. Set to 0 to use defaults from the lang file.");
|
||||||
|
|
||||||
public final String name;
|
public final String name;
|
||||||
public final String category;
|
public final String category;
|
||||||
|
|
Loading…
Reference in a new issue