diff --git a/build.gradle b/build.gradle index c110f478..646b3816 100644 --- a/build.gradle +++ b/build.gradle @@ -46,6 +46,7 @@ if (new File(projectDir, '.git').exists()) repositories { maven { url "http://dvs1.progwml6.com/files/maven" } maven { url "http://mobiusstrip.eu/maven" } + maven { url "http://tehnut.info/maven" } ivy { name "Thaumcraft" @@ -59,6 +60,7 @@ repositories { dependencies { deobfCompile "mezz.jei:jei_${mc_version}:${jei_version}" + deobfCompile "info.amerifrance.guideapi:Guide-API:${mc_version}-${guideapi_version}" compile "mcp.mobius.waila:Waila:${waila_version}_1.8.8:dev" compile name: "Thaumcraft", version: "${mc_version}-${thaumcraft_version}", ext: "jar" diff --git a/gradle.properties b/gradle.properties index 15f66df4..d8fbab4e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -10,4 +10,5 @@ mappings_version=snapshot_20160109 jei_version=2.27.0.157 waila_version=1.6.0-B3 thaumcraft_version=5.1.5 -baubles_version=1.1.3.0 \ No newline at end of file +baubles_version=1.1.3.0 +guideapi_version=2.0.0-27 \ No newline at end of file diff --git a/src/main/java/WayofTime/bloodmagic/api/Constants.java b/src/main/java/WayofTime/bloodmagic/api/Constants.java index 75669b42..58a52fc8 100644 --- a/src/main/java/WayofTime/bloodmagic/api/Constants.java +++ b/src/main/java/WayofTime/bloodmagic/api/Constants.java @@ -115,7 +115,7 @@ public class Constants public static final String DOMAIN = MODID.toLowerCase(Locale.ENGLISH) + ":"; public static final String NAME = "Blood Magic: Alchemical Wizardry"; public static final String VERSION = "@VERSION@"; - public static final String DEPEND = "after:JEI@[2.23.0,)"; + public static final String DEPEND = "after:JEI@[2.23.0,);after:guideapi"; } public static final class Gui diff --git a/src/main/java/WayofTime/bloodmagic/compat/guideapi/CompatibilityGuideAPI.java b/src/main/java/WayofTime/bloodmagic/compat/guideapi/CompatibilityGuideAPI.java new file mode 100644 index 00000000..2e5b514b --- /dev/null +++ b/src/main/java/WayofTime/bloodmagic/compat/guideapi/CompatibilityGuideAPI.java @@ -0,0 +1,23 @@ +package WayofTime.bloodmagic.compat.guideapi; + +import WayofTime.bloodmagic.compat.ICompatibility; +import WayofTime.bloodmagic.compat.guideapi.guide.GuideBloodMagic; + +public class CompatibilityGuideAPI implements ICompatibility { + + @Override + public void loadCompatibility(InitializationPhase phase) { + if (phase == InitializationPhase.PRE_INIT) + GuideBloodMagic.initGuide(); + } + + @Override + public String getModId() { + return "guideapi"; + } + + @Override + public boolean enableCompat() { + return true; + } +} diff --git a/src/main/java/WayofTime/bloodmagic/compat/guideapi/guide/GuideBloodMagic.java b/src/main/java/WayofTime/bloodmagic/compat/guideapi/guide/GuideBloodMagic.java new file mode 100644 index 00000000..fd786e9b --- /dev/null +++ b/src/main/java/WayofTime/bloodmagic/compat/guideapi/guide/GuideBloodMagic.java @@ -0,0 +1,76 @@ +package WayofTime.bloodmagic.compat.guideapi.guide; + +import WayofTime.bloodmagic.api.altar.EnumAltarTier; +import WayofTime.bloodmagic.api.registry.AltarRecipeRegistry; +import WayofTime.bloodmagic.api.registry.OrbRegistry; +import WayofTime.bloodmagic.compat.guideapi.guide.page.PageAltarRecipe; +import WayofTime.bloodmagic.registry.ModBlocks; +import WayofTime.bloodmagic.registry.ModItems; +import WayofTime.bloodmagic.util.helper.TextHelper; +import amerifrance.guideapi.api.GuideAPIItems; +import amerifrance.guideapi.api.GuideRegistry; +import amerifrance.guideapi.api.abstraction.CategoryAbstract; +import amerifrance.guideapi.api.abstraction.EntryAbstract; +import amerifrance.guideapi.api.abstraction.IPage; +import amerifrance.guideapi.api.base.Book; +import amerifrance.guideapi.api.util.PageHelper; +import amerifrance.guideapi.category.CategoryItemStack; +import amerifrance.guideapi.entry.EntryItemStack; +import amerifrance.guideapi.page.PageIRecipe; +import lombok.Getter; +import net.minecraft.client.resources.model.ModelResourceLocation; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.client.model.ModelLoader; +import net.minecraftforge.fml.common.FMLCommonHandler; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.oredict.ShapedOreRecipe; + +import java.awt.Color; +import java.util.ArrayList; +import java.util.List; + +public class GuideBloodMagic { + + @Getter + private static Book bloodMagicGuide; + + public static List categories = new ArrayList(); + + public static void initGuide() { + bloodMagicGuide = new Book(); + bloodMagicGuide.setAuthor("guide.BloodMagic.book.author"); + bloodMagicGuide.setUnlocBookTitle("guide.BloodMagic.book.title"); + bloodMagicGuide.setUnlocDisplayName("guide.BloodMagic.book.display"); + bloodMagicGuide.setUnlocWelcomeMessage("guide.BloodMagic.book.welcome"); + bloodMagicGuide.setBookColor(new Color(0xFF100F)); + + addArchitect(); + + bloodMagicGuide.setCategoryList(categories); + + GuideRegistry.registerBook(bloodMagicGuide, null); + if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT) + ModelLoader.setCustomModelResourceLocation(GuideAPIItems.guideBook, GuideRegistry.getIndexOf(bloodMagicGuide), new ModelResourceLocation(new ResourceLocation("guideapi", "ItemGuideBook"), "type=book")); + } + + private static void addArchitect() { + List entries = new ArrayList(); + + List introPages = new ArrayList(); + introPages.addAll(PageHelper.pagesForLongText(TextHelper.localize("guide.BloodMagic.entry.architect.intro.1"), 315)); + entries.add(new EntryItemStack(introPages, "guide.BloodMagic.entry.architect.intro", new ItemStack(Items.writable_book))); + + List bloodAltarPages = new ArrayList(); + bloodAltarPages.add(new PageIRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.altar), "a a", "aba", "cdc", 'a', "stone", 'b', Blocks.furnace, 'c', "ingotGold", 'd', new ItemStack(ModItems.monsterSoul)))); + bloodAltarPages.add(new PageIRecipe(new ShapedOreRecipe(new ItemStack(ModItems.sacrificialDagger), "aaa", " ba", "c a", 'a', "blockGlass", 'b', "ingotGold", 'c', "ingotIron"))); + bloodAltarPages.addAll(PageHelper.pagesForLongText(TextHelper.localize("guide.BloodMagic.entry.architect.bloodAltar.1"), 340)); + bloodAltarPages.add(new PageAltarRecipe(new AltarRecipeRegistry.AltarRecipe(new ItemStack(Items.diamond), OrbRegistry.getOrbStack(ModItems.orbWeak), EnumAltarTier.ONE, 2000, 2, 1))); + bloodAltarPages.addAll(PageHelper.pagesForLongText(TextHelper.localize("guide.BloodMagic.entry.architect.bloodAltar.2"))); + entries.add(new EntryItemStack(bloodAltarPages, "guide.BloodMagic.entry.architect.bloodAltar", new ItemStack(ModBlocks.altar))); + + categories.add(new CategoryItemStack(entries, "guide.BloodMagic.category.architect.name", new ItemStack(ModBlocks.altar))); + } +} diff --git a/src/main/java/WayofTime/bloodmagic/compat/guideapi/guide/page/PageAltarRecipe.java b/src/main/java/WayofTime/bloodmagic/compat/guideapi/guide/page/PageAltarRecipe.java new file mode 100644 index 00000000..3dd7e957 --- /dev/null +++ b/src/main/java/WayofTime/bloodmagic/compat/guideapi/guide/page/PageAltarRecipe.java @@ -0,0 +1,69 @@ +package WayofTime.bloodmagic.compat.guideapi.guide.page; + +import WayofTime.bloodmagic.api.altar.EnumAltarTier; +import WayofTime.bloodmagic.api.registry.AltarRecipeRegistry; +import WayofTime.bloodmagic.util.helper.TextHelper; +import amerifrance.guideapi.api.abstraction.CategoryAbstract; +import amerifrance.guideapi.api.abstraction.EntryAbstract; +import amerifrance.guideapi.api.base.Book; +import amerifrance.guideapi.api.base.PageBase; +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; + +public class PageAltarRecipe extends PageBase { + + public ItemStack input; + public ItemStack output; + public EnumAltarTier tier; + public int bloodRequired; + + public PageAltarRecipe(AltarRecipeRegistry.AltarRecipe recipe) { + this.input = recipe.getInput(); + this.output = recipe.getOutput(); + this.tier = recipe.getMinTier(); + 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("bloodmagicguide" + ":textures/gui/altar.png")); + guiBase.drawTexturedModalRect(guiLeft + 42, guiTop + 53, 0, 87, 146, 104); + + guiBase.drawCenteredString(fontRenderer, TextHelper.localize("guide.BloodMagic.page.bloodAltar"), 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, inputX, inputY); + if (GuiHelper.isMouseBetween(mouseX, mouseY, inputX, inputY, 15, 15)) { + guiBase.renderToolTip(input, 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("guide.BloodMagic.page.tier", tier.toInt()), guiLeft + guiBase.xSize / 2, guiTop + 4 * guiBase.ySize / 6 + 15, 0); + guiBase.drawCenteredString(fontRenderer, TextHelper.localize("guide.BloodMagic.page.lp", bloodRequired), guiLeft + guiBase.xSize / 2, guiTop + 4 * guiBase.ySize / 6 + 30, 0); + } + guiBase.drawCenteredString(fontRenderer, TextHelper.localize("guide.BloodMagic.page.tier", tier.toInt()), guiLeft + guiBase.xSize / 2, guiTop + 4 * guiBase.ySize / 6, 0); + guiBase.drawCenteredString(fontRenderer, TextHelper.localize("guide.BloodMagic.page.lp", bloodRequired), guiLeft + guiBase.xSize / 2, guiTop + 4 * guiBase.ySize / 6 + 15, 0); + } +} \ No newline at end of file diff --git a/src/main/java/WayofTime/bloodmagic/registry/ModCompatibility.java b/src/main/java/WayofTime/bloodmagic/registry/ModCompatibility.java index b2df2549..23b58eab 100644 --- a/src/main/java/WayofTime/bloodmagic/registry/ModCompatibility.java +++ b/src/main/java/WayofTime/bloodmagic/registry/ModCompatibility.java @@ -2,6 +2,7 @@ package WayofTime.bloodmagic.registry; import java.util.ArrayList; +import WayofTime.bloodmagic.compat.guideapi.CompatibilityGuideAPI; import net.minecraftforge.fml.common.Loader; import WayofTime.bloodmagic.compat.ICompatibility; import WayofTime.bloodmagic.compat.jei.CompatibilityJustEnoughItems; @@ -17,6 +18,7 @@ public class ModCompatibility compatibilities.add(new CompatibilityJustEnoughItems()); compatibilities.add(new CompatibilityWaila()); compatibilities.add(new CompatibilityThaumcraft()); + compatibilities.add(new CompatibilityGuideAPI()); } public static void loadCompat(ICompatibility.InitializationPhase phase) diff --git a/src/main/resources/assets/bloodmagicguide/lang/en_US.lang b/src/main/resources/assets/bloodmagicguide/lang/en_US.lang new file mode 100644 index 00000000..e0d08255 --- /dev/null +++ b/src/main/resources/assets/bloodmagicguide/lang/en_US.lang @@ -0,0 +1,26 @@ +# Book Information +guide.BloodMagic.book.title=Sanguine Scientiem +guide.BloodMagic.book.display=Sanguine Scientiem +guide.BloodMagic.book.author=Blood Magic +guide.BloodMagic.book.welcome=Blood Magic + +# Page Information +guide.BloodMagic.page.bloodAltar=Blood Altar Recipe +guide.BloodMagic.page.tier=Tier: %d +guide.BloodMagic.page.lp=LP: %d + +# Categories +guide.BloodMagic.category.architect.name=The Architect +guide.BloodMagic.category.ritual.name=The Ritual Master +guide.BloodMagic.category.demon.name=The Demon Kin +guide.BloodMagic.category.spell.name=The Battle Mage +guide.BloodMagic.category.alchemy.name=The Alchemist + +# Architect Entries +guide.BloodMagic.entry.architect.intro=A Classic Tragic Back-story +guide.BloodMagic.entry.architect.bloodAltar=The Blood Altar + +# Architect Entry Texts +guide.BloodMagic.entry.architect.intro.1=My name is Tiberius. I was a kid when the demons came for my village during The Wars. They ransacked the houses and turned the shacks into splinters, wielding fire and water to blast the land asunder. I woke up to some travelling merchants that were passing by, equipping the warriors who were futily trying to drive off the demons that still clawed the village. I was brought to a village nearby, where a magician named Magus helped tend to my wounds. The magic that he used was something that I had never seen before - it wasn't Thaumaturgy, nor Alchemy, and it was definitely not Botany. He winked at me once he saw that my eyes were open, holding his finger to his lips. Fast-forward several years, and I have learned almost everything from Master Magus, being his third student ever to master his arts. Against his wishes, I have recorded my research and put several wards and spells on this book. So welcome, apprentice. I am known as The Architect, and I am a Blood Mage. It took several years of pestering before I managed to convince Magus to teach me. He kept on telling me that, "Magic that uses the life essence of living beings requires patience and preparation in order to master it. One false move, go a little past your natural endurance, and you may find yourself taking a nice vacation in Tartarus." The thing was, I wanted to go there - I had some unfinished business with the demons. The process that Magus originally constructed required powerful artifacts that he constructed himself, but were rather lacking where teaching was concerned. After studying a bit of alchemy and the process of "Equivalent Exchange," I managed to construct myself an altar that would transmute items inside of its basin into new powerful forms. The only issue was that it needed a worthy catalyst, and so with a prick of the finger I set the Blood Altar alight! +guide.BloodMagic.entry.architect.bloodAltar.1=To start any form of transmutation involving blood, you would need to construct a blood altar and a sacrificial knife, as well as have a solitary diamond in your possession. After placing the blood altar down, Magus advised me to be careful as I filled it slowly with my blood, and said that I would need to be really close to the altar (about a metre) for the knife to work. With about 2 buckets of blood in the altar, which Master Magus reminds me is about 10 hearts worth, I placed the diamond inside of the altar by activating it with the diamond in hand. +guide.BloodMagic.entry.architect.bloodAltar.2=The blood dissipated in a cloud of red swirls as I waited for the atoms of the diamond to shift and reform. There were a few moments where the particles turned gray, which meant that the altar was empty and I had to hurry to fill it. After the diamond burst in a shower of red particles, what finally sat in the altar was a Weak Blood Orb. \ No newline at end of file diff --git a/src/main/resources/assets/bloodmagic/textures/gui/guide/altar.png b/src/main/resources/assets/bloodmagicguide/textures/gui/altar.png similarity index 100% rename from src/main/resources/assets/bloodmagic/textures/gui/guide/altar.png rename to src/main/resources/assets/bloodmagicguide/textures/gui/altar.png