From 931eba4cc42cd70e1a19accdf5d5d51317fd3500 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Sat, 12 Nov 2016 15:13:20 +0100 Subject: [PATCH] API restored! ~ --- .../api/internal/IMethodHandler.java | 15 +++++++++ .../mod/booklet/page/PagePicture.java | 10 ++++-- .../mod/misc/MethodHandler.java | 33 +++++++++++++++++++ 3 files changed, 55 insertions(+), 3 deletions(-) diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/internal/IMethodHandler.java b/src/main/java/de/ellpeck/actuallyadditions/api/internal/IMethodHandler.java index bc799af65..ad9b305b0 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/api/internal/IMethodHandler.java +++ b/src/main/java/de/ellpeck/actuallyadditions/api/internal/IMethodHandler.java @@ -10,10 +10,15 @@ package de.ellpeck.actuallyadditions.api.internal; +import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter; +import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry; +import de.ellpeck.actuallyadditions.api.booklet.IBookletPage; import de.ellpeck.actuallyadditions.api.recipe.CoffeeIngredient; import net.minecraft.block.state.IBlockState; import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.IRecipe; import net.minecraft.potion.PotionEffect; +import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; import java.util.List; @@ -38,4 +43,14 @@ public interface IMethodHandler{ boolean invokeConversionLens(IBlockState hitState, BlockPos hitBlock, IAtomicReconstructor tile); boolean addCrusherRecipes(List inputs, List outputOnes, int outputOneAmounts, List outputTwos, int outputTwoAmounts, int outputTwoChance); + + IBookletPage generateTextPage(int id); + + IBookletPage generatePicturePage(int id, ResourceLocation resLoc, int textStartY); + + IBookletPage generateCraftingPage(int id, IRecipe... recipes); + + IBookletPage generateFurnacePage(int id, ItemStack input, ItemStack result); + + IBookletChapter generateBookletChapter(String identifier, IBookletEntry entry, ItemStack displayStack, IBookletPage... pages); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PagePicture.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PagePicture.java index f32edbbf2..87e41403f 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PagePicture.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PagePicture.java @@ -20,10 +20,14 @@ public class PagePicture extends BookletPage{ private final ResourceLocation resLoc; private final int yTextOffset; - public PagePicture(int localizationKey, String pictureLocation, int yTextOffset){ + public PagePicture(int localizationKey, ResourceLocation resLoc, int yTextOffset){ super(localizationKey); - this.yTextOffset = yTextOffset; - this.resLoc = AssetUtil.getBookletGuiLocation(pictureLocation); + this.yTextOffset = yTextOffset; + this.resLoc = resLoc; + } + + public PagePicture(int localizationKey, String pictureLocation, int yTextOffset){ + this(localizationKey, AssetUtil.getBookletGuiLocation(pictureLocation), yTextOffset); } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/MethodHandler.java b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/MethodHandler.java index 65464758b..17e8bedc7 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/MethodHandler.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/MethodHandler.java @@ -11,10 +11,18 @@ package de.ellpeck.actuallyadditions.mod.misc; import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; +import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter; +import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry; +import de.ellpeck.actuallyadditions.api.booklet.IBookletPage; import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor; import de.ellpeck.actuallyadditions.api.internal.IMethodHandler; import de.ellpeck.actuallyadditions.api.recipe.CoffeeIngredient; import de.ellpeck.actuallyadditions.api.recipe.LensConversionRecipe; +import de.ellpeck.actuallyadditions.mod.booklet.chapter.BookletChapter; +import de.ellpeck.actuallyadditions.mod.booklet.page.PageCrafting; +import de.ellpeck.actuallyadditions.mod.booklet.page.PageFurnace; +import de.ellpeck.actuallyadditions.mod.booklet.page.PagePicture; +import de.ellpeck.actuallyadditions.mod.booklet.page.PageTextOnly; import de.ellpeck.actuallyadditions.mod.items.lens.LensRecipeHandler; import de.ellpeck.actuallyadditions.mod.recipe.CrusherRecipeRegistry; import net.minecraft.block.Block; @@ -235,4 +243,29 @@ public class MethodHandler implements IMethodHandler{ } return hasWorkedOnce; } + + @Override + public IBookletPage generateTextPage(int id){ + return new PageTextOnly(id); + } + + @Override + public IBookletPage generatePicturePage(int id, ResourceLocation resLoc, int textStartY){ + return new PagePicture(id, resLoc, textStartY); + } + + @Override + public IBookletPage generateCraftingPage(int id, IRecipe... recipes){ + return new PageCrafting(id, recipes); + } + + @Override + public IBookletPage generateFurnacePage(int id, ItemStack input, ItemStack result){ + return new PageFurnace(id, result); + } + + @Override + public IBookletChapter generateBookletChapter(String identifier, IBookletEntry entry, ItemStack displayStack, IBookletPage... pages){ + return new BookletChapter(identifier, entry, displayStack, pages); + } }