Added/modified the Recipe Page renderers so they were actually functional.
This commit is contained in:
parent
78a0de0b1f
commit
ad6567c5d6
|
@ -9,10 +9,14 @@ 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.recipe.ShapedBloodOrbRecipe;
|
||||
import WayofTime.bloodmagic.api.recipe.ShapelessBloodOrbRecipe;
|
||||
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.PageAltarRecipe;
|
||||
import WayofTime.bloodmagic.compat.guideapi.page.recipeRenderer.ShapedBloodOrbRecipeRenderer;
|
||||
import WayofTime.bloodmagic.compat.guideapi.page.recipeRenderer.ShapelessBloodOrbRecipeRenderer;
|
||||
import WayofTime.bloodmagic.registry.ModBlocks;
|
||||
import WayofTime.bloodmagic.registry.ModItems;
|
||||
import WayofTime.bloodmagic.util.helper.RecipeHelper;
|
||||
|
@ -83,23 +87,47 @@ public class CategoryArchitect
|
|||
|
||||
List<IPage> incensePages = new ArrayList<IPage>();
|
||||
|
||||
// IRecipe incenseRecipe = RecipeHelper.getRecipeForOutput(new ItemStack(ModBlocks.incenseAltar));
|
||||
// if (incenseRecipe != null)
|
||||
// {
|
||||
// incensePages.add(new PageIRecipe(incenseRecipe));
|
||||
// }
|
||||
IRecipe incenseRecipe = RecipeHelper.getRecipeForOutput(new ItemStack(ModBlocks.incenseAltar));
|
||||
if (incenseRecipe != null)
|
||||
{
|
||||
incensePages.add(getPageForRecipe(incenseRecipe));
|
||||
}
|
||||
|
||||
incensePages.addAll(PageHelper.pagesForLongText(TextHelper.localize(keyBase + "incense" + ".info.1"), 270));
|
||||
|
||||
// IRecipe woodPathRecipe = RecipeHelper.getRecipeForOutput(new ItemStack(ModBlocks.pathBlock, 1, 0));
|
||||
// if (woodPathRecipe != null)
|
||||
// {
|
||||
// incensePages.add(new PageIRecipe(woodPathRecipe));
|
||||
// }
|
||||
IRecipe woodPathRecipe = RecipeHelper.getRecipeForOutput(new ItemStack(ModBlocks.pathBlock, 1, 0));
|
||||
if (woodPathRecipe != null)
|
||||
{
|
||||
incensePages.add(getPageForRecipe(woodPathRecipe));
|
||||
}
|
||||
|
||||
incensePages.addAll(PageHelper.pagesForLongText(TextHelper.localize(keyBase + "incense" + ".info.2"), 270));
|
||||
entries.put(new ResourceLocation(keyBase + "incense"), new EntryText(incensePages, TextHelper.localize(keyBase + "incense"), false));
|
||||
|
||||
List<IPage> runePages = new ArrayList<IPage>();
|
||||
|
||||
IRecipe runeRecipe = RecipeHelper.getRecipeForOutput(new ItemStack(ModBlocks.bloodRune, 1, 0));
|
||||
if (runeRecipe != null)
|
||||
{
|
||||
runePages.add(getPageForRecipe(runeRecipe));
|
||||
}
|
||||
|
||||
runePages.addAll(PageHelper.pagesForLongText(TextHelper.localize(keyBase + "bloodrune" + ".info.1"), 270));
|
||||
entries.put(new ResourceLocation(keyBase + "bloodrune"), new EntryText(runePages, TextHelper.localize(keyBase + "bloodrune"), false));
|
||||
|
||||
return entries;
|
||||
}
|
||||
|
||||
public static PageIRecipe getPageForRecipe(IRecipe recipe)
|
||||
{
|
||||
if (recipe instanceof ShapedBloodOrbRecipe)
|
||||
{
|
||||
return new PageIRecipe(recipe, new ShapedBloodOrbRecipeRenderer((ShapedBloodOrbRecipe) recipe));
|
||||
} else if (recipe instanceof ShapelessBloodOrbRecipe)
|
||||
{
|
||||
return new PageIRecipe(recipe, new ShapelessBloodOrbRecipeRenderer((ShapelessBloodOrbRecipe) recipe));
|
||||
}
|
||||
|
||||
return new PageIRecipe(recipe);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,9 @@ 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.recipe.TartaricForgeRecipe;
|
||||
import WayofTime.bloodmagic.compat.guideapi.entry.EntryText;
|
||||
import WayofTime.bloodmagic.compat.guideapi.page.PageTartaricForgeRecipe;
|
||||
import WayofTime.bloodmagic.registry.ModBlocks;
|
||||
import WayofTime.bloodmagic.registry.ModItems;
|
||||
import WayofTime.bloodmagic.util.helper.RecipeHelper;
|
||||
|
@ -58,31 +60,31 @@ public class CategoryDemon
|
|||
|
||||
List<IPage> pettyPages = new ArrayList<IPage>();
|
||||
pettyPages.addAll(PageHelper.pagesForLongText(TextHelper.localize(keyBase + "petty" + ".info.1"), 270));
|
||||
// TartaricForgeRecipe pettyRecipe = RecipeHelper.getForgeRecipeForOutput(new ItemStack(ModItems.soulGem, 1));
|
||||
// if (pettyRecipe != null)
|
||||
// {
|
||||
// pettyPages.add(new PageRecipe(pettyRecipe));
|
||||
// }
|
||||
TartaricForgeRecipe pettyRecipe = RecipeHelper.getForgeRecipeForOutput(new ItemStack(ModItems.soulGem, 1));
|
||||
if (pettyRecipe != null)
|
||||
{
|
||||
pettyPages.add(new PageTartaricForgeRecipe(pettyRecipe));
|
||||
}
|
||||
pettyPages.addAll(PageHelper.pagesForLongText(TextHelper.localize(keyBase + "petty" + ".info.2"), 270));
|
||||
entries.put(new ResourceLocation(keyBase + "petty"), new EntryText(pettyPages, TextHelper.localize(keyBase + "petty"), false));
|
||||
|
||||
List<IPage> swordPages = new ArrayList<IPage>();
|
||||
swordPages.addAll(PageHelper.pagesForLongText(TextHelper.localize(keyBase + "sword" + ".info.1"), 270));
|
||||
// TartaricForgeRecipe swordRecipe = RecipeHelper.getForgeRecipeForOutput(new ItemStack(ModItems.sentientSword));
|
||||
// if (swordRecipe != null)
|
||||
// {
|
||||
// swordPages.add(new PageRecipe(swordRecipe));
|
||||
// }
|
||||
TartaricForgeRecipe swordRecipe = RecipeHelper.getForgeRecipeForOutput(new ItemStack(ModItems.sentientSword));
|
||||
if (swordRecipe != null)
|
||||
{
|
||||
swordPages.add(new PageTartaricForgeRecipe(swordRecipe));
|
||||
}
|
||||
swordPages.addAll(PageHelper.pagesForLongText(TextHelper.localize(keyBase + "sword" + ".info.2"), 270));
|
||||
entries.put(new ResourceLocation(keyBase + "sword"), new EntryText(swordPages, TextHelper.localize(keyBase + "sword"), false));
|
||||
|
||||
List<IPage> lesserPages = new ArrayList<IPage>();
|
||||
lesserPages.addAll(PageHelper.pagesForLongText(TextHelper.localize(keyBase + "lesser" + ".info.1"), 270));
|
||||
// TartaricForgeRecipe pettyRecipe = RecipeHelper.getForgeRecipeForOutput(new ItemStack(ModItems.soulGem, 1));
|
||||
// if (pettyRecipe != null)
|
||||
// {
|
||||
// lesserPages.add(new PageRecipe(pettyRecipe));
|
||||
// }
|
||||
TartaricForgeRecipe lesserRecipe = RecipeHelper.getForgeRecipeForOutput(new ItemStack(ModItems.soulGem, 1));
|
||||
if (lesserRecipe != null)
|
||||
{
|
||||
lesserPages.add(new PageTartaricForgeRecipe(lesserRecipe));
|
||||
}
|
||||
lesserPages.addAll(PageHelper.pagesForLongText(TextHelper.localize(keyBase + "lesser" + ".info.2"), 270));
|
||||
entries.put(new ResourceLocation(keyBase + "lesser"), new EntryText(lesserPages, TextHelper.localize(keyBase + "lesser"), false));
|
||||
|
||||
|
@ -96,6 +98,33 @@ public class CategoryDemon
|
|||
entries.put(new ResourceLocation(keyBase + "sentientGem"), new EntryText(sentientGemPages, TextHelper.localize(keyBase + "sentientGem"), false));
|
||||
|
||||
List<IPage> routingPages = new ArrayList<IPage>();
|
||||
TartaricForgeRecipe nodeRecipe = RecipeHelper.getForgeRecipeForOutput(new ItemStack(ModBlocks.itemRoutingNode));
|
||||
if (nodeRecipe != null)
|
||||
{
|
||||
routingPages.add(new PageTartaricForgeRecipe(nodeRecipe));
|
||||
}
|
||||
TartaricForgeRecipe inputNodeRecipe = RecipeHelper.getForgeRecipeForOutput(new ItemStack(ModBlocks.itemRoutingNode));
|
||||
if (inputNodeRecipe != null)
|
||||
{
|
||||
routingPages.add(new PageTartaricForgeRecipe(inputNodeRecipe));
|
||||
}
|
||||
TartaricForgeRecipe outputNodeRecipe = RecipeHelper.getForgeRecipeForOutput(new ItemStack(ModBlocks.outputRoutingNode));
|
||||
if (outputNodeRecipe != null)
|
||||
{
|
||||
routingPages.add(new PageTartaricForgeRecipe(outputNodeRecipe));
|
||||
}
|
||||
TartaricForgeRecipe masterNodeRecipe = RecipeHelper.getForgeRecipeForOutput(new ItemStack(ModBlocks.masterRoutingNode));
|
||||
if (masterNodeRecipe != null)
|
||||
{
|
||||
routingPages.add(new PageTartaricForgeRecipe(masterNodeRecipe));
|
||||
}
|
||||
|
||||
TartaricForgeRecipe nodeRouterRecipe = RecipeHelper.getForgeRecipeForOutput(new ItemStack(ModItems.nodeRouter));
|
||||
if (nodeRouterRecipe != null)
|
||||
{
|
||||
routingPages.add(new PageTartaricForgeRecipe(nodeRouterRecipe));
|
||||
}
|
||||
|
||||
routingPages.addAll(PageHelper.pagesForLongText(TextHelper.localize(keyBase + "routing" + ".info"), 270));
|
||||
entries.put(new ResourceLocation(keyBase + "routing"), new EntryText(routingPages, TextHelper.localize(keyBase + "routing"), false));
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ public class PageAltarRecipe extends Page
|
|||
public void draw(Book book, CategoryAbstract category, EntryAbstract entry, int guiLeft, int guiTop, int mouseX, int mouseY, GuiBase guiBase, FontRenderer fontRenderer)
|
||||
{
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation("bloodmagicguide" + ":textures/gui/altar.png"));
|
||||
guiBase.drawTexturedModalRect(guiLeft + 42, guiTop + 53, 0, 87, 146, 104);
|
||||
guiBase.drawTexturedModalRect(guiLeft + 42, guiTop + 53, 0, 0, 146, 104);
|
||||
|
||||
guiBase.drawCenteredString(fontRenderer, TextHelper.localize("guide.BloodMagic.page.bloodAltar"), guiLeft + guiBase.xSize / 2, guiTop + 12, 0);
|
||||
|
||||
|
|
|
@ -0,0 +1,143 @@
|
|||
package WayofTime.bloodmagic.compat.guideapi.page;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import WayofTime.bloodmagic.api.recipe.TartaricForgeRecipe;
|
||||
import WayofTime.bloodmagic.api.registry.OrbRegistry;
|
||||
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;
|
||||
|
||||
public class PageTartaricForgeRecipe extends Page
|
||||
{
|
||||
public List<Object> input;
|
||||
public ItemStack output;
|
||||
public int tier;
|
||||
public double minimumWill;
|
||||
public double drainedWill;
|
||||
|
||||
private int cycleIdx = 0;
|
||||
private Random rand = new Random();
|
||||
|
||||
public PageTartaricForgeRecipe(TartaricForgeRecipe recipe)
|
||||
{
|
||||
this.input = recipe.getInput();
|
||||
this.output = recipe.getRecipeOutput();
|
||||
this.tier = 0;
|
||||
this.minimumWill = recipe.getMinimumSouls();
|
||||
this.drainedWill = recipe.getSoulsDrained();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@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)
|
||||
{
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation("bloodmagicguide" + ":textures/gui/soulForge.png"));
|
||||
guiBase.drawTexturedModalRect(guiLeft + 42, guiTop + 53, 0, 0, 146, 104);
|
||||
|
||||
guiBase.drawCenteredString(fontRenderer, TextHelper.localize("guide.BloodMagic.page.soulForge"), guiLeft + guiBase.xSize / 2, guiTop + 12, 0);
|
||||
|
||||
// int inputX = (1 + 1) * 20 + (guiLeft + guiBase.xSize / 7) + 1;
|
||||
// int inputY = (20) + (guiTop + guiBase.ySize / 5) - 1; //1 * 20
|
||||
|
||||
for (int y = 0; y < 2; y++)
|
||||
{
|
||||
for (int x = 0; x < 2; x++)
|
||||
{
|
||||
int stackX = (x + 1) * 20 + (guiLeft + guiBase.xSize / 7) + 1;
|
||||
int stackY = (y + 1) * 20 + (guiTop + guiBase.ySize / 5) - 1;
|
||||
Object component = input.size() > y * 2 + x ? input.get(y * 2 + x) : null;//recipe.getInput()[y * 2 + x];
|
||||
if (component != null)
|
||||
{
|
||||
if (component instanceof ItemStack)
|
||||
{
|
||||
ItemStack input = (ItemStack) component;
|
||||
if (input.getItemDamage() == OreDictionary.WILDCARD_VALUE)
|
||||
input.setItemDamage(0);
|
||||
|
||||
GuiHelper.drawItemStack((ItemStack) component, stackX, stackY);
|
||||
if (GuiHelper.isMouseBetween(mouseX, mouseY, stackX, stackY, 15, 15))
|
||||
{
|
||||
// tooltips = GuiHelper.getTooltip((ItemStack) component);
|
||||
guiBase.renderToolTip((ItemStack) component, mouseX, mouseY);
|
||||
}
|
||||
} else if (component instanceof Integer)
|
||||
{
|
||||
List<ItemStack> list = OrbRegistry.getOrbsDownToTier((Integer) component);
|
||||
if (!list.isEmpty())
|
||||
{
|
||||
ItemStack stack = list.get(getRandomizedCycle(x + (y * 2), list.size()));
|
||||
GuiHelper.drawItemStack(stack, stackX, stackY);
|
||||
if (GuiHelper.isMouseBetween(mouseX, mouseY, stackX, stackY, 15, 15))
|
||||
{
|
||||
// tooltips = GuiHelper.getTooltip(stack);
|
||||
guiBase.renderToolTip(stack, mouseX, mouseY);
|
||||
}
|
||||
}
|
||||
} else
|
||||
{
|
||||
List<ItemStack> list = (List<ItemStack>) component;
|
||||
if (!list.isEmpty())
|
||||
{
|
||||
ItemStack stack = list.get(getRandomizedCycle(x + (y * 2), list.size()));
|
||||
GuiHelper.drawItemStack(stack, stackX, stackY);
|
||||
if (GuiHelper.isMouseBetween(mouseX, mouseY, stackX, stackY, 15, 15))
|
||||
{
|
||||
// tooltips = GuiHelper.getTooltip(stack);
|
||||
guiBase.renderToolTip(stack, mouseX, mouseY);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// GuiHelper.drawItemStack(input.get(0), inputX, inputY);
|
||||
// if (GuiHelper.isMouseBetween(mouseX, mouseY, inputX, inputY, 15, 15))
|
||||
// {
|
||||
// guiBase.renderToolTip(input.get(0), mouseX, mouseY);
|
||||
// }
|
||||
|
||||
if (output == null)
|
||||
{
|
||||
output = new ItemStack(Blocks.BARRIER);
|
||||
}
|
||||
int outputX = (5 * 20) + (guiLeft + guiBase.xSize / 7) + 1;
|
||||
int outputY = (20) + (guiTop + guiBase.xSize / 5) + 10; // 1 * 20
|
||||
GuiHelper.drawItemStack(output, outputX, outputY);
|
||||
if (GuiHelper.isMouseBetween(mouseX, mouseY, outputX, outputY, 15, 15))
|
||||
{
|
||||
guiBase.renderToolTip(output, outputX, outputY);
|
||||
}
|
||||
|
||||
if (output.getItem() == Item.getItemFromBlock(Blocks.BARRIER))
|
||||
{
|
||||
guiBase.drawCenteredString(fontRenderer, TextHelper.localize("text.furnace.error"), guiLeft + guiBase.xSize / 2, guiTop + 4 * guiBase.ySize / 6, 0xED073D);
|
||||
guiBase.drawCenteredString(fontRenderer, TextHelper.localize("bm.string.tier") + ": " + String.valueOf(tier), guiLeft + guiBase.xSize / 2, guiTop + 4 * guiBase.ySize / 6 + 15, 0);
|
||||
// guiBase.drawCenteredString(fontRenderer, "LP: " + String.valueOf(bloodRequired), guiLeft + guiBase.xSize / 2, guiTop + 4 * guiBase.ySize / 6 + 30, 0);
|
||||
}
|
||||
guiBase.drawCenteredString(fontRenderer, TextHelper.localize("guide.BloodMagic.page.minimumWill", String.valueOf(minimumWill)), guiLeft + guiBase.xSize / 2, guiTop + 4 * guiBase.ySize / 6 - 15, 0);
|
||||
guiBase.drawCenteredString(fontRenderer, TextHelper.localize("guide.BloodMagic.page.drainedWill", String.valueOf(drainedWill)), guiLeft + guiBase.xSize / 2, guiTop + 4 * guiBase.ySize / 6, 0);
|
||||
}
|
||||
|
||||
protected int getRandomizedCycle(int index, int max)
|
||||
{
|
||||
rand.setSeed(index);
|
||||
return (index + rand.nextInt(max) + cycleIdx) % max;
|
||||
}
|
||||
}
|
|
@ -1,152 +0,0 @@
|
|||
package WayofTime.bloodmagic.compat.guideapi.page.recipeRenderer;
|
||||
|
||||
import WayofTime.bloodmagic.api.recipe.ShapedBloodOrbRecipe;
|
||||
import WayofTime.bloodmagic.api.recipe.ShapelessBloodOrbRecipe;
|
||||
import WayofTime.bloodmagic.api.registry.OrbRegistry;
|
||||
import WayofTime.bloodmagic.util.helper.TextHelper;
|
||||
import amerifrance.guideapi.GuideMod;
|
||||
import amerifrance.guideapi.api.IRecipeRenderer;
|
||||
import amerifrance.guideapi.api.impl.Book;
|
||||
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;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fml.relauncher.ReflectionHelper;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class OrbRecipeRenderer implements IRecipeRenderer
|
||||
{
|
||||
public IRecipe recipe;
|
||||
|
||||
public OrbRecipeRenderer(IRecipe recipe)
|
||||
{
|
||||
this.recipe = recipe;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Book book, CategoryAbstract category, EntryAbstract entry, int guiLeft, int guiTop, int mouseX, int mouseY, GuiBase guiBase, FontRenderer fontRenderer)
|
||||
{
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation("gudieapi", "textures/gui/recipe_elements.png"));
|
||||
guiBase.drawTexturedModalRect(guiLeft + 42, guiTop + 53, 0, 0, 105, 65);
|
||||
|
||||
guiBase.drawCenteredString(fontRenderer, TextHelper.localize("text.recipe.shapedOrb"), guiLeft + guiBase.xSize / 2, guiTop + 12, 0);
|
||||
if (recipe instanceof ShapelessBloodOrbRecipe)
|
||||
{
|
||||
ShapelessBloodOrbRecipe shapelessBloodOrbRecipe = (ShapelessBloodOrbRecipe) recipe;
|
||||
List<Object> list = shapelessBloodOrbRecipe.getInput();
|
||||
|
||||
int width = 3;
|
||||
int height = 3;
|
||||
for (int y = 0; y < height; y++)
|
||||
{
|
||||
for (int x = 0; x < width; x++)
|
||||
{
|
||||
if (list.size() - 1 < y * width + x)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
int stackX = (x + 1) * 18 + (guiLeft + guiBase.xSize / 7);
|
||||
int stackY = (y + 1) * 18 + (guiTop + guiBase.ySize / 5);
|
||||
|
||||
Object component = list.get(y * width + x);
|
||||
if (component != null)
|
||||
{
|
||||
if (component instanceof ItemStack)
|
||||
{
|
||||
GuiHelper.drawItemStack((ItemStack) component, stackX, stackY);
|
||||
if (GuiHelper.isMouseBetween(mouseX, mouseY, stackX, stackY, 15, 15))
|
||||
{
|
||||
guiBase.renderToolTip((ItemStack) component, stackX, stackY);
|
||||
}
|
||||
} else if (component instanceof Integer)
|
||||
{
|
||||
GuiHelper.drawItemStack(OrbRegistry.getOrbsForTier((Integer) component).get(0), stackX, stackY);
|
||||
if (GuiHelper.isMouseBetween(mouseX, mouseY, stackX, stackY, 15, 15))
|
||||
{
|
||||
guiBase.renderToolTip(OrbRegistry.getOrbsForTier((Integer) component).get(0), stackX, stackY);
|
||||
}
|
||||
} else
|
||||
{
|
||||
if (((ArrayList<ItemStack>) component).isEmpty())
|
||||
return;
|
||||
GuiHelper.drawItemStack(((ArrayList<ItemStack>) component).get(0), stackX, stackY);
|
||||
if (GuiHelper.isMouseBetween(mouseX, mouseY, stackX, stackY, 15, 15))
|
||||
{
|
||||
guiBase.renderToolTip(((ArrayList<ItemStack>) component).get(0), stackX, stackY);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
int outputX = (5 * 18) + (guiLeft + guiBase.xSize / 7);
|
||||
int outputY = (2 * 18) + (guiTop + guiBase.xSize / 5);
|
||||
GuiHelper.drawItemStack(shapelessBloodOrbRecipe.getRecipeOutput(), outputX, outputY);
|
||||
if (GuiHelper.isMouseBetween(mouseX, mouseY, outputX, outputY, 15, 15))
|
||||
{
|
||||
guiBase.renderToolTip(shapelessBloodOrbRecipe.getRecipeOutput(), outputX, outputY);
|
||||
}
|
||||
} else if (recipe instanceof ShapedBloodOrbRecipe)
|
||||
{
|
||||
ShapedBloodOrbRecipe shapedBloodOrbRecipe = (ShapedBloodOrbRecipe) recipe;
|
||||
int width = ReflectionHelper.getPrivateValue(ShapedBloodOrbRecipe.class, shapedBloodOrbRecipe, 4);
|
||||
int height = ReflectionHelper.getPrivateValue(ShapedBloodOrbRecipe.class, shapedBloodOrbRecipe, 5);
|
||||
for (int y = 0; y < height; y++)
|
||||
{
|
||||
for (int x = 0; x < width; x++)
|
||||
{
|
||||
int stackX = (x + 1) * 18 + (guiLeft + guiBase.xSize / 7);
|
||||
int stackY = (y + 1) * 18 + (guiTop + guiBase.ySize / 5);
|
||||
Object component = shapedBloodOrbRecipe.getInput()[y * width + x];
|
||||
if (component != null)
|
||||
{
|
||||
if (component instanceof ItemStack)
|
||||
{
|
||||
GuiHelper.drawItemStack((ItemStack) component, stackX, stackY);
|
||||
if (GuiHelper.isMouseBetween(mouseX, mouseY, stackX, stackY, 15, 15))
|
||||
{
|
||||
guiBase.renderToolTip((ItemStack) component, stackX, stackY);
|
||||
}
|
||||
} else if (component instanceof Integer)
|
||||
{
|
||||
GuiHelper.drawItemStack(OrbRegistry.getOrbsForTier((Integer) component).get(0), stackX, stackY);
|
||||
if (GuiHelper.isMouseBetween(mouseX, mouseY, stackX, stackY, 15, 15))
|
||||
{
|
||||
guiBase.renderToolTip(OrbRegistry.getOrbsForTier((Integer) component).get(0), stackX, stackY);
|
||||
}
|
||||
} else
|
||||
{
|
||||
if (((ArrayList<ItemStack>) component).isEmpty())
|
||||
return;
|
||||
GuiHelper.drawItemStack(((ArrayList<ItemStack>) component).get(0), stackX, stackY);
|
||||
if (GuiHelper.isMouseBetween(mouseX, mouseY, stackX, stackY, 15, 15))
|
||||
{
|
||||
guiBase.renderToolTip(((ArrayList<ItemStack>) component).get(0), stackX, stackY);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
int outputX = (5 * 18) + (guiLeft + guiBase.xSize / 7);
|
||||
int outputY = (2 * 18) + (guiTop + guiBase.xSize / 5);
|
||||
GuiHelper.drawItemStack(shapedBloodOrbRecipe.getRecipeOutput(), outputX, outputY);
|
||||
if (GuiHelper.isMouseBetween(mouseX, mouseY, outputX, outputY, 15, 15))
|
||||
{
|
||||
guiBase.renderToolTip(shapedBloodOrbRecipe.getRecipeOutput(), outputX, outputY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawExtras(Book book, CategoryAbstract category, EntryAbstract entry, int guiLeft, int guiTop, int mouseX, int mouseY, GuiBase guiBase, FontRenderer fontRenderer)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,79 @@
|
|||
package WayofTime.bloodmagic.compat.guideapi.page.recipeRenderer;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import WayofTime.bloodmagic.api.recipe.ShapedBloodOrbRecipe;
|
||||
import WayofTime.bloodmagic.api.registry.OrbRegistry;
|
||||
import amerifrance.guideapi.api.impl.Book;
|
||||
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;
|
||||
import amerifrance.guideapi.page.reciperenderer.BasicRecipeRenderer;
|
||||
|
||||
// TODO: Fix rendering of recipe
|
||||
public class ShapedBloodOrbRecipeRenderer extends BasicRecipeRenderer<ShapedBloodOrbRecipe>
|
||||
{
|
||||
public ShapedBloodOrbRecipeRenderer(ShapedBloodOrbRecipe recipe)
|
||||
{
|
||||
super(recipe);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void draw(Book book, CategoryAbstract category, EntryAbstract entry, int guiLeft, int guiTop, int mouseX, int mouseY, GuiBase guiBase, FontRenderer fontRendererObj)
|
||||
{
|
||||
super.draw(book, category, entry, guiLeft, guiTop, mouseX, mouseY, guiBase, fontRendererObj);
|
||||
for (int y = 0; y < recipe.height; y++)
|
||||
{
|
||||
for (int x = 0; x < recipe.width; x++)
|
||||
{
|
||||
int stackX = (x + 1) * 17 + (guiLeft + 29);
|
||||
int stackY = (y + 1) * 17 + (guiTop + 40);
|
||||
Object component = recipe.getInput()[y * recipe.width + x];
|
||||
if (component != null)
|
||||
{
|
||||
if (component instanceof ItemStack)
|
||||
{
|
||||
ItemStack input = (ItemStack) component;
|
||||
if (input.getItemDamage() == OreDictionary.WILDCARD_VALUE)
|
||||
input.setItemDamage(0);
|
||||
|
||||
GuiHelper.drawItemStack((ItemStack) component, stackX, stackY);
|
||||
if (GuiHelper.isMouseBetween(mouseX, mouseY, stackX, stackY, 15, 15))
|
||||
{
|
||||
tooltips = GuiHelper.getTooltip((ItemStack) component);
|
||||
}
|
||||
} else if (component instanceof Integer)
|
||||
{
|
||||
List<ItemStack> list = OrbRegistry.getOrbsDownToTier((Integer) component);
|
||||
if (!list.isEmpty())
|
||||
{
|
||||
ItemStack stack = list.get(getRandomizedCycle(x + (y * 3), list.size()));
|
||||
GuiHelper.drawItemStack(stack, stackX, stackY);
|
||||
if (GuiHelper.isMouseBetween(mouseX, mouseY, stackX, stackY, 15, 15))
|
||||
{
|
||||
tooltips = GuiHelper.getTooltip(stack);
|
||||
}
|
||||
}
|
||||
} else
|
||||
{
|
||||
List<ItemStack> list = (List<ItemStack>) component;
|
||||
if (!list.isEmpty())
|
||||
{
|
||||
ItemStack stack = list.get(getRandomizedCycle(x + (y * 3), list.size()));
|
||||
GuiHelper.drawItemStack(stack, stackX, stackY);
|
||||
if (GuiHelper.isMouseBetween(mouseX, mouseY, stackX, stackY, 15, 15))
|
||||
{
|
||||
tooltips = GuiHelper.getTooltip(stack);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,92 @@
|
|||
package WayofTime.bloodmagic.compat.guideapi.page.recipeRenderer;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import WayofTime.bloodmagic.api.recipe.ShapelessBloodOrbRecipe;
|
||||
import WayofTime.bloodmagic.api.registry.OrbRegistry;
|
||||
import amerifrance.guideapi.api.impl.Book;
|
||||
import amerifrance.guideapi.api.impl.abstraction.CategoryAbstract;
|
||||
import amerifrance.guideapi.api.impl.abstraction.EntryAbstract;
|
||||
import amerifrance.guideapi.api.util.GuiHelper;
|
||||
import amerifrance.guideapi.api.util.TextHelper;
|
||||
import amerifrance.guideapi.gui.GuiBase;
|
||||
import amerifrance.guideapi.page.reciperenderer.BasicRecipeRenderer;
|
||||
|
||||
public class ShapelessBloodOrbRecipeRenderer extends BasicRecipeRenderer<ShapelessBloodOrbRecipe>
|
||||
{
|
||||
|
||||
public ShapelessBloodOrbRecipeRenderer(ShapelessBloodOrbRecipe recipe)
|
||||
{
|
||||
super(recipe);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void draw(Book book, CategoryAbstract category, EntryAbstract entry, int guiLeft, int guiTop, int mouseX, int mouseY, GuiBase guiBase, FontRenderer fontRendererObj)
|
||||
{
|
||||
super.draw(book, category, entry, guiLeft, guiTop, mouseX, mouseY, guiBase, fontRendererObj);
|
||||
for (int y = 0; y < 3; y++)
|
||||
{
|
||||
for (int x = 0; x < 3; x++)
|
||||
{
|
||||
int i = 3 * y + x;
|
||||
if (i >= recipe.getRecipeSize())
|
||||
{
|
||||
} else
|
||||
{
|
||||
int stackX = (x + 1) * 17 + (guiLeft + 29);
|
||||
int stackY = (y + 1) * 17 + (guiTop + 40);
|
||||
Object component = recipe.getInput().get(i);
|
||||
if (component != null)
|
||||
{
|
||||
if (component instanceof ItemStack)
|
||||
{
|
||||
ItemStack input = (ItemStack) component;
|
||||
if (input.getItemDamage() == OreDictionary.WILDCARD_VALUE)
|
||||
input.setItemDamage(0);
|
||||
|
||||
GuiHelper.drawItemStack((ItemStack) component, stackX, stackY);
|
||||
if (GuiHelper.isMouseBetween(mouseX, mouseY, stackX, stackY, 15, 15))
|
||||
{
|
||||
tooltips = GuiHelper.getTooltip((ItemStack) component);
|
||||
}
|
||||
} else if (component instanceof Integer)
|
||||
{
|
||||
List<ItemStack> list = OrbRegistry.getOrbsDownToTier((Integer) component);
|
||||
if (!list.isEmpty())
|
||||
{
|
||||
ItemStack stack = list.get(getRandomizedCycle(x + (y * 3), list.size()));
|
||||
GuiHelper.drawItemStack(stack, stackX, stackY);
|
||||
if (GuiHelper.isMouseBetween(mouseX, mouseY, stackX, stackY, 15, 15))
|
||||
{
|
||||
tooltips = GuiHelper.getTooltip(stack);
|
||||
}
|
||||
}
|
||||
} else
|
||||
{
|
||||
List<ItemStack> list = (List<ItemStack>) component;
|
||||
if (!list.isEmpty())
|
||||
{
|
||||
ItemStack stack = list.get(getRandomizedCycle(x + (y * 3), list.size()));
|
||||
GuiHelper.drawItemStack(stack, stackX, stackY);
|
||||
if (GuiHelper.isMouseBetween(mouseX, mouseY, stackX, stackY, 15, 15))
|
||||
{
|
||||
tooltips = GuiHelper.getTooltip(stack);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getRecipeName()
|
||||
{
|
||||
return TextHelper.localizeEffect("text.shapeless.crafting");
|
||||
}
|
||||
}
|
|
@ -6,8 +6,14 @@ guide.BloodMagic.welcome=Blood Magic
|
|||
|
||||
# Page Information
|
||||
guide.BloodMagic.page.bloodAltar=Blood Altar Recipe
|
||||
guide.BloodMagic.page.soulForge=Hellfire Forge Recipe
|
||||
guide.BloodMagic.page.tier=Tier: %d
|
||||
guide.BloodMagic.page.lp=LP: %d
|
||||
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
|
||||
|
||||
|
||||
# Categories
|
||||
guide.BloodMagic.category.architect=The Architect
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 3.4 KiB |
Loading…
Reference in a new issue