Played around a bit more with the guide. Added a simple recipe getter for the recipe pages.
This commit is contained in:
parent
7c1cbb2503
commit
9e7517459e
4 changed files with 59 additions and 8 deletions
|
@ -17,7 +17,6 @@ import java.awt.Color;
|
|||
|
||||
public class GuideBloodMagic
|
||||
{
|
||||
|
||||
public static Book guideBook;
|
||||
|
||||
public static void initBook()
|
||||
|
|
|
@ -1,31 +1,47 @@
|
|||
package WayofTime.bloodmagic.compat.guideapi.book;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.compat.guideapi.entry.EntryText;
|
||||
import WayofTime.bloodmagic.registry.ModItems;
|
||||
import WayofTime.bloodmagic.util.helper.RecipeHelper;
|
||||
import WayofTime.bloodmagic.util.helper.TextHelper;
|
||||
import amerifrance.guideapi.api.IPage;
|
||||
import amerifrance.guideapi.api.impl.abstraction.EntryAbstract;
|
||||
import amerifrance.guideapi.api.util.PageHelper;
|
||||
import amerifrance.guideapi.page.PageIRecipe;
|
||||
|
||||
public class CategoryDemon
|
||||
{
|
||||
|
||||
public static Map<ResourceLocation, EntryAbstract> buildCategory()
|
||||
{
|
||||
Map<ResourceLocation, EntryAbstract> entries = new HashMap<ResourceLocation, EntryAbstract>();
|
||||
Map<ResourceLocation, EntryAbstract> entries = new LinkedHashMap<ResourceLocation, EntryAbstract>();
|
||||
String keyBase = "guide." + Constants.Mod.MODID + ".entry.demon.";
|
||||
|
||||
List<IPage> ritualPages = new ArrayList<IPage>();
|
||||
ritualPages.addAll(PageHelper.pagesForLongText(TextHelper.localize(keyBase + "intro" + ".info"), 270));
|
||||
// ritualPages.add(new PageImage(new ResourceLocation("bloodmagicguide", "textures/guide/" + ritual.getName() + ".png")));
|
||||
List<IPage> introPages = new ArrayList<IPage>();
|
||||
introPages.addAll(PageHelper.pagesForLongText(TextHelper.localize(keyBase + "intro" + ".info"), 270));
|
||||
// introPages.add(new PageImage(new ResourceLocation("bloodmagicguide", "textures/guide/" + ritual.getName() + ".png")));
|
||||
entries.put(new ResourceLocation(keyBase + "intro"), new EntryText(introPages, TextHelper.localize(keyBase + "intro"), false));
|
||||
// CraftingManager.getInstance().g
|
||||
|
||||
entries.put(new ResourceLocation(keyBase + "intro"), new EntryText(ritualPages, TextHelper.localize("Test"), true));
|
||||
List<IPage> snarePages = new ArrayList<IPage>();
|
||||
snarePages.addAll(PageHelper.pagesForLongText(TextHelper.localize(keyBase + "snare" + ".info.1"), 270));
|
||||
|
||||
IRecipe snareRecipe = RecipeHelper.getRecipeForOutput(new ItemStack(ModItems.soulSnare));
|
||||
if (snareRecipe != null)
|
||||
{
|
||||
snarePages.add(new PageIRecipe(snareRecipe));
|
||||
}
|
||||
|
||||
snarePages.addAll(PageHelper.pagesForLongText(TextHelper.localize(keyBase + "snare" + ".info.2"), 270));
|
||||
entries.put(new ResourceLocation(keyBase + "snare"), new EntryText(snarePages, TextHelper.localize(keyBase + "snare"), false));
|
||||
|
||||
return entries;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
package WayofTime.bloodmagic.util.helper;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.CraftingManager;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
|
||||
public class RecipeHelper
|
||||
{
|
||||
public static IRecipe getRecipeForOutput(ItemStack stack)
|
||||
{
|
||||
for (IRecipe recipe : CraftingManager.getInstance().getRecipeList())
|
||||
{
|
||||
if (recipe != null)
|
||||
{
|
||||
ItemStack resultStack = recipe.getRecipeOutput();
|
||||
if (resultStack != null && resultStack.getItem() != null)
|
||||
{
|
||||
if (resultStack.getItem() == stack.getItem() && resultStack.getItemDamage() == stack.getItemDamage())
|
||||
{
|
||||
return recipe;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue