Finished all page types

This commit is contained in:
Ellpeck 2016-11-12 00:29:01 +01:00
parent 5507e2ce60
commit 30849fb304
15 changed files with 301 additions and 15 deletions

View file

@ -10,14 +10,37 @@
package de.ellpeck.actuallyadditions.mod.booklet.chapter;
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry;
import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
import de.ellpeck.actuallyadditions.api.recipe.CoffeeIngredient;
import de.ellpeck.actuallyadditions.mod.booklet.page.BookletPage;
import de.ellpeck.actuallyadditions.mod.booklet.page.PageCoffeeMachine;
import de.ellpeck.actuallyadditions.mod.items.ItemCoffee;
import net.minecraft.item.ItemStack;
//TODO
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class BookletChapterCoffee extends BookletChapter{
public BookletChapterCoffee(String identifier, IBookletEntry entry, ItemStack displayStack, IBookletPage... pages){
super(identifier, entry, displayStack, pages);
super(identifier, entry, displayStack, getPages(pages));
}
private static IBookletPage[] getPages(IBookletPage... pages){
List<IBookletPage> allPages = new ArrayList<IBookletPage>();
allPages.addAll(Arrays.asList(pages));
for(CoffeeIngredient ingredient : ActuallyAdditionsAPI.COFFEE_MACHINE_INGREDIENTS){
BookletPage page = new PageCoffeeMachine(allPages.size()+1, ingredient);
if(!(ingredient instanceof ItemCoffee.MilkIngredient)){
page.setNoText();
}
allPages.add(page);
}
return allPages.toArray(new IBookletPage[allPages.size()]);
}
}

View file

@ -12,12 +12,30 @@ package de.ellpeck.actuallyadditions.mod.booklet.chapter;
import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry;
import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
import de.ellpeck.actuallyadditions.api.recipe.CrusherRecipe;
import de.ellpeck.actuallyadditions.mod.booklet.page.BookletPage;
import de.ellpeck.actuallyadditions.mod.booklet.page.PageCrusherRecipe;
import de.ellpeck.actuallyadditions.mod.crafting.CrusherCrafting;
import net.minecraft.item.ItemStack;
//TODO
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class BookletChapterCrusher extends BookletChapter{
public BookletChapterCrusher(String identifier, IBookletEntry entry, ItemStack displayStack, IBookletPage... pages){
super(identifier, entry, displayStack, pages);
super(identifier, entry, displayStack, getPages(pages));
}
private static IBookletPage[] getPages(IBookletPage... pages){
List<IBookletPage> allPages = new ArrayList<IBookletPage>();
allPages.addAll(Arrays.asList(pages));
for(CrusherRecipe recipe : CrusherCrafting.MISC_RECIPES){
allPages.add(new PageCrusherRecipe(allPages.size()+1, recipe).setNoText());
}
return allPages.toArray(new IBookletPage[allPages.size()]);
}
}

View file

@ -70,7 +70,7 @@ public abstract class GuiBooklet extends GuiBookletBase{
}
if(this.hasBackButton()){
this.buttonBack = new TexturedButton(RES_LOC_GADGETS, -2002, this.guiLeft-12, this.guiTop-2, 36, 54, 18, 10);
this.buttonBack = new TexturedButton(RES_LOC_GADGETS, -2002, this.guiLeft-15, this.guiTop-3, 36, 54, 18, 10);
this.buttonList.add(this.buttonBack);
}
}

View file

@ -35,7 +35,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*16, 115, 10, entry.getLocalizedNameWithFormatting(), null));
this.buttonList.add(new EntryButton(i, this.guiLeft+156, this.guiTop+11+i*13, 115, 10, "- "+entry.getLocalizedNameWithFormatting(), null));
}
else{
return;

View file

@ -190,7 +190,7 @@ public class GuiPage extends GuiBooklet{
if(chapter != null){
int pageIndex = chapter.getPageIndex(page);
int pageAmount = chapter.getAllPages().length;
return pageIndex+1 < pageAmount-1;
return pageIndex+1 < pageAmount;
}
}
return false;

View file

@ -0,0 +1,57 @@
/*
* This file ("PageCoffeeMachine.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
* http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
* © 2015-2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.booklet.page;
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
import de.ellpeck.actuallyadditions.api.recipe.CoffeeIngredient;
import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiBooklet;
import de.ellpeck.actuallyadditions.mod.items.InitItems;
import de.ellpeck.actuallyadditions.mod.items.metalists.TheMiscItems;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.client.config.GuiUtils;
public class PageCoffeeMachine extends BookletPage{
private final CoffeeIngredient ingredient;
public PageCoffeeMachine(int localizationKey, CoffeeIngredient ingredient){
super(localizationKey);
this.ingredient = ingredient;
}
@Override
public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks){
super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks);
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);
PageTextOnly.renderTextToPage(gui, this, startX+6, startY+90);
}
@Override
public void initGui(GuiBookletBase gui, int startX, int startY){
super.initGui(gui, startX, startY);
gui.addOrModifyItemRenderer(this.ingredient.ingredient, startX+5+82, startY+10+1, 1F, true);
ItemStack coffee = new ItemStack(InitItems.itemCoffee);
ActuallyAdditionsAPI.methodHandler.addEffectToStack(coffee, this.ingredient);
gui.addOrModifyItemRenderer(coffee, startX+5+36, startY+10+42, 1F, false);
gui.addOrModifyItemRenderer(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.CUP.ordinal()), startX+5+37, startY+10+1, 1F, true);
gui.addOrModifyItemRenderer(new ItemStack(InitItems.itemCoffee), startX+5+1, startY+10+1, 1F, true);
}
}

View file

@ -10,12 +10,41 @@
package de.ellpeck.actuallyadditions.mod.booklet.page;
import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
import de.ellpeck.actuallyadditions.api.recipe.CrusherRecipe;
import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiBooklet;
import net.minecraftforge.fml.client.config.GuiUtils;
//TODO
public class PageCrusherRecipe extends BookletPage{
private final CrusherRecipe recipe;
public PageCrusherRecipe(int localizationKey, CrusherRecipe recipe){
super(localizationKey);
this.recipe = recipe;
}
@Override
public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks){
super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks);
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);
PageTextOnly.renderTextToPage(gui, this, startX+6, startY+100);
}
@Override
public void initGui(GuiBookletBase gui, int startX, int startY){
super.initGui(gui, startX, startY);
gui.addOrModifyItemRenderer(this.recipe.inputStack, startX+38+18, startY+6+2, 1F, true);
gui.addOrModifyItemRenderer(this.recipe.outputOneStack, startX+38+4, startY+6+53, 1F, false);
if(this.recipe.outputTwoStack != null){
gui.addOrModifyItemRenderer(this.recipe.outputTwoStack, startX+38+30, startY+6+53, 1F, false);
}
}
}

View file

@ -10,12 +10,42 @@
package de.ellpeck.actuallyadditions.mod.booklet.page;
import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
import de.ellpeck.actuallyadditions.api.recipe.EmpowererRecipe;
import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiBooklet;
import net.minecraftforge.fml.client.config.GuiUtils;
//TODO
public class PageEmpowerer extends BookletPage{
private final EmpowererRecipe recipe;
public PageEmpowerer(int localizationKey, EmpowererRecipe recipe){
super(localizationKey);
this.recipe = recipe;
}
@Override
public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks){
super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks);
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);
PageTextOnly.renderTextToPage(gui, this, startX+6, startY+100);
}
@Override
public void initGui(GuiBookletBase gui, int startX, int startY){
super.initGui(gui, startX, startY);
gui.addOrModifyItemRenderer(this.recipe.modifier1, startX+5+26, startY+10+1, 1F, true);
gui.addOrModifyItemRenderer(this.recipe.modifier2, startX+5+1, startY+10+26, 1F, true);
gui.addOrModifyItemRenderer(this.recipe.modifier3, startX+5+51, startY+10+26, 1F, true);
gui.addOrModifyItemRenderer(this.recipe.modifier4, startX+5+26, startY+10+51, 1F, true);
gui.addOrModifyItemRenderer(this.recipe.input, startX+5+26, startY+10+26, 1F, true);
gui.addOrModifyItemRenderer(this.recipe.output, startX+5+96, startY+10+26, 1F, false);
}
}

View file

@ -10,12 +10,51 @@
package de.ellpeck.actuallyadditions.mod.booklet.page;
import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiBooklet;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.FurnaceRecipes;
import net.minecraftforge.fml.client.config.GuiUtils;
import java.util.Map;
//TODO
public class PageFurnace extends BookletPage{
private final ItemStack input;
private final ItemStack output;
public PageFurnace(int localizationKey, ItemStack output){
super(localizationKey);
this.output = output;
this.input = getInputForOutput(output);
}
@Override
public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks){
super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks);
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);
PageTextOnly.renderTextToPage(gui, this, startX+6, startY+57);
}
@Override
public void initGui(GuiBookletBase gui, int startX, int startY){
super.initGui(gui, startX, startY);
gui.addOrModifyItemRenderer(this.input, startX+23+1, startY+10+5, 1F, true);
gui.addOrModifyItemRenderer(this.output, startX+23+59, startY+10+5, 1F, false);
}
private static ItemStack getInputForOutput(ItemStack output){
for(Map.Entry<ItemStack, ItemStack> entry : FurnaceRecipes.instance().getSmeltingList().entrySet()){
if(entry.getValue().isItemEqual(output)){
return entry.getKey();
}
}
return null;
}
}

View file

@ -10,10 +10,51 @@
package de.ellpeck.actuallyadditions.mod.booklet.page;
//TODO
import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.client.gui.GuiButton;
import java.awt.*;
import java.net.URI;
public class PageLinkButton extends BookletPage{
private static final int BUTTON_ID = -12782;
private final String link;
public PageLinkButton(int localizationKey, String link){
super(localizationKey);
this.link = link;
}
@Override
public void initGui(GuiBookletBase gui, int startX, int startY){
super.initGui(gui, startX, startY);
gui.getButtonList().add(new GuiButton(BUTTON_ID, startX+125/2-50, startY+130, 100, 20, StringUtil.localize("booklet."+ModUtil.MOD_ID+".chapter."+this.chapter.getIdentifier()+".button."+this.localizationKey)));
}
@Override
public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks){
super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks);
PageTextOnly.renderTextToPage(gui, this, startX+6, startY+5);
}
@Override
public void actionPerformed(GuiBookletBase gui, GuiButton button){
if(button.id == BUTTON_ID){
if(Desktop.isDesktopSupported()){
try{
Desktop.getDesktop().browse(new URI(this.link));
}
catch(Exception e){
ModUtil.LOGGER.info("Couldn't open website from Link Button page!", e);
}
}
}
else{
super.actionPerformed(gui, button);
}
}
}

View file

@ -10,10 +10,29 @@
package de.ellpeck.actuallyadditions.mod.booklet.page;
//TODO
import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.client.config.GuiUtils;
public class PagePicture extends BookletPage{
private final ResourceLocation resLoc;
private final int yTextOffset;
public PagePicture(int localizationKey, String pictureLocation, int yTextOffset){
super(localizationKey);
this.yTextOffset = yTextOffset;
this.resLoc = AssetUtil.getBookletGuiLocation(pictureLocation);
}
@Override
public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks){
super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks);
gui.mc.getTextureManager().bindTexture(this.resLoc);
GuiUtils.drawTexturedModalRect(startX-6, startY-7, 0, 0, 256, 256, 0);
PageTextOnly.renderTextToPage(gui, this, startX+6, startY-7+this.yTextOffset);
}
}

View file

@ -10,12 +10,42 @@
package de.ellpeck.actuallyadditions.mod.booklet.page;
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
import de.ellpeck.actuallyadditions.api.lens.LensConversion;
import de.ellpeck.actuallyadditions.api.recipe.LensConversionRecipe;
import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiBooklet;
import de.ellpeck.actuallyadditions.mod.items.InitItems;
import de.ellpeck.actuallyadditions.mod.items.metalists.TheMiscItems;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.client.config.GuiUtils;
//TODO
public class PageReconstructor extends BookletPage{
private final LensConversionRecipe recipe;
public PageReconstructor(int localizationKey, LensConversionRecipe recipe){
super(localizationKey);
this.recipe = recipe;
}
@Override
public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks){
super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks);
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);
PageTextOnly.renderTextToPage(gui, this, startX+6, startY+88);
}
@Override
public void initGui(GuiBookletBase gui, int startX, int startY){
super.initGui(gui, startX, startY);
gui.addOrModifyItemRenderer(this.recipe.inputStack, startX+30+1, startY+10+13, 1F, true);
gui.addOrModifyItemRenderer(this.recipe.outputStack, startX+30+47, startY+10+13, 1F, false);
}
}

View file

@ -70,7 +70,7 @@ public final class StringUtil{
public static void renderSplitScaledAsciiString(FontRenderer font, String text, int x, int y, int color, boolean shadow, float scale, int length){
List<String> lines = font.listFormattedStringToWidth(text, (int)(length/scale));
for(int i = 0; i < lines.size(); i++){
renderScaledAsciiString(font, lines.get(i), x, y+(i*font.FONT_HEIGHT), color, shadow, scale);
renderScaledAsciiString(font, lines.get(i), x, y+(i*(int)(font.FONT_HEIGHT*scale+3)), color, shadow, scale);
}
}
}

View file

@ -1017,7 +1017,7 @@ booklet.actuallyadditions.chapter.itemFilter.text.1=The <item>Item Filter<r> can
booklet.actuallyadditions.chapter.videoGuide.name=A Video Guide
booklet.actuallyadditions.chapter.videoGuide.text.1=If you want to have a <imp>visual introduction<r> to see what <item>Actually Additions<r> has to offer, you can watch this really awesome video by a friend of mine, <imp>Booty Toast<r> (yes, weird name, I know). <n>His video covers most of the main stuff the mod has to offer, however it is <imp>a bit outdated<r> and doesn't cover everything. It's still a <imp>great introduction to the mod<r> though.
booklet.actuallyadditions.chapter.videoGuide.page.1.button=Watch Video
booklet.actuallyadditions.chapter.videoGuide.button.1=Watch Video
booklet.actuallyadditions.chapter.shockSuppressor.name=Shock Absorber
booklet.actuallyadditions.chapter.shockSuppressor.text.1=The <item>Shock Absorber<r> is a block that, when supplied with <imp>RF<r>, it will protect an area of <imp>up to <range> blocks around it<r> from any type of <imp>Explosion<r>, be it ghasts, TNT or creepers. <n>Every block that is protected will result in a loss of <imp><rf> RF<r>.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB