Begin GuideAPI integration
This commit is contained in:
parent
d0c0700fda
commit
93623a6687
|
@ -61,8 +61,8 @@ repositories {
|
||||||
dependencies {
|
dependencies {
|
||||||
deobfCompile "mezz.jei:jei_${mc_version}:${jei_version}"
|
deobfCompile "mezz.jei:jei_${mc_version}:${jei_version}"
|
||||||
deobfCompile "mcp.mobius.waila:Waila:${waila_version}_${mc_version}:dev"
|
deobfCompile "mcp.mobius.waila:Waila:${waila_version}_${mc_version}:dev"
|
||||||
|
deobfCompile "info.amerifrance.guideapi:Guide-API:${mc_version}-${guideapi_version}"
|
||||||
|
|
||||||
// deobfCompile "info.amerifrance.guideapi:Guide-API:${mc_version}-${guideapi_version}"
|
|
||||||
// compile name: "Thaumcraft", version: "${mc_version}-${thaumcraft_version}", ext: "jar"
|
// compile name: "Thaumcraft", version: "${mc_version}-${thaumcraft_version}", ext: "jar"
|
||||||
// compile name: 'Baubles', version: "${baubles_version}", ext: 'jar'
|
// compile name: 'Baubles', version: "${baubles_version}", ext: 'jar'
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,4 +11,4 @@ jei_version=3.4.0.204
|
||||||
waila_version=1.7.0-B3
|
waila_version=1.7.0-B3
|
||||||
thaumcraft_version=5.1.5
|
thaumcraft_version=5.1.5
|
||||||
baubles_version=1.1.3.0
|
baubles_version=1.1.3.0
|
||||||
guideapi_version=2.0.0-27
|
guideapi_version=2.0.0-33
|
|
@ -0,0 +1,41 @@
|
||||||
|
package WayofTime.bloodmagic.compat.guideapi;
|
||||||
|
|
||||||
|
import WayofTime.bloodmagic.api.altar.EnumAltarTier;
|
||||||
|
import WayofTime.bloodmagic.api.registry.AltarRecipeRegistry;
|
||||||
|
import WayofTime.bloodmagic.compat.ICompatibility;
|
||||||
|
import amerifrance.guideapi.api.GuideAPI;
|
||||||
|
import net.minecraft.init.Items;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||||
|
|
||||||
|
public class CompatibilityGuideAPI implements ICompatibility {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void loadCompatibility(InitializationPhase phase) {
|
||||||
|
switch (phase) {
|
||||||
|
case PRE_INIT: {
|
||||||
|
GuideBloodMagic.initBook();
|
||||||
|
AltarRecipeRegistry.registerRecipe(new AltarRecipeRegistry.AltarRecipe(new ItemStack(Items.BOOK), GuideAPI.getStackFromBook(GuideBloodMagic.guideBook), EnumAltarTier.ONE, 500, 2, 0));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case INIT: {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case POST_INIT: {
|
||||||
|
GuideBloodMagic.initCategories();
|
||||||
|
GameRegistry.register(GuideBloodMagic.guideBook);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getModId() {
|
||||||
|
return "guideapi";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean enableCompat() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,56 @@
|
||||||
|
package WayofTime.bloodmagic.compat.guideapi;
|
||||||
|
|
||||||
|
import WayofTime.bloodmagic.compat.guideapi.book.*;
|
||||||
|
import WayofTime.bloodmagic.compat.jei.BloodMagicPlugin;
|
||||||
|
import WayofTime.bloodmagic.registry.ModBlocks;
|
||||||
|
import WayofTime.bloodmagic.registry.ModItems;
|
||||||
|
import amerifrance.guideapi.api.GuideAPI;
|
||||||
|
import amerifrance.guideapi.api.impl.Book;
|
||||||
|
import amerifrance.guideapi.api.util.NBTBookTags;
|
||||||
|
import amerifrance.guideapi.category.CategoryItemStack;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||||
|
import net.minecraftforge.fml.common.Loader;
|
||||||
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
|
||||||
|
import java.awt.Color;
|
||||||
|
|
||||||
|
public class GuideBloodMagic {
|
||||||
|
|
||||||
|
public static Book guideBook;
|
||||||
|
|
||||||
|
public static void initBook() {
|
||||||
|
guideBook = new Book();
|
||||||
|
guideBook.setTitle("guide.BloodMagic.title");
|
||||||
|
guideBook.setDisplayName("guide.BloodMagic.display");
|
||||||
|
guideBook.setWelcomeMessage("guide.BloodMagic.welcome");
|
||||||
|
guideBook.setAuthor("guide.BloodMagic.author");
|
||||||
|
guideBook.setRegistryName("BloodMagic");
|
||||||
|
guideBook.setColor(Color.RED);
|
||||||
|
|
||||||
|
if (FMLCommonHandler.instance().getSide() == Side.CLIENT)
|
||||||
|
GuideAPI.setModel(guideBook);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void initCategories() {
|
||||||
|
guideBook.addCategory(new CategoryItemStack(CategoryAlchemy.buildCategory(), "guide.BloodMagic.category.alchemy", new ItemStack(ModItems.arcaneAshes)));
|
||||||
|
guideBook.addCategory(new CategoryItemStack(CategoryArchitect.buildCategory(), "guide.BloodMagic.category.architect", new ItemStack(ModItems.sigilDivination)));
|
||||||
|
guideBook.addCategory(new CategoryItemStack(CategoryDemon.buildCategory(), "guide.BloodMagic.category.demon", new ItemStack(ModItems.bloodShard)));
|
||||||
|
guideBook.addCategory(new CategoryItemStack(CategoryRitual.buildCategory(), "guide.BloodMagic.category.ritual", new ItemStack(ModBlocks.ritualController)));
|
||||||
|
guideBook.addCategory(new CategoryItemStack(CategorySpell.buildCategory(), "guide.BloodMagic.category.spell", new ItemStack(ModItems.ritualDiviner)));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void initJEIBlacklist() {
|
||||||
|
if (Loader.isModLoaded("JEI"))
|
||||||
|
BloodMagicPlugin.jeiHelper.getNbtIgnoreList().ignoreNbtTagNames(
|
||||||
|
GuideAPI.guideBook,
|
||||||
|
NBTBookTags.BOOK_TAG,
|
||||||
|
NBTBookTags.CATEGORY_PAGE_TAG,
|
||||||
|
NBTBookTags.CATEGORY_TAG,
|
||||||
|
NBTBookTags.ENTRY_PAGE_TAG,
|
||||||
|
NBTBookTags.ENTRY_TAG,
|
||||||
|
NBTBookTags.KEY_TAG,
|
||||||
|
NBTBookTags.PAGE_TAG
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
package WayofTime.bloodmagic.compat.guideapi.book;
|
||||||
|
|
||||||
|
import WayofTime.bloodmagic.api.Constants;
|
||||||
|
import amerifrance.guideapi.api.impl.abstraction.EntryAbstract;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class CategoryAlchemy {
|
||||||
|
|
||||||
|
public static Map<ResourceLocation, EntryAbstract> buildCategory() {
|
||||||
|
Map<ResourceLocation, EntryAbstract> entries = new HashMap<ResourceLocation, EntryAbstract>();
|
||||||
|
String keyBase = Constants.Mod.DOMAIN + "alchemy_";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return entries;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
package WayofTime.bloodmagic.compat.guideapi.book;
|
||||||
|
|
||||||
|
import WayofTime.bloodmagic.api.Constants;
|
||||||
|
import amerifrance.guideapi.api.impl.abstraction.EntryAbstract;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class CategoryArchitect {
|
||||||
|
|
||||||
|
public static Map<ResourceLocation, EntryAbstract> buildCategory() {
|
||||||
|
Map<ResourceLocation, EntryAbstract> entries = new HashMap<ResourceLocation, EntryAbstract>();
|
||||||
|
String keyBase = Constants.Mod.DOMAIN + "architect_";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return entries;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
package WayofTime.bloodmagic.compat.guideapi.book;
|
||||||
|
|
||||||
|
import WayofTime.bloodmagic.api.Constants;
|
||||||
|
import amerifrance.guideapi.api.impl.abstraction.EntryAbstract;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class CategoryDemon {
|
||||||
|
|
||||||
|
public static Map<ResourceLocation, EntryAbstract> buildCategory() {
|
||||||
|
Map<ResourceLocation, EntryAbstract> entries = new HashMap<ResourceLocation, EntryAbstract>();
|
||||||
|
String keyBase = Constants.Mod.DOMAIN + "demon_";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return entries;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
package WayofTime.bloodmagic.compat.guideapi.book;
|
||||||
|
|
||||||
|
import WayofTime.bloodmagic.api.Constants;
|
||||||
|
import WayofTime.bloodmagic.api.registry.RitualRegistry;
|
||||||
|
import WayofTime.bloodmagic.api.ritual.Ritual;
|
||||||
|
import WayofTime.bloodmagic.compat.guideapi.entry.EntryText;
|
||||||
|
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.PageImage;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class CategoryRitual {
|
||||||
|
|
||||||
|
public static Map<ResourceLocation, EntryAbstract> buildCategory() {
|
||||||
|
Map<ResourceLocation, EntryAbstract> entries = new HashMap<ResourceLocation, EntryAbstract>();
|
||||||
|
String keyBase = Constants.Mod.DOMAIN + "ritual_";
|
||||||
|
|
||||||
|
for (Ritual ritual : RitualRegistry.getRituals()) {
|
||||||
|
List<IPage> ritualPages = new ArrayList<IPage>();
|
||||||
|
ritualPages.addAll(PageHelper.pagesForLongText(TextHelper.localize(ritual.getUnlocalizedName() + ".info")));
|
||||||
|
ritualPages.add(new PageImage(new ResourceLocation("bloodmagicguide", "textures/guide/" + ritual.getName() + ".png")));
|
||||||
|
entries.put(new ResourceLocation(keyBase + ritual.getName()), new EntryText(ritualPages, TextHelper.localize(ritual.getUnlocalizedName()), true));
|
||||||
|
}
|
||||||
|
|
||||||
|
return entries;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
package WayofTime.bloodmagic.compat.guideapi.book;
|
||||||
|
|
||||||
|
import WayofTime.bloodmagic.api.Constants;
|
||||||
|
import amerifrance.guideapi.api.impl.abstraction.EntryAbstract;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class CategorySpell {
|
||||||
|
|
||||||
|
public static Map<ResourceLocation, EntryAbstract> buildCategory() {
|
||||||
|
Map<ResourceLocation, EntryAbstract> entries = new HashMap<ResourceLocation, EntryAbstract>();
|
||||||
|
String keyBase = Constants.Mod.DOMAIN + "spell_";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return entries;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
@ParametersAreNonnullByDefault
|
||||||
|
@MethodsReturnNonnullByDefault
|
||||||
|
package WayofTime.bloodmagic.compat.guideapi.book;
|
||||||
|
|
||||||
|
import mcp.MethodsReturnNonnullByDefault;
|
||||||
|
|
||||||
|
import javax.annotation.ParametersAreNonnullByDefault;
|
|
@ -0,0 +1,34 @@
|
||||||
|
package WayofTime.bloodmagic.compat.guideapi.entry;
|
||||||
|
|
||||||
|
import amerifrance.guideapi.api.IPage;
|
||||||
|
import amerifrance.guideapi.api.impl.Book;
|
||||||
|
import amerifrance.guideapi.api.impl.abstraction.CategoryAbstract;
|
||||||
|
import amerifrance.guideapi.api.util.GuiHelper;
|
||||||
|
import amerifrance.guideapi.entry.EntryResourceLocation;
|
||||||
|
import amerifrance.guideapi.gui.GuiBase;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.gui.FontRenderer;
|
||||||
|
import net.minecraft.client.renderer.GlStateManager;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class EntryText extends EntryResourceLocation {
|
||||||
|
|
||||||
|
public EntryText(List<IPage> pageList, String unlocEntryName, boolean unicode) {
|
||||||
|
super(pageList, unlocEntryName, new ResourceLocation("bloodmagicguide", "textures/gui/bullet_point.png"), unicode);
|
||||||
|
}
|
||||||
|
|
||||||
|
public EntryText(List<IPage> pageList, String unlocEntryName) {
|
||||||
|
this(pageList, unlocEntryName, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public void drawExtras(Book book, CategoryAbstract category, int entryX, int entryY, int entryWidth, int entryHeight, int mouseX, int mouseY, GuiBase guiBase, FontRenderer fontRendererObj) {
|
||||||
|
Minecraft.getMinecraft().getTextureManager().bindTexture(image);
|
||||||
|
GuiHelper.drawSizedIconWithoutColor(entryX + 4, entryY + 2, 8, 8, 1F);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
@ParametersAreNonnullByDefault
|
||||||
|
@MethodsReturnNonnullByDefault
|
||||||
|
package WayofTime.bloodmagic.compat.guideapi.entry;
|
||||||
|
|
||||||
|
import mcp.MethodsReturnNonnullByDefault;
|
||||||
|
|
||||||
|
import javax.annotation.ParametersAreNonnullByDefault;
|
|
@ -0,0 +1,7 @@
|
||||||
|
//@ParametersAreNonnullByDefault
|
||||||
|
//@MethodsReturnNonnullByDefault
|
||||||
|
//package WayofTime.bloodmagic.compat.guideapi;
|
||||||
|
//
|
||||||
|
//import mcp.MethodsReturnNonnullByDefault;
|
||||||
|
//
|
||||||
|
//import javax.annotation.ParametersAreNonnullByDefault;
|
|
@ -0,0 +1,70 @@
|
||||||
|
package WayofTime.bloodmagic.compat.guideapi.page;
|
||||||
|
|
||||||
|
import WayofTime.bloodmagic.api.registry.AltarRecipeRegistry;
|
||||||
|
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;
|
||||||
|
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 java.util.List;
|
||||||
|
|
||||||
|
public class PageAltarRecipe extends Page {
|
||||||
|
|
||||||
|
public List<ItemStack> input;
|
||||||
|
public ItemStack output;
|
||||||
|
public int tier;
|
||||||
|
public int bloodRequired;
|
||||||
|
|
||||||
|
public PageAltarRecipe(AltarRecipeRegistry.AltarRecipe recipe) {
|
||||||
|
this.input = recipe.getInput();
|
||||||
|
this.output = recipe.getOutput();
|
||||||
|
this.tier = recipe.getMinTier().toInt();
|
||||||
|
this.bloodRequired = recipe.getSyphon();
|
||||||
|
}
|
||||||
|
|
||||||
|
@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("alchemicalwizardry" + ":textures/gui/guide/altar.png"));
|
||||||
|
guiBase.drawTexturedModalRect(guiLeft + 42, guiTop + 53, 0, 87, 146, 104);
|
||||||
|
|
||||||
|
guiBase.drawCenteredString(fontRenderer, TextHelper.localize("text.recipe.altar"), 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
|
||||||
|
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) - 1; // 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("text.recipe.altar.tier", String.valueOf(tier)), guiLeft + guiBase.xSize / 2, guiTop + 4 * guiBase.ySize / 6, 0);
|
||||||
|
guiBase.drawCenteredString(fontRenderer, TextHelper.localize("text.recipe.altar.bloodRequired", String.valueOf(bloodRequired)), guiLeft + guiBase.xSize / 2, guiTop + 4 * guiBase.ySize / 6 + 15, 0);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
@ParametersAreNonnullByDefault
|
||||||
|
@MethodsReturnNonnullByDefault
|
||||||
|
package WayofTime.bloodmagic.compat.guideapi.page;
|
||||||
|
|
||||||
|
import mcp.MethodsReturnNonnullByDefault;
|
||||||
|
|
||||||
|
import javax.annotation.ParametersAreNonnullByDefault;
|
|
@ -0,0 +1,128 @@
|
||||||
|
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(GuideMod.GUITEXLOC + "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,7 @@
|
||||||
|
@ParametersAreNonnullByDefault
|
||||||
|
@MethodsReturnNonnullByDefault
|
||||||
|
package WayofTime.bloodmagic.compat.guideapi.page.recipeRenderer;
|
||||||
|
|
||||||
|
import mcp.MethodsReturnNonnullByDefault;
|
||||||
|
|
||||||
|
import javax.annotation.ParametersAreNonnullByDefault;
|
|
@ -1,6 +1,7 @@
|
||||||
package WayofTime.bloodmagic.registry;
|
package WayofTime.bloodmagic.registry;
|
||||||
|
|
||||||
import WayofTime.bloodmagic.compat.ICompatibility;
|
import WayofTime.bloodmagic.compat.ICompatibility;
|
||||||
|
import WayofTime.bloodmagic.compat.guideapi.CompatibilityGuideAPI;
|
||||||
import WayofTime.bloodmagic.compat.jei.CompatibilityJustEnoughItems;
|
import WayofTime.bloodmagic.compat.jei.CompatibilityJustEnoughItems;
|
||||||
import WayofTime.bloodmagic.compat.waila.CompatibilityWaila;
|
import WayofTime.bloodmagic.compat.waila.CompatibilityWaila;
|
||||||
import net.minecraftforge.fml.common.Loader;
|
import net.minecraftforge.fml.common.Loader;
|
||||||
|
@ -15,8 +16,8 @@ public class ModCompatibility
|
||||||
{
|
{
|
||||||
compatibilities.add(new CompatibilityJustEnoughItems());
|
compatibilities.add(new CompatibilityJustEnoughItems());
|
||||||
compatibilities.add(new CompatibilityWaila());
|
compatibilities.add(new CompatibilityWaila());
|
||||||
|
compatibilities.add(new CompatibilityGuideAPI());
|
||||||
// compatibilities.add(new CompatibilityThaumcraft());
|
// compatibilities.add(new CompatibilityThaumcraft());
|
||||||
// compatibilities.add(new CompatibilityGuideAPI());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void loadCompat(ICompatibility.InitializationPhase phase)
|
public static void loadCompat(ICompatibility.InitializationPhase phase)
|
||||||
|
|
Loading…
Reference in a new issue