From f26f9ddbb26d7b70f4183a192f7836370e44f34c Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Thu, 17 Dec 2015 21:58:59 +0100 Subject: [PATCH] New Booklet Main Page Design --- .../booklet/BookletUtils.java | 44 ++++++++++++++++--- .../actuallyadditions/booklet/GuiBooklet.java | 1 + .../assets/actuallyadditions/lang/en_US.lang | 3 ++ 3 files changed, 41 insertions(+), 7 deletions(-) diff --git a/src/main/java/ellpeck/actuallyadditions/booklet/BookletUtils.java b/src/main/java/ellpeck/actuallyadditions/booklet/BookletUtils.java index 2ac6d4cc7..5013906f3 100644 --- a/src/main/java/ellpeck/actuallyadditions/booklet/BookletUtils.java +++ b/src/main/java/ellpeck/actuallyadditions/booklet/BookletUtils.java @@ -19,6 +19,7 @@ import ellpeck.actuallyadditions.booklet.entry.BookletEntry; import ellpeck.actuallyadditions.booklet.entry.BookletEntryAllSearch; import ellpeck.actuallyadditions.booklet.page.BookletPage; import ellpeck.actuallyadditions.util.*; +import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiButton; import net.minecraft.item.ItemStack; import net.minecraft.stats.Achievement; @@ -70,6 +71,30 @@ public class BookletUtils{ //Lower title booklet.drawTexturedModalRect(booklet.guiLeft+booklet.xSize/2-142/2, booklet.guiTop+booklet.ySize, 0, 243, 142, 13); + //Draw No Entry title + if(booklet.currentEntrySet.entry == null){ + String strg = EnumChatFormatting.DARK_GREEN+StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".booklet.manualName.1"); + booklet.getFontRenderer().drawString(strg, booklet.guiLeft+booklet.xSize/2-booklet.getFontRenderer().getStringWidth(strg)/2-3, booklet.guiTop+12, 0); + strg = EnumChatFormatting.DARK_GREEN+StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".booklet.manualName.2"); + booklet.getFontRenderer().drawString(strg, booklet.guiLeft+booklet.xSize/2-booklet.getFontRenderer().getStringWidth(strg)/2-3, booklet.guiTop+12+booklet.getFontRenderer().FONT_HEIGHT, 0); + + String version; + if(Minecraft.getMinecraft().thePlayer.getCommandSenderName().equals("dqmhose")){ + version = "Pants Edition"; + } + else if(Minecraft.getMinecraft().thePlayer.getCommandSenderName().equals("KittyVanCat")){ + version = "Cat's Edition"; + } + else if(Util.isDevVersion()){ + version = "Dev's Edition"; + } + else{ + version = StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".booklet.edition")+" "+ModUtil.VERSION.substring(ModUtil.VERSION.indexOf("r")+1); + } + strg = EnumChatFormatting.GOLD+EnumChatFormatting.ITALIC.toString()+"-"+version+"-"; + booklet.getFontRenderer().drawString(strg, booklet.guiLeft+booklet.xSize/2-booklet.getFontRenderer().getStringWidth(strg)/2-3, booklet.guiTop+33, 0); + } + String strg = booklet.currentEntrySet.chapter == null ? (booklet.currentEntrySet.entry == null ? StringUtil.localize("itemGroup."+ModUtil.MOD_ID_LOWER) : booklet.currentEntrySet.entry.getLocalizedName()) : booklet.currentEntrySet.chapter.getLocalizedName(); booklet.drawCenteredString(booklet.getFontRenderer(), strg, booklet.guiLeft+booklet.xSize/2, booklet.guiTop-9, StringUtil.DECIMAL_COLOR_WHITE); } @@ -215,11 +240,16 @@ public class BookletUtils{ for(int i = 0; i < booklet.chapterButtons.length; i++){ IndexButton button = (IndexButton)booklet.chapterButtons[i]; if(entry == null){ - boolean entryExists = InitBooklet.entries.size() > i; - button.visible = entryExists; - if(entryExists){ - button.displayString = InitBooklet.entries.get(i).getNameWithColor(); - button.chap = null; + if(i >= GuiBooklet.INDEX_BUTTONS_OFFSET){ + boolean entryExists = InitBooklet.entries.size() > i-GuiBooklet.INDEX_BUTTONS_OFFSET; + button.visible = entryExists; + if(entryExists){ + button.displayString = InitBooklet.entries.get(i-GuiBooklet.INDEX_BUTTONS_OFFSET).getNameWithColor(); + button.chap = null; + } + } + else{ + button.visible = false; } } else{ @@ -249,8 +279,8 @@ public class BookletUtils{ } } else{ - if(place < InitBooklet.entries.size()){ - openIndexEntry(booklet, InitBooklet.entries.get(place), 1, true); + if(place-GuiBooklet.INDEX_BUTTONS_OFFSET < InitBooklet.entries.size()){ + openIndexEntry(booklet, InitBooklet.entries.get(place-GuiBooklet.INDEX_BUTTONS_OFFSET), 1, true); } } } diff --git a/src/main/java/ellpeck/actuallyadditions/booklet/GuiBooklet.java b/src/main/java/ellpeck/actuallyadditions/booklet/GuiBooklet.java index 65450850a..04d23a352 100644 --- a/src/main/java/ellpeck/actuallyadditions/booklet/GuiBooklet.java +++ b/src/main/java/ellpeck/actuallyadditions/booklet/GuiBooklet.java @@ -49,6 +49,7 @@ public class GuiBooklet extends GuiScreen{ public static final ResourceLocation resLocValentine = AssetUtil.getBookletGuiLocation("guiBookletValentinesDay"); public static final int CHAPTER_BUTTONS_AMOUNT = 13; + public static final int INDEX_BUTTONS_OFFSET = 3; public int xSize; public int ySize; diff --git a/src/main/resources/assets/actuallyadditions/lang/en_US.lang b/src/main/resources/assets/actuallyadditions/lang/en_US.lang index 807c74d11..72a51a71e 100644 --- a/src/main/resources/assets/actuallyadditions/lang/en_US.lang +++ b/src/main/resources/assets/actuallyadditions/lang/en_US.lang @@ -378,6 +378,9 @@ info.actuallyadditions.inputter.info.1=This is the first Slot in the connected I info.actuallyadditions.inputter.info.2=This is the slot after the last Slot in the connected Inventory to

at. What that means: If you, for example, write 2 in the field to the left and 5 in this one, it will

at Slot 2, 3, and 4. info.actuallyadditions.inputter.whitelistInfo=This applies for this part of the white-/blacklist. The other side applies as well, so you can have some Items whitelisted and some blacklisted. Note that, if you have an empty blacklist or an item whitelisted on at least one side, it will always go through. info.actuallyadditions.noLens=No Lens +info.actuallyadditions.booklet.manualName.1=Actually Additions +info.actuallyadditions.booklet.manualName.2=Manual +info.actuallyadditions.booklet.edition=Edition #Container Names container.actuallyadditions.inputter.name=ESD