Updated the Sanguine Scientiem with Alchemy Array recipes

This commit is contained in:
WayofTime 2016-07-19 21:26:50 -04:00
parent 81acd62bda
commit a037d71337
7 changed files with 271 additions and 5 deletions

View file

@ -1,3 +1,8 @@
------------------------------------------------------
Version 2.0.3-52
------------------------------------------------------
- Updated the Sanguine Scientiem with Alchemy Array recipes
------------------------------------------------------
Version 2.0.3-51
------------------------------------------------------

View file

@ -88,6 +88,68 @@ public class AlchemyArrayRecipeRegistry
return effectMap.get(key);
}
/**
*
* @param key
* @return an array of two ItemStacks - first index is the input stack,
* second is the catalyst stack. Returns {null, null} if no recipe
* is valid.
*/
public static ItemStack[] getRecipeForArrayEffect(String key)
{
for (Entry<List<ItemStack>, AlchemyArrayRecipe> entry : recipes.entrySet())
{
AlchemyArrayRecipe recipe = entry.getValue();
if (recipe != null && entry.getKey().size() > 0)
{
for (Entry<ItemStackWrapper, AlchemyArrayEffect> effectEntry : recipe.catalystMap.entrySet())
{
if (effectEntry.getValue() != null && effectEntry.getValue().key.equals(key))
{
return new ItemStack[] { entry.getKey().get(0), effectEntry.getKey().toStack() };
}
}
}
}
return new ItemStack[] { null, null };
}
/**
* @param Output
* of the recipe
* @return an array of two ItemStacks - first index is the input stack,
* second is the catalyst stack. Returns {null, null} if no recipe
* is valid.
*/
public static ItemStack[] getRecipeForOutputStack(ItemStack stack)
{
for (Entry<List<ItemStack>, AlchemyArrayRecipe> entry : recipes.entrySet())
{
AlchemyArrayRecipe recipe = entry.getValue();
if (recipe != null && entry.getKey().size() > 0)
{
for (Entry<ItemStackWrapper, AlchemyArrayEffect> effectEntry : recipe.catalystMap.entrySet())
{
if (effectEntry.getValue() instanceof AlchemyArrayEffectCrafting)
{
AlchemyArrayEffectCrafting craftingEffect = (AlchemyArrayEffectCrafting) effectEntry.getValue();
ItemStack resultStack = craftingEffect.getOutputStack();
if (resultStack != null && resultStack.getItem() != null)
{
if (resultStack.getItem() == stack.getItem() && resultStack.getItemDamage() == stack.getItemDamage())
{
return new ItemStack[] { entry.getKey().get(0), effectEntry.getKey().toStack() };
}
}
}
}
}
}
return new ItemStack[] { null, null };
}
public static void registerCraftingRecipe(ItemStack input, ItemStack catalystStack, ItemStack outputStack, ResourceLocation arrayResource)
{
registerRecipe(input, catalystStack, new AlchemyArrayEffectCrafting(outputStack), arrayResource);

View file

@ -10,12 +10,15 @@ import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.util.ResourceLocation;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.api.alchemyCrafting.AlchemyCircleRenderer;
import WayofTime.bloodmagic.api.recipe.ShapedBloodOrbRecipe;
import WayofTime.bloodmagic.api.recipe.ShapelessBloodOrbRecipe;
import WayofTime.bloodmagic.api.recipe.TartaricForgeRecipe;
import WayofTime.bloodmagic.api.registry.AlchemyArrayRecipeRegistry;
import WayofTime.bloodmagic.api.registry.AltarRecipeRegistry.AltarRecipe;
import WayofTime.bloodmagic.api.registry.OrbRegistry;
import WayofTime.bloodmagic.compat.guideapi.entry.EntryText;
import WayofTime.bloodmagic.compat.guideapi.page.PageAlchemyArray;
import WayofTime.bloodmagic.compat.guideapi.page.PageAltarRecipe;
import WayofTime.bloodmagic.compat.guideapi.page.PageTartaricForgeRecipe;
import WayofTime.bloodmagic.compat.guideapi.page.recipeRenderer.ShapedBloodOrbRecipeRenderer;
@ -63,13 +66,23 @@ public class CategoryArchitect
entries.put(new ResourceLocation(keyBase + "bloodaltar"), new EntryText(altarPages, TextHelper.localize(keyBase + "bloodaltar"), true));
List<IPage> ashPages = new ArrayList<IPage>();
//TODO: Arcane Ash Recipe
TartaricForgeRecipe ashRecipe = RecipeHelper.getForgeRecipeForOutput(new ItemStack(ModItems.arcaneAshes));
if (ashRecipe != null)
{
ashPages.add(new PageTartaricForgeRecipe(ashRecipe));
}
ashPages.addAll(PageHelper.pagesForLongText(TextHelper.localize(keyBase + "ash" + ".info"), 370));
entries.put(new ResourceLocation(keyBase + "ash"), new EntryText(ashPages, TextHelper.localize(keyBase + "ash"), true));
List<IPage> divinationPages = new ArrayList<IPage>();
//TODO: Divination Sigil Recipe
PageAlchemyArray divinationRecipePage = getAlchemyPage(new ItemStack(ModItems.sigilDivination));
if (divinationRecipePage != null)
{
divinationPages.add(divinationRecipePage);
}
divinationPages.addAll(PageHelper.pagesForLongText(TextHelper.localize(keyBase + "divination" + ".info"), 370));
entries.put(new ResourceLocation(keyBase + "divination"), new EntryText(divinationPages, TextHelper.localize(keyBase + "divination"), true));
@ -150,6 +163,12 @@ public class CategoryArchitect
waterPages.add(new PageTartaricForgeRecipe(waterRecipe));
}
PageAlchemyArray waterRecipePage = getAlchemyPage(new ItemStack(ModItems.sigilWater));
if (waterRecipePage != null)
{
waterPages.add(waterRecipePage);
}
waterPages.addAll(PageHelper.pagesForLongText(TextHelper.localize(keyBase + "water" + ".info.1"), 370));
entries.put(new ResourceLocation(keyBase + "water"), new EntryText(waterPages, TextHelper.localize(keyBase + "water"), true));
@ -161,6 +180,12 @@ public class CategoryArchitect
lavaPages.add(new PageTartaricForgeRecipe(lavaRecipe));
}
PageAlchemyArray lavaRecipePage = getAlchemyPage(new ItemStack(ModItems.sigilLava));
if (lavaRecipePage != null)
{
lavaPages.add(lavaRecipePage);
}
lavaPages.addAll(PageHelper.pagesForLongText(TextHelper.localize(keyBase + "lava" + ".info.1"), 370));
entries.put(new ResourceLocation(keyBase + "lava"), new EntryText(lavaPages, TextHelper.localize(keyBase + "lava"), true));
@ -227,6 +252,12 @@ public class CategoryArchitect
holdingPages.add(new PageTartaricForgeRecipe(holdingRecipe));
}
PageAlchemyArray holdingRecipePage = getAlchemyPage(new ItemStack(ModItems.sigilHolding));
if (holdingRecipePage != null)
{
holdingPages.add(holdingRecipePage);
}
holdingPages.addAll(PageHelper.pagesForLongText(TextHelper.localize(keyBase + "holding" + ".info.1"), 370));
entries.put(new ResourceLocation(keyBase + "holding"), new EntryText(holdingPages, TextHelper.localize(keyBase + "holding"), true));
@ -238,6 +269,12 @@ public class CategoryArchitect
airPages.add(new PageTartaricForgeRecipe(airRecipe));
}
PageAlchemyArray airRecipePage = getAlchemyPage(new ItemStack(ModItems.sigilAir));
if (airRecipePage != null)
{
airPages.add(airRecipePage);
}
airPages.addAll(PageHelper.pagesForLongText(TextHelper.localize(keyBase + "air" + ".info.1"), 370));
entries.put(new ResourceLocation(keyBase + "air"), new EntryText(airPages, TextHelper.localize(keyBase + "air"), true));
@ -249,6 +286,12 @@ public class CategoryArchitect
voidPages.add(new PageTartaricForgeRecipe(voidRecipe));
}
PageAlchemyArray voidRecipePage = getAlchemyPage(new ItemStack(ModItems.sigilVoid));
if (voidRecipePage != null)
{
voidPages.add(voidRecipePage);
}
voidPages.addAll(PageHelper.pagesForLongText(TextHelper.localize(keyBase + "void" + ".info.1"), 370));
entries.put(new ResourceLocation(keyBase + "void"), new EntryText(voidPages, TextHelper.localize(keyBase + "void"), true));
@ -260,6 +303,12 @@ public class CategoryArchitect
greenGrovePages.add(new PageTartaricForgeRecipe(greenGroveRecipe));
}
PageAlchemyArray greenGroveRecipePage = getAlchemyPage(new ItemStack(ModItems.sigilGreenGrove));
if (greenGroveRecipePage != null)
{
greenGrovePages.add(greenGroveRecipePage);
}
greenGrovePages.addAll(PageHelper.pagesForLongText(TextHelper.localize(keyBase + "greenGrove" + ".info.1"), 370));
entries.put(new ResourceLocation(keyBase + "greenGrove"), new EntryText(greenGrovePages, TextHelper.localize(keyBase + "greenGrove"), true));
@ -271,6 +320,12 @@ public class CategoryArchitect
fastMinerPages.add(new PageTartaricForgeRecipe(fastMinerRecipe));
}
PageAlchemyArray fastMinerRecipePage = getAlchemyPage(new ItemStack(ModItems.sigilFastMiner));
if (fastMinerRecipePage != null)
{
fastMinerPages.add(fastMinerRecipePage);
}
fastMinerPages.addAll(PageHelper.pagesForLongText(TextHelper.localize(keyBase + "fastMiner" + ".info.1"), 370));
entries.put(new ResourceLocation(keyBase + "fastMiner"), new EntryText(fastMinerPages, TextHelper.localize(keyBase + "fastMiner"), true));
@ -282,6 +337,12 @@ public class CategoryArchitect
seerPages.add(new PageTartaricForgeRecipe(seerRecipe));
}
PageAlchemyArray seerRecipePage = getAlchemyPage(new ItemStack(ModItems.sigilSeer));
if (seerRecipePage != null)
{
seerPages.add(seerRecipePage);
}
seerPages.addAll(PageHelper.pagesForLongText(TextHelper.localize(keyBase + "seer" + ".info.1"), 370));
entries.put(new ResourceLocation(keyBase + "seer"), new EntryText(seerPages, TextHelper.localize(keyBase + "seer"), true));
@ -326,6 +387,12 @@ public class CategoryArchitect
affinityPages.add(new PageTartaricForgeRecipe(affinityRecipe));
}
PageAlchemyArray affinityRecipePage = getAlchemyPage(new ItemStack(ModItems.sigilElementalAffinity));
if (affinityRecipePage != null)
{
affinityPages.add(affinityRecipePage);
}
affinityPages.addAll(PageHelper.pagesForLongText(TextHelper.localize(keyBase + "affinity" + ".info.1"), 370));
entries.put(new ResourceLocation(keyBase + "affinity"), new EntryText(affinityPages, TextHelper.localize(keyBase + "affinity"), true));
@ -337,6 +404,12 @@ public class CategoryArchitect
lampPages.add(new PageTartaricForgeRecipe(lampRecipe));
}
PageAlchemyArray lampRecipePage = getAlchemyPage(new ItemStack(ModItems.sigilBloodLight));
if (lampRecipePage != null)
{
lampPages.add(lampRecipePage);
}
lampPages.addAll(PageHelper.pagesForLongText(TextHelper.localize(keyBase + "lamp" + ".info.1"), 370));
entries.put(new ResourceLocation(keyBase + "lamp"), new EntryText(lampPages, TextHelper.localize(keyBase + "lamp"), true));
@ -348,6 +421,12 @@ public class CategoryArchitect
magnetismPages.add(new PageTartaricForgeRecipe(magnetismRecipe));
}
PageAlchemyArray magnetismRecipePage = getAlchemyPage(new ItemStack(ModItems.sigilMagnetism));
if (magnetismRecipePage != null)
{
magnetismPages.add(magnetismRecipePage);
}
magnetismPages.addAll(PageHelper.pagesForLongText(TextHelper.localize(keyBase + "magnetism" + ".info.1"), 370));
entries.put(new ResourceLocation(keyBase + "magnetism"), new EntryText(magnetismPages, TextHelper.localize(keyBase + "magnetism"), true));
@ -365,6 +444,42 @@ public class CategoryArchitect
return entries;
}
public static PageAlchemyArray getAlchemyPage(String key)
{
ItemStack[] recipe = AlchemyArrayRecipeRegistry.getRecipeForArrayEffect(key);
if (recipe[0] != null)
{
ItemStack inputStack = recipe[0];
ItemStack catalystStack = recipe[1];
AlchemyCircleRenderer renderer = AlchemyArrayRecipeRegistry.getAlchemyCircleRenderer(inputStack, catalystStack);
if (renderer != null)
{
return new PageAlchemyArray(renderer.arrayResource, inputStack, catalystStack);
}
}
return null;
}
public static PageAlchemyArray getAlchemyPage(ItemStack outputStack)
{
ItemStack[] recipe = AlchemyArrayRecipeRegistry.getRecipeForOutputStack(outputStack);
if (recipe[0] != null)
{
ItemStack inputStack = recipe[0];
ItemStack catalystStack = recipe[1];
AlchemyCircleRenderer renderer = AlchemyArrayRecipeRegistry.getAlchemyCircleRenderer(inputStack, catalystStack);
if (renderer != null)
{
return new PageAlchemyArray(renderer.arrayResource, inputStack, catalystStack, outputStack);
}
}
return null;
}
public static PageIRecipe getPageForRecipe(IRecipe recipe)
{
if (recipe instanceof ShapedBloodOrbRecipe)

View file

@ -0,0 +1,83 @@
package WayofTime.bloodmagic.compat.guideapi.page;
import lombok.AllArgsConstructor;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import WayofTime.bloodmagic.util.helper.TextHelper;
import amerifrance.guideapi.api.impl.Book;
import amerifrance.guideapi.api.impl.Page;
import amerifrance.guideapi.api.impl.abstraction.CategoryAbstract;
import amerifrance.guideapi.api.impl.abstraction.EntryAbstract;
import amerifrance.guideapi.api.util.GuiHelper;
import amerifrance.guideapi.gui.GuiBase;
@AllArgsConstructor
public class PageAlchemyArray extends Page
{
public static final double scale = 58d / 256d;
public ResourceLocation arrayResource;
public final ItemStack inputStack;
public final ItemStack catalystStack;
public final ItemStack outputStack;
public PageAlchemyArray(ResourceLocation resource, ItemStack inputStack, ItemStack outputStack)
{
this(resource, inputStack, outputStack, null);
}
@Override
@SideOnly(Side.CLIENT)
public void draw(Book book, CategoryAbstract category, EntryAbstract entry, int guiLeft, int guiTop, int mouseX, int mouseY, GuiBase guiBase, FontRenderer fontRenderer)
{
int x = guiLeft + 65;
int y = guiTop + 30;
Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation("bloodmagicguide" + ":textures/gui/alchemyArrayCrafting.png"));
guiBase.drawTexturedModalRect(x, y, 0, 0, 62, 88 + (outputStack == null ? 0 : 26));
guiBase.drawCenteredString(fontRenderer, TextHelper.localize("guide.BloodMagic.page.alchemyArray"), guiLeft + guiBase.xSize / 2, guiTop + 12, 0);
Minecraft.getMinecraft().getTextureManager().bindTexture(arrayResource);
GlStateManager.pushMatrix();
GlStateManager.translate(x + 2, y + 28, 0);
GlStateManager.scale(scale, scale, scale);
guiBase.drawTexturedModalRect(0, 0, 0, 0, 256, 256);
GlStateManager.popMatrix();
int inputX = x + 3;
int inputY = y + 3;
GuiHelper.drawItemStack(inputStack, inputX, inputY);
int catalystX = x + 43;
int catalystY = y + 3;
GuiHelper.drawItemStack(catalystStack, catalystX, catalystY);
if (GuiHelper.isMouseBetween(mouseX, mouseY, inputX, inputY, 15, 15))
{
guiBase.renderToolTip(inputStack, mouseX, mouseY);
}
if (GuiHelper.isMouseBetween(mouseX, mouseY, catalystX, catalystY, 15, 15))
{
guiBase.renderToolTip(catalystStack, mouseX, mouseY);
}
if (outputStack != null)
{
int outputX = x + 43;
int outputY = y + 95;
GuiHelper.drawItemStack(outputStack, outputX, outputY);
if (GuiHelper.isMouseBetween(mouseX, mouseY, outputX, outputY, 15, 15))
{
guiBase.renderToolTip(outputStack, mouseX, mouseY);
}
}
}
}

View file

@ -1,11 +1,11 @@
package WayofTime.bloodmagic.util.helper;
import WayofTime.bloodmagic.api.recipe.TartaricForgeRecipe;
import WayofTime.bloodmagic.api.registry.AltarRecipeRegistry;
import WayofTime.bloodmagic.api.registry.TartaricForgeRecipeRegistry;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.item.crafting.IRecipe;
import WayofTime.bloodmagic.api.recipe.TartaricForgeRecipe;
import WayofTime.bloodmagic.api.registry.AltarRecipeRegistry;
import WayofTime.bloodmagic.api.registry.TartaricForgeRecipeRegistry;
public class RecipeHelper
{

View file

@ -13,6 +13,7 @@ guide.BloodMagic.page.minimumWill=Minimum Will: %f
guide.BloodMagic.page.drainedWill=Drained Will: %f
guide.BloodMagic.shapelessOrb=Shapeless Orb Recipe
guide.BloodMagic.shapedOrb=Shaped Orb Recipe
guide.BloodMagic.page.alchemyArray=Alchemy Array
# Categories

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB