mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-22 15:18:34 +01:00
Added video introduction page
This commit is contained in:
parent
e0e9450e36
commit
ac6cf7c3bc
14 changed files with 146 additions and 13 deletions
|
@ -30,7 +30,7 @@ public class ActuallyAdditionsAPI{
|
|||
|
||||
public static final String MOD_ID = "actuallyadditions";
|
||||
public static final String API_ID = MOD_ID+"api";
|
||||
public static final String API_VERSION = "15";
|
||||
public static final String API_VERSION = "16";
|
||||
public static final List<CrusherRecipe> CRUSHER_RECIPES = new ArrayList<CrusherRecipe>();
|
||||
public static final List<BallOfFurReturn> BALL_OF_FUR_RETURN_ITEMS = new ArrayList<BallOfFurReturn>();
|
||||
public static final List<TreasureChestLoot> TREASURE_CHEST_LOOT = new ArrayList<TreasureChestLoot>();
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
package de.ellpeck.actuallyadditions.api.booklet;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.internal.IBookletGui;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
@ -20,6 +21,18 @@ public abstract class BookletPage{
|
|||
public boolean arePageStacksWildcard;
|
||||
protected IBookletChapter chapter;
|
||||
|
||||
public void onOpened(IBookletGui gui){
|
||||
|
||||
}
|
||||
|
||||
public void onClosed(IBookletGui gui){
|
||||
|
||||
}
|
||||
|
||||
public boolean onActionPerformed(IBookletGui gui, GuiButton button){
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* The ID of the page, for the page number etc.
|
||||
* Don't make two pages in the same chapter with the same ID.
|
||||
|
|
|
@ -11,10 +11,13 @@
|
|||
package de.ellpeck.actuallyadditions.api.internal;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.booklet.BookletPage;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* This is a helper interface for BookletPage
|
||||
* This is not supposed to be implemented.
|
||||
|
@ -27,7 +30,7 @@ public interface IBookletGui{
|
|||
* This method should be used when drawing an ItemStack to a booklet page
|
||||
* It displays the hoverover text of the item and also contains the "show more info"-text and clickable part
|
||||
*
|
||||
* @param renderTransferButton if the "show more info"-text and clickable part should exist-
|
||||
* @param renderTransferButton if the "show more info"-text and clickable part should exist
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
void renderTooltipAndTransferButton(BookletPage from, ItemStack stack, int x, int y, boolean renderTransferButton, boolean mousePressed);
|
||||
|
@ -43,4 +46,6 @@ public interface IBookletGui{
|
|||
void drawRect(int startX, int startY, int u, int v, int xSize, int ySize);
|
||||
|
||||
IEntrySet getCurrentEntrySet();
|
||||
|
||||
List<GuiButton> getButtonList();
|
||||
}
|
||||
|
|
|
@ -249,6 +249,9 @@ public class BookletUtils{
|
|||
}
|
||||
}
|
||||
|
||||
if(booklet.currentEntrySet.getCurrentPage() != null){
|
||||
booklet.currentEntrySet.getCurrentPage().onClosed(booklet);
|
||||
}
|
||||
booklet.currentEntrySet.setPage(null);
|
||||
booklet.currentEntrySet.setChapter(null);
|
||||
|
||||
|
@ -325,7 +328,13 @@ public class BookletUtils{
|
|||
booklet.searchField.setText("");
|
||||
|
||||
booklet.currentEntrySet.setChapter(chapter);
|
||||
booklet.currentEntrySet.setPage(page != null && doesChapterHavePage(chapter, page) ? page : chapter.getPages()[0]);
|
||||
|
||||
if(booklet.currentEntrySet.getCurrentPage() != null){
|
||||
booklet.currentEntrySet.getCurrentPage().onClosed(booklet);
|
||||
}
|
||||
BookletPage pageToSet = page != null && doesChapterHavePage(chapter, page) ? page : chapter.getPages()[0];
|
||||
booklet.currentEntrySet.setPage(pageToSet);
|
||||
pageToSet.onOpened(booklet);
|
||||
|
||||
booklet.buttonForward.visible = getNextPage(chapter, booklet.currentEntrySet.getCurrentPage()) != null;
|
||||
booklet.buttonBackward.visible = getPrevPage(chapter, booklet.currentEntrySet.getCurrentPage()) != null;
|
||||
|
@ -386,7 +395,9 @@ public class BookletUtils{
|
|||
if(booklet.currentEntrySet.getCurrentPage() != null){
|
||||
BookletPage page = getNextPage(booklet.currentEntrySet.getCurrentChapter(), booklet.currentEntrySet.getCurrentPage());
|
||||
if(page != null){
|
||||
booklet.currentEntrySet.getCurrentPage().onClosed(booklet);
|
||||
booklet.currentEntrySet.setPage(page);
|
||||
page.onOpened(booklet);
|
||||
}
|
||||
|
||||
booklet.buttonForward.visible = getNextPage(booklet.currentEntrySet.getCurrentChapter(), booklet.currentEntrySet.getCurrentPage()) != null;
|
||||
|
@ -408,7 +419,9 @@ public class BookletUtils{
|
|||
if(booklet.currentEntrySet.getCurrentPage() != null){
|
||||
BookletPage page = getPrevPage(booklet.currentEntrySet.getCurrentChapter(), booklet.currentEntrySet.getCurrentPage());
|
||||
if(page != null){
|
||||
booklet.currentEntrySet.getCurrentPage().onClosed(booklet);
|
||||
booklet.currentEntrySet.setPage(page);
|
||||
page.onOpened(booklet);
|
||||
}
|
||||
|
||||
booklet.buttonForward.visible = getNextPage(booklet.currentEntrySet.getCurrentChapter(), booklet.currentEntrySet.getCurrentPage()) != null;
|
||||
|
|
|
@ -101,6 +101,7 @@ public class GuiBooklet extends GuiScreen implements IBookletGui{
|
|||
return this.fontRendererObj;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List getButtonList(){
|
||||
return this.buttonList;
|
||||
}
|
||||
|
@ -143,8 +144,15 @@ public class GuiBooklet extends GuiScreen implements IBookletGui{
|
|||
//Pre-Renders the current page's content etc.
|
||||
BookletUtils.renderPre(this, x, y, this.ticksElapsed, this.mousePressed);
|
||||
|
||||
//Does vanilla drawing stuff
|
||||
super.drawScreen(x, y, f);
|
||||
//Buttons and search field
|
||||
if(this.currentEntrySet.getCurrentPage() != null){
|
||||
this.fontRendererObj.setUnicodeFlag(false);
|
||||
}
|
||||
for(GuiButton button : this.buttonList){
|
||||
button.drawButton(this.mc, x, y);
|
||||
}
|
||||
this.fontRendererObj.setUnicodeFlag(true);
|
||||
|
||||
this.searchField.drawTextBox();
|
||||
|
||||
//Renders the current page's content
|
||||
|
@ -156,14 +164,11 @@ public class GuiBooklet extends GuiScreen implements IBookletGui{
|
|||
this.fontRendererObj.setUnicodeFlag(false);
|
||||
BookletUtils.doHoverTexts(this, x, y);
|
||||
BookletUtils.drawAchievementInfo(this, false, x, y);
|
||||
this.fontRendererObj.setUnicodeFlag(true);
|
||||
|
||||
this.fontRendererObj.setUnicodeFlag(unicodeBefore);
|
||||
|
||||
//Resets mouse
|
||||
if(this.mousePressed){
|
||||
this.mousePressed = false;
|
||||
}
|
||||
this.mousePressed = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -224,6 +229,12 @@ public class GuiBooklet extends GuiScreen implements IBookletGui{
|
|||
|
||||
@Override
|
||||
public void actionPerformed(GuiButton button){
|
||||
if(this.currentEntrySet.getCurrentPage() != null){
|
||||
if(this.currentEntrySet.getCurrentPage().onActionPerformed(this, button)){
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//Handles update
|
||||
if(button == this.buttonUpdate){
|
||||
if(UpdateChecker.needsUpdateNotify){
|
||||
|
|
|
@ -61,6 +61,7 @@ public class InitBooklet{
|
|||
private static void initChapters(){
|
||||
//Getting Started
|
||||
chapterIntro = new BookletChapter("intro", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(InitItems.itemBooklet), new PageTextOnly(1), new PageTextOnly(2), new PageTextOnly(3));
|
||||
new BookletChapter("videoGuide", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.YOUTUBE_ICON.ordinal()), new PageLinkButton(1, "https://www.youtube.com/watch?v=fhjz0Ew56pM")).setImportant();
|
||||
new BookletChapter("bookTutorial", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(InitItems.itemBooklet), new PageTextOnly(1), new PageTextOnly(2), new PageCrafting(3, ItemCrafting.recipeBook));
|
||||
new BookletChapter("crystals", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(InitBlocks.blockAtomicReconstructor), new PageTextOnly(1).addTextReplacement("<rf>", TileEntityAtomicReconstructor.ENERGY_USE), new PageTextOnly(2), new PageTextOnly(3), new PagePicture(4, "pageAtomicReconstructor", 0).setNoText(), new PageTextOnly(5), new PageCrafting(6, BlockCrafting.recipeAtomicReconstructor).setPageStacksWildcard(), new PageCrafting(7, MiscCrafting.recipesCrystals).setNoText(), new PageCrafting(8, MiscCrafting.recipesCrystalBlocks).setNoText(), new PageReconstructor(9, LensRecipeHandler.mainPageRecipes).setNoText()).setSpecial();
|
||||
new BookletChapter("coalGen", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(InitBlocks.blockCoalGenerator), new PageCrafting(1, BlockCrafting.recipeCoalGen).addTextReplacement("<rf>", TileEntityCoalGenerator.PRODUCE).setPageStacksWildcard());
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* This file ("PageButton.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.internal.IBookletGui;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
|
||||
public abstract class PageButton extends PageTextOnly{
|
||||
|
||||
private GuiButton button;
|
||||
|
||||
public PageButton(int id){
|
||||
super(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onOpened(IBookletGui gui){
|
||||
String text = StringUtil.localize("booklet."+ModUtil.MOD_ID+".chapter."+this.chapter.getUnlocalizedName()+".page."+this.localizationKey+".button");
|
||||
int width = Minecraft.getMinecraft().fontRendererObj.getStringWidth(text);
|
||||
this.button = new GuiButton(-1239, gui.getGuiLeft()+gui.getXSize()/2-width/2-8, gui.getGuiTop()+gui.getYSize()-40, width+15, 20, text);
|
||||
gui.getButtonList().add(this.button);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClosed(IBookletGui gui){
|
||||
gui.getButtonList().remove(this.button);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActionPerformed(IBookletGui gui, GuiButton button){
|
||||
return button == this.button && this.onAction();
|
||||
}
|
||||
|
||||
public abstract boolean onAction();
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* This file ("PageYoutubeButton.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.mod.booklet.BookletUtils;
|
||||
|
||||
public class PageLinkButton extends PageButton{
|
||||
|
||||
private String link;
|
||||
|
||||
public PageLinkButton(int id, String link){
|
||||
super(id);
|
||||
this.link = link;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onAction(){
|
||||
BookletUtils.openBrowser(this.link);
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -38,7 +38,6 @@ public class ItemMisc extends ItemBase{
|
|||
return damage;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack stack){
|
||||
return stack.getItemDamage() >= allMiscItems.length ? StringUtil.BUGGED_ITEM_NAME : this.getUnlocalizedName()+allMiscItems[stack.getItemDamage()].name;
|
||||
|
@ -54,7 +53,9 @@ public class ItemMisc extends ItemBase{
|
|||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item item, CreativeTabs tab, List list){
|
||||
for(int j = 0; j < allMiscItems.length; j++){
|
||||
list.add(new ItemStack(this, 1, j));
|
||||
if(j != TheMiscItems.YOUTUBE_ICON.ordinal()){
|
||||
list.add(new ItemStack(this, 1, j));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.items.metalists;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.util.Util;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
|
||||
public enum TheMiscItems{
|
||||
|
@ -34,7 +35,8 @@ public enum TheMiscItems{
|
|||
BLACK_DYE("BlackDye", EnumRarity.EPIC),
|
||||
LENS("Lens", EnumRarity.UNCOMMON),
|
||||
ENDER_STAR("EnderStar", EnumRarity.EPIC),
|
||||
SPAWNER_SHARD("SpawnerShard", EnumRarity.EPIC);
|
||||
SPAWNER_SHARD("SpawnerShard", EnumRarity.EPIC),
|
||||
YOUTUBE_ICON("YoutubeIcon", Util.FALLBACK_RARITY);
|
||||
|
||||
public final String name;
|
||||
public final EnumRarity rarity;
|
||||
|
|
|
@ -17,6 +17,7 @@ import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiCoffeeMachine;
|
|||
import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiFurnaceDouble;
|
||||
import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiGrinder;
|
||||
import de.ellpeck.actuallyadditions.mod.items.InitItems;
|
||||
import de.ellpeck.actuallyadditions.mod.items.metalists.TheMiscItems;
|
||||
import de.ellpeck.actuallyadditions.mod.jei.booklet.BookletRecipeCategory;
|
||||
import de.ellpeck.actuallyadditions.mod.jei.booklet.BookletRecipeHandler;
|
||||
import de.ellpeck.actuallyadditions.mod.jei.coffee.CoffeeMachineRecipeCategory;
|
||||
|
@ -84,6 +85,7 @@ public class JEIActuallyAdditionsPlugin implements IModPlugin{
|
|||
blacklist.addItemToBlacklist(new ItemStack(InitBlocks.blockCoffee));
|
||||
blacklist.addItemToBlacklist(new ItemStack(InitBlocks.blockWildPlant, 1, Util.WILDCARD));
|
||||
blacklist.addItemToBlacklist(new ItemStack(InitBlocks.blockColoredLampOn, 1, Util.WILDCARD));
|
||||
blacklist.addItemToBlacklist(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.YOUTUBE_ICON.ordinal()));
|
||||
|
||||
IRecipeTransferRegistry transfer = registry.getRecipeTransferRegistry();
|
||||
transfer.addRecipeTransferHandler(ContainerCrafter.class, VanillaRecipeCategoryUid.CRAFTING, 1, 9, 10, 36);
|
||||
|
|
|
@ -900,3 +900,7 @@ booklet.actuallyadditions.chapter.displayStand.text.2=The <item>Leaf Blower<r> a
|
|||
|
||||
booklet.actuallyadditions.chapter.itemFilter.name=Item Filter
|
||||
booklet.actuallyadditions.chapter.itemFilter.text.1=The <item>Item Filter<r> can be used in <item>Advanced Item Laser Relays<r>, <item>ESDs<r> and <item>Ranged Collectors<r> to <imp>enlargen the size of their whitelist<r>. This can be done by right-clicking with the filter in hand and placing items to be filtered inside of it. The filter can then be placed into any whitelist slot in the desired machine. <n>For more information on this, <imp>hover over the whitelist buttons in the GUIs of whitelistable machines<r>!
|
||||
|
||||
booklet.actuallyadditions.chapter.videoGuide.name=A Video Guide
|
||||
booklet.actuallyadditions.chapter.videoGuide.text.1=If you are a bit confused as to what is going on or just want to get a glimpse of what <imp>Actually Additions<r> has to offer, there is this <imp>brilliant video<r> by a guy called <item>Booty Toast<r> (yes, that is a weird name), that shows off what is possible in a really enjoyable way. <n>Just <imp>click the button<r> to have the video <imp>opened on YouTube<r>! <n><n><imp>Give it a watch!<r>
|
||||
booklet.actuallyadditions.chapter.videoGuide.page.1.button=Watch Video
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "actuallyadditions:item/standardItem",
|
||||
"textures": {
|
||||
"layer0": "actuallyadditions:items/itemMiscYoutubeIcon"
|
||||
}
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 355 B |
Loading…
Reference in a new issue