*Begin* moving GAPI compat to prettier system
This commit is contained in:
parent
dc5bfac313
commit
fb2ea2a4fe
|
@ -9,4 +9,4 @@ mappings_version=snapshot_20170814
|
|||
|
||||
jei_version=4.7.5.85
|
||||
waila_version=1.8.20-B35
|
||||
guideapi_version=2.1.4-56
|
||||
guideapi_version=2.1.4-57
|
|
@ -38,16 +38,17 @@ public class BloodMagicGuideAPIPlugin implements IGuideBook {
|
|||
GUIDE_BOOK.setRegistryName(new ResourceLocation(BloodMagic.MODID, "guide"));
|
||||
GUIDE_BOOK.setColor(Color.RED);
|
||||
|
||||
CategoryAlchemy.buildCategory(GUIDE_BOOK);
|
||||
CategoryArchitect.buildCategory(GUIDE_BOOK);
|
||||
GUIDE_BOOK.addCategory(new CategoryItemStack(CategoryDemon.buildCategory(), "guide.bloodmagic.category.demon", new ItemStack(RegistrarBloodMagicItems.BLOOD_SHARD)));
|
||||
GUIDE_BOOK.addCategory(new CategoryItemStack(CategoryRitual.buildCategory(), "guide.bloodmagic.category.ritual", new ItemStack(RegistrarBloodMagicBlocks.RITUAL_CONTROLLER)));
|
||||
// GUIDE_BOOK.addCategory(new CategoryItemStack(CategorySpell.buildCategory(), "guide.bloodmagic.category.spell", new ItemStack(ModItems.ritualDiviner)));
|
||||
|
||||
return GUIDE_BOOK;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handlePost(ItemStack bookStack) {
|
||||
GUIDE_BOOK.addCategory(new CategoryItemStack(CategoryAlchemy.buildCategory(), "guide.bloodmagic.category.alchemy", new ItemStack(RegistrarBloodMagicItems.ARCANE_ASHES)));
|
||||
GUIDE_BOOK.addCategory(new CategoryItemStack(CategoryArchitect.buildCategory(), "guide.bloodmagic.category.architect", new ItemStack(RegistrarBloodMagicItems.SIGIL_DIVINATION)));
|
||||
GUIDE_BOOK.addCategory(new CategoryItemStack(CategoryDemon.buildCategory(), "guide.bloodmagic.category.demon", new ItemStack(RegistrarBloodMagicItems.BLOOD_SHARD)));
|
||||
GUIDE_BOOK.addCategory(new CategoryItemStack(CategoryRitual.buildCategory(), "guide.bloodmagic.category.ritual", new ItemStack(RegistrarBloodMagicBlocks.RITUAL_CONTROLLER)));
|
||||
// guideBook.addCategory(new CategoryItemStack(CategorySpell.buildCategory(), "guide.bloodmagic.category.spell", new ItemStack(ModItems.ritualDiviner)));
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
|
|
@ -2,18 +2,40 @@ package WayofTime.bloodmagic.compat.guideapi;
|
|||
|
||||
import WayofTime.bloodmagic.api.alchemyCrafting.AlchemyCircleRenderer;
|
||||
import WayofTime.bloodmagic.api.registry.AlchemyArrayRecipeRegistry;
|
||||
import WayofTime.bloodmagic.api_impl.BloodMagicAPI;
|
||||
import WayofTime.bloodmagic.api_impl.recipe.RecipeBloodAltar;
|
||||
import WayofTime.bloodmagic.api_impl.recipe.RecipeTartaricForge;
|
||||
import WayofTime.bloodmagic.client.render.alchemyArray.DualAlchemyCircleRenderer;
|
||||
import WayofTime.bloodmagic.compat.guideapi.page.PageAlchemyArray;
|
||||
import amerifrance.guideapi.page.PageIRecipe;
|
||||
import WayofTime.bloodmagic.compat.guideapi.page.PageAltarRecipe;
|
||||
import WayofTime.bloodmagic.compat.guideapi.page.PageTartaricForgeRecipe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class BookUtils {
|
||||
|
||||
@Nullable
|
||||
public static PageAltarRecipe getAltarPage(ItemStack output) {
|
||||
for (RecipeBloodAltar recipe : BloodMagicAPI.INSTANCE.getRecipeRegistrar().getAltarRecipes().values())
|
||||
if (ItemStack.areItemStacksEqualUsingNBTShareTag(output, recipe.getOutput()))
|
||||
return new PageAltarRecipe(recipe);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static PageTartaricForgeRecipe getForgeRecipe(ItemStack output) {
|
||||
for (RecipeTartaricForge recipe : BloodMagicAPI.INSTANCE.getRecipeRegistrar().getTartaricForgeRecipes().values())
|
||||
if (ItemStack.areItemStacksEqualUsingNBTShareTag(output, recipe.getOutput()))
|
||||
return new PageTartaricForgeRecipe(recipe);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static PageAlchemyArray getAlchemyPage(String key) {
|
||||
ItemStack[] recipe = AlchemyArrayRecipeRegistry.getRecipeForArrayEffect(key);
|
||||
if (recipe[0] != null) {
|
||||
|
@ -55,8 +77,4 @@ public class BookUtils {
|
|||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static PageIRecipe getPageForRecipe(IRecipe recipe) {
|
||||
return new PageIRecipe(recipe);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,103 +1,65 @@
|
|||
package WayofTime.bloodmagic.compat.guideapi.book;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.recipe.TartaricForgeRecipe;
|
||||
import WayofTime.bloodmagic.compat.guideapi.BookUtils;
|
||||
import WayofTime.bloodmagic.compat.guideapi.entry.EntryText;
|
||||
import WayofTime.bloodmagic.compat.guideapi.page.PageAlchemyArray;
|
||||
import WayofTime.bloodmagic.compat.guideapi.page.PageTartaricForgeRecipe;
|
||||
import WayofTime.bloodmagic.core.RegistrarBloodMagicItems;
|
||||
import WayofTime.bloodmagic.util.helper.RecipeHelper;
|
||||
import WayofTime.bloodmagic.util.helper.TextHelper;
|
||||
import amerifrance.guideapi.api.IPage;
|
||||
import amerifrance.guideapi.api.impl.Book;
|
||||
import amerifrance.guideapi.api.impl.abstraction.EntryAbstract;
|
||||
import amerifrance.guideapi.api.util.PageHelper;
|
||||
import amerifrance.guideapi.category.CategoryItemStack;
|
||||
import amerifrance.guideapi.page.PageText;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
public class CategoryAlchemy {
|
||||
public static Map<ResourceLocation, EntryAbstract> buildCategory() {
|
||||
Map<ResourceLocation, EntryAbstract> entries = new LinkedHashMap<ResourceLocation, EntryAbstract>();
|
||||
String keyBase = "guide." + BloodMagic.MODID + ".entry.alchemy.";
|
||||
|
||||
List<IPage> introPages = new ArrayList<IPage>();
|
||||
introPages.addAll(PageHelper.pagesForLongText(TextHelper.localize(keyBase + "intro" + ".info"), 370));
|
||||
entries.put(new ResourceLocation(keyBase + "intro"), new EntryText(introPages, TextHelper.localize(keyBase + "intro"), true));
|
||||
public static void buildCategory(Book book) {
|
||||
final String keyBase = "guide." + BloodMagic.MODID + ".entry.alchemy.";
|
||||
|
||||
List<IPage> ashPages = new ArrayList<IPage>();
|
||||
CategoryItemStack category = new CategoryItemStack(keyBase + "alchemy", new ItemStack(RegistrarBloodMagicItems.ARCANE_ASHES));
|
||||
category.withKeyBase(BloodMagic.MODID);
|
||||
|
||||
TartaricForgeRecipe ashRecipe = RecipeHelper.getForgeRecipeForOutput(new ItemStack(RegistrarBloodMagicItems.ARCANE_ASHES));
|
||||
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));
|
||||
category.addEntry("intro", new EntryText(keyBase + "intro", true));
|
||||
category.getEntry("intro").addPageList(PageHelper.pagesForLongText(I18n.format(keyBase + "intro.info"), 370));
|
||||
|
||||
List<IPage> speedPages = new ArrayList<IPage>();
|
||||
category.addEntry("ash", new EntryText(keyBase + "ash", true));
|
||||
category.getEntry("ash").addPage(BookUtils.getForgeRecipe(new ItemStack(RegistrarBloodMagicItems.ARCANE_ASHES)));
|
||||
category.getEntry("ash").addPageList(PageHelper.pagesForLongText(I18n.format(keyBase + "ash.info"), 370));
|
||||
|
||||
PageAlchemyArray speedRecipePage = BookUtils.getAlchemyPage("movement");
|
||||
if (speedRecipePage != null) {
|
||||
speedPages.add(speedRecipePage);
|
||||
}
|
||||
speedPages.addAll(PageHelper.pagesForLongText(TextHelper.localize(keyBase + "speed" + ".info"), 370));
|
||||
entries.put(new ResourceLocation(keyBase + "speed"), new EntryText(speedPages, TextHelper.localize(keyBase + "speed"), true));
|
||||
category.addEntry("speed", new EntryText(keyBase + "speed", true));
|
||||
category.getEntry("speed").addPage(BookUtils.getAlchemyPage("movement"));
|
||||
category.getEntry("speed").addPageList(PageHelper.pagesForLongText(I18n.format(keyBase + "speed.info"), 370));
|
||||
|
||||
List<IPage> updraftPages = new ArrayList<IPage>();
|
||||
category.addEntry("updraft", new EntryText(keyBase + "updraft", true));
|
||||
category.getEntry("updraft").addPage(BookUtils.getAlchemyPage("updraft"));
|
||||
category.getEntry("updraft").addPageList(PageHelper.pagesForLongText(I18n.format(keyBase + "updraft.info"), 370));
|
||||
|
||||
PageAlchemyArray updraftRecipePage = BookUtils.getAlchemyPage("updraft");
|
||||
if (updraftRecipePage != null) {
|
||||
updraftPages.add(updraftRecipePage);
|
||||
}
|
||||
updraftPages.addAll(PageHelper.pagesForLongText(TextHelper.localize(keyBase + "updraft" + ".info"), 370));
|
||||
entries.put(new ResourceLocation(keyBase + "updraft"), new EntryText(updraftPages, TextHelper.localize(keyBase + "updraft"), true));
|
||||
category.addEntry("turret", new EntryText(keyBase + "turret", true));
|
||||
category.getEntry("turret").addPage(BookUtils.getAlchemyPage("skeletonTurret"));
|
||||
category.getEntry("turret").addPageList(PageHelper.pagesForLongText(I18n.format(keyBase + "turret.info"), 370));
|
||||
|
||||
List<IPage> turretPages = new ArrayList<IPage>();
|
||||
category.addEntry("bounce", new EntryText(keyBase + "bounce", true));
|
||||
category.getEntry("bounce").addPage(BookUtils.getAlchemyPage("bounce"));
|
||||
category.getEntry("bounce").addPageList(PageHelper.pagesForLongText(I18n.format(keyBase + "bounce.info"), 370));
|
||||
|
||||
PageAlchemyArray turretRecipePage = BookUtils.getAlchemyPage("skeletonTurret");
|
||||
if (turretRecipePage != null) {
|
||||
turretPages.add(turretRecipePage);
|
||||
}
|
||||
turretPages.addAll(PageHelper.pagesForLongText(TextHelper.localize(keyBase + "turret" + ".info"), 370));
|
||||
entries.put(new ResourceLocation(keyBase + "turret"), new EntryText(turretPages, TextHelper.localize(keyBase + "turret"), true));
|
||||
category.addEntry("buff", new EntryText(keyBase + "buff", true));
|
||||
category.getEntry("buff").addPage(BookUtils.getAlchemyPage("buff"));
|
||||
category.getEntry("buff").addPageList(PageHelper.pagesForLongText(I18n.format(keyBase + "buff.info"), 370));
|
||||
|
||||
List<IPage> bouncePages = new ArrayList<IPage>();
|
||||
category.addEntry("fastMiner", new EntryText(keyBase + "fastMiner", true));
|
||||
category.getEntry("fastMiner").addPage(BookUtils.getAlchemyPage("fastMiner"));
|
||||
category.getEntry("fastMiner").addPageList(PageHelper.pagesForLongText(I18n.format(keyBase + "fastMiner.info"), 370));
|
||||
|
||||
PageAlchemyArray bounceRecipePage = BookUtils.getAlchemyPage("bounce");
|
||||
if (bounceRecipePage != null) {
|
||||
bouncePages.add(bounceRecipePage);
|
||||
}
|
||||
bouncePages.addAll(PageHelper.pagesForLongText(TextHelper.localize(keyBase + "bounce" + ".info"), 370));
|
||||
entries.put(new ResourceLocation(keyBase + "bounce"), new EntryText(bouncePages, TextHelper.localize(keyBase + "bounce"), true));
|
||||
book.addCategory(category);
|
||||
|
||||
List<IPage> buffPages = new ArrayList<IPage>();
|
||||
|
||||
buffPages.addAll(PageHelper.pagesForLongText(TextHelper.localize(keyBase + "buff" + ".info"), 370));
|
||||
entries.put(new ResourceLocation(keyBase + "buff"), new EntryText(buffPages, TextHelper.localize(keyBase + "buff"), true));
|
||||
|
||||
List<IPage> fastMinerPages = new ArrayList<IPage>();
|
||||
|
||||
PageAlchemyArray fastMinerRecipePage = BookUtils.getAlchemyPage("fastMiner");
|
||||
if (fastMinerRecipePage != null) {
|
||||
fastMinerPages.add(fastMinerRecipePage);
|
||||
}
|
||||
fastMinerPages.addAll(PageHelper.pagesForLongText(TextHelper.localize(keyBase + "fastMiner" + ".info"), 370));
|
||||
entries.put(new ResourceLocation(keyBase + "fastMiner"), new EntryText(fastMinerPages, TextHelper.localize(keyBase + "fastMiner"), true));
|
||||
|
||||
for (Entry<ResourceLocation, EntryAbstract> entry : entries.entrySet()) {
|
||||
for (IPage page : entry.getValue().pageList) {
|
||||
for (EntryAbstract entry : category.entries.values()) {
|
||||
for (IPage page : entry.pageList) {
|
||||
if (page instanceof PageText) {
|
||||
((PageText) page).setUnicodeFlag(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return entries;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,222 +16,103 @@ import WayofTime.bloodmagic.item.ItemComponent;
|
|||
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.impl.Book;
|
||||
import amerifrance.guideapi.api.util.PageHelper;
|
||||
import amerifrance.guideapi.category.CategoryItemStack;
|
||||
import amerifrance.guideapi.page.PageJsonRecipe;
|
||||
import amerifrance.guideapi.page.PageText;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
public class CategoryArchitect {
|
||||
public static Map<ResourceLocation, EntryAbstract> buildCategory() {
|
||||
Map<ResourceLocation, EntryAbstract> entries = new LinkedHashMap<ResourceLocation, EntryAbstract>();
|
||||
String keyBase = "guide." + BloodMagic.MODID + ".entry.architect.";
|
||||
|
||||
List<IPage> introPages = new ArrayList<IPage>();
|
||||
introPages.addAll(PageHelper.pagesForLongText(TextHelper.localize(keyBase + "intro" + ".info"), 370));
|
||||
// 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"), true));
|
||||
public static void buildCategory(Book book) {
|
||||
final String keyBase = "guide." + BloodMagic.MODID + ".entry.architect.";
|
||||
CategoryItemStack category = new CategoryItemStack(keyBase + "architect", new ItemStack(RegistrarBloodMagicItems.SIGIL_DIVINATION));
|
||||
category.withKeyBase(BloodMagic.MODID);
|
||||
|
||||
List<IPage> altarPages = new ArrayList<IPage>();
|
||||
category.addEntry("intro", new EntryText(keyBase + "intro", true));
|
||||
category.getEntry("intro").addPageList(PageHelper.pagesForLongText(I18n.format(keyBase + "intro.info"), 370));
|
||||
|
||||
IRecipe altarRecipe = RecipeHelper.getRecipeForOutput(new ItemStack(RegistrarBloodMagicBlocks.ALTAR));
|
||||
if (altarRecipe != null) {
|
||||
altarPages.add(BookUtils.getPageForRecipe(altarRecipe));
|
||||
}
|
||||
category.addEntry("bloodaltar", new EntryText(keyBase + "bloodaltar", true));
|
||||
category.getEntry("bloodaltar").addPage(new PageJsonRecipe(new ResourceLocation(BloodMagic.MODID, "altar")));
|
||||
category.getEntry("bloodaltar").addPageList(PageHelper.pagesForLongText(I18n.format(keyBase + "bloodaltar.info.1"), 370));
|
||||
category.getEntry("bloodaltar").addPage(new PageJsonRecipe(new ResourceLocation(BloodMagic.MODID, "sacrificial_dagger")));
|
||||
category.getEntry("bloodaltar").addPageList(PageHelper.pagesForLongText(I18n.format(keyBase + "bloodaltar.info.2"), 370));
|
||||
|
||||
altarPages.addAll(PageHelper.pagesForLongText(TextHelper.localize(keyBase + "bloodaltar" + ".info.1"), 370));
|
||||
category.addEntry("ash", new EntryText(keyBase + "ash", true));
|
||||
category.getEntry("ash").addPage(BookUtils.getForgeRecipe(new ItemStack(RegistrarBloodMagicItems.ARCANE_ASHES)));
|
||||
category.getEntry("ash").addPageList(PageHelper.pagesForLongText(I18n.format(keyBase + "ash.info"), 370));
|
||||
|
||||
IRecipe daggerRecipe = RecipeHelper.getRecipeForOutput(new ItemStack(RegistrarBloodMagicItems.SACRIFICIAL_DAGGER));
|
||||
if (daggerRecipe != null) {
|
||||
altarPages.add(BookUtils.getPageForRecipe(daggerRecipe));
|
||||
}
|
||||
category.addEntry("divination", new EntryText(keyBase + "divination", true));
|
||||
category.getEntry("divination").addPage(BookUtils.getAlchemyPage(new ItemStack(RegistrarBloodMagicItems.SIGIL_DIVINATION)));
|
||||
category.getEntry("divination").addPageList(PageHelper.pagesForLongText(I18n.format(keyBase + "divination.info")));
|
||||
|
||||
altarPages.addAll(PageHelper.pagesForLongText(TextHelper.localize(keyBase + "bloodaltar" + ".info.2"), 370));
|
||||
entries.put(new ResourceLocation(keyBase + "bloodaltar"), new EntryText(altarPages, TextHelper.localize(keyBase + "bloodaltar"), true));
|
||||
category.addEntry("soulnetwork", new EntryText(keyBase + "soulnetwork", true));
|
||||
category.getEntry("soulnetwork").addPageList(PageHelper.pagesForLongText(I18n.format(keyBase + "soulnetwork.info")));
|
||||
|
||||
List<IPage> ashPages = new ArrayList<IPage>();
|
||||
category.addEntry("weakorb", new EntryText(keyBase + "weakorb", true));
|
||||
category.getEntry("weakorb").addPageList(PageHelper.pagesForLongText(I18n.format(keyBase + "weakorb.info1"), 370));
|
||||
category.getEntry("weakorb").addPage(BookUtils.getAltarPage(OrbRegistry.getOrbStack(RegistrarBloodMagic.ORB_WEAK)));
|
||||
category.getEntry("weakorb").addPageList(PageHelper.pagesForLongText(I18n.format(keyBase + "weakorb.info2"), 370));
|
||||
|
||||
TartaricForgeRecipe ashRecipe = RecipeHelper.getForgeRecipeForOutput(new ItemStack(RegistrarBloodMagicItems.ARCANE_ASHES));
|
||||
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));
|
||||
category.addEntry("incense", new EntryText(keyBase + "incense", true));
|
||||
category.getEntry("incense").addPage(new PageJsonRecipe(new ResourceLocation(BloodMagic.MODID, "incense_altar")));
|
||||
category.getEntry("incense").addPageList(PageHelper.pagesForLongText(I18n.format(keyBase + "incense.info.1"), 370));
|
||||
category.getEntry("incense").addPage(new PageJsonRecipe(new ResourceLocation(BloodMagic.MODID, "path_wood")));
|
||||
category.getEntry("incense").addPageList(PageHelper.pagesForLongText(I18n.format(keyBase + "incense.info.2"), 370));
|
||||
|
||||
List<IPage> divinationPages = new ArrayList<IPage>();
|
||||
category.addEntry("bloodrune", new EntryText(keyBase + "bloodrune", true));
|
||||
category.getEntry("bloodrune").addPage(new PageJsonRecipe(new ResourceLocation(BloodMagic.MODID, "blood_rune_blank")));
|
||||
category.getEntry("bloodrune").addPageList(PageHelper.pagesForLongText(I18n.format(keyBase + "bloodrune.info.1"), 370));
|
||||
|
||||
PageAlchemyArray divinationRecipePage = BookUtils.getAlchemyPage(new ItemStack(RegistrarBloodMagicItems.SIGIL_DIVINATION));
|
||||
if (divinationRecipePage != null) {
|
||||
divinationPages.add(divinationRecipePage);
|
||||
}
|
||||
category.addEntry("inspectoris", new EntryText(keyBase + "inspectoris", true));
|
||||
category.getEntry("inspectoris").addPage(BookUtils.getAltarPage(new ItemStack(RegistrarBloodMagicItems.SANGUINE_BOOK)));
|
||||
category.getEntry("inspectoris").addPageList(PageHelper.pagesForLongText(I18n.format(keyBase + "inspectoris.info.1"), 370));
|
||||
|
||||
divinationPages.addAll(PageHelper.pagesForLongText(TextHelper.localize(keyBase + "divination" + ".info"), 370));
|
||||
entries.put(new ResourceLocation(keyBase + "divination"), new EntryText(divinationPages, TextHelper.localize(keyBase + "divination"), true));
|
||||
category.addEntry("runeSpeed", new EntryText(keyBase + "runeSpeed", true));
|
||||
category.getEntry("runeSpeed").addPage(BookUtils.getAltarPage(new ItemStack(RegistrarBloodMagicBlocks.BLOOD_RUNE, 1, 1)));
|
||||
category.getEntry("runeSpeed").addPageList(PageHelper.pagesForLongText(I18n.format(keyBase + "runeSpeed.info.1"), 370));
|
||||
|
||||
List<IPage> soulnetworkPages = new ArrayList<IPage>();
|
||||
category.addEntry("water", new EntryText(keyBase + "water", true));
|
||||
category.getEntry("water").addPage(BookUtils.getForgeRecipe(ItemComponent.getStack(ItemComponent.REAGENT_WATER)));
|
||||
category.getEntry("water").addPage(BookUtils.getAlchemyPage(new ItemStack(RegistrarBloodMagicItems.SIGIL_WATER)));
|
||||
category.getEntry("water").addPageList(PageHelper.pagesForLongText(I18n.format(keyBase + "water.info.1"), 370));
|
||||
|
||||
soulnetworkPages.addAll(PageHelper.pagesForLongText(TextHelper.localize(keyBase + "soulnetwork" + ".info"), 370));
|
||||
entries.put(new ResourceLocation(keyBase + "soulnetwork"), new EntryText(soulnetworkPages, TextHelper.localize(keyBase + "soulnetwork"), true));
|
||||
category.addEntry("lava", new EntryText(keyBase + "lava", true));
|
||||
category.getEntry("lava").addPage(BookUtils.getForgeRecipe(ItemComponent.getStack(ItemComponent.REAGENT_LAVA)));
|
||||
category.getEntry("lava").addPage(BookUtils.getAlchemyPage(new ItemStack(RegistrarBloodMagicItems.SIGIL_LAVA)));
|
||||
category.getEntry("lava").addPageList(PageHelper.pagesForLongText(I18n.format(keyBase + "lava.info.1"), 370));
|
||||
|
||||
List<IPage> weakorbPages = new ArrayList<IPage>();
|
||||
weakorbPages.addAll(PageHelper.pagesForLongText(TextHelper.localize(keyBase + "weakorb" + ".info.1"), 370));
|
||||
category.addEntry("lavaCrystal", new EntryText(keyBase + "lavaCrystal", true));
|
||||
category.getEntry("lavaCrystal").addPage(new PageJsonRecipe(new ResourceLocation(BloodMagic.MODID, "lava_crystal")));
|
||||
category.getEntry("lavaCrystal").addPageList(PageHelper.pagesForLongText(I18n.format(keyBase + "lavaCrystal.info.1"), 370));
|
||||
|
||||
AltarRecipe weakorbRecipe = RecipeHelper.getAltarRecipeForOutput(OrbRegistry.getOrbStack(RegistrarBloodMagic.ORB_WEAK));
|
||||
if (weakorbRecipe != null) {
|
||||
weakorbPages.add(new PageAltarRecipe(weakorbRecipe));
|
||||
}
|
||||
category.addEntry("apprenticeorb", new EntryText(keyBase + "apprenticeorb", true));
|
||||
category.getEntry("apprenticeorb").addPage(BookUtils.getAltarPage(OrbRegistry.getOrbStack(RegistrarBloodMagic.ORB_APPRENTICE)));
|
||||
category.getEntry("apprenticeorb").addPageList(PageHelper.pagesForLongText(I18n.format(keyBase + "apprenticeorb.info.1"), 370));
|
||||
|
||||
weakorbPages.addAll(PageHelper.pagesForLongText(TextHelper.localize(keyBase + "weakorb" + ".info.2"), 370));
|
||||
entries.put(new ResourceLocation(keyBase + "weakorb"), new EntryText(weakorbPages, TextHelper.localize(keyBase + "weakorb"), true));
|
||||
category.addEntry("dagger", new EntryText(keyBase + "dagger", true));
|
||||
category.getEntry("dagger").addPage(BookUtils.getAltarPage(new ItemStack(RegistrarBloodMagicItems.DAGGER_OF_SACRIFICE)));
|
||||
category.getEntry("dagger").addPageList(PageHelper.pagesForLongText(I18n.format(keyBase + "dagger.info.1"), 370));
|
||||
|
||||
List<IPage> incensePages = new ArrayList<IPage>();
|
||||
category.addEntry("runeSacrifice", new EntryText(keyBase + "runeSacrifice", true));
|
||||
category.getEntry("runeSacrifice").addPage(new PageJsonRecipe(new ResourceLocation(BloodMagic.MODID, "blood_rune_sacrifice")));
|
||||
category.getEntry("runeSacrifice").addPageList(PageHelper.pagesForLongText(I18n.format(keyBase + "runeSacrifice.info.1"), 370));
|
||||
|
||||
IRecipe incenseRecipe = RecipeHelper.getRecipeForOutput(new ItemStack(RegistrarBloodMagicBlocks.INCENSE_ALTAR));
|
||||
if (incenseRecipe != null) {
|
||||
incensePages.add(BookUtils.getPageForRecipe(incenseRecipe));
|
||||
}
|
||||
category.addEntry("runeSelfSacrifice", new EntryText(keyBase + "runeSelfSacrifice", true));
|
||||
category.getEntry("runeSelfSacrifice").addPage(new PageJsonRecipe(new ResourceLocation(BloodMagic.MODID, "blood_rune_selfsacrifice")));
|
||||
category.getEntry("runeSelfSacrifice").addPageList(PageHelper.pagesForLongText(I18n.format(keyBase + "runeSelfSacrifice.info.1"), 370));
|
||||
|
||||
incensePages.addAll(PageHelper.pagesForLongText(TextHelper.localize(keyBase + "incense" + ".info.1"), 370));
|
||||
|
||||
IRecipe woodPathRecipe = RecipeHelper.getRecipeForOutput(new ItemStack(RegistrarBloodMagicBlocks.PATH, 1, 0));
|
||||
if (woodPathRecipe != null) {
|
||||
incensePages.add(BookUtils.getPageForRecipe(woodPathRecipe));
|
||||
}
|
||||
|
||||
incensePages.addAll(PageHelper.pagesForLongText(TextHelper.localize(keyBase + "incense" + ".info.2"), 370));
|
||||
entries.put(new ResourceLocation(keyBase + "incense"), new EntryText(incensePages, TextHelper.localize(keyBase + "incense"), true));
|
||||
|
||||
List<IPage> runePages = new ArrayList<IPage>();
|
||||
|
||||
IRecipe runeRecipe = RecipeHelper.getRecipeForOutput(new ItemStack(RegistrarBloodMagicBlocks.BLOOD_RUNE, 1, 0));
|
||||
if (runeRecipe != null) {
|
||||
runePages.add(BookUtils.getPageForRecipe(runeRecipe));
|
||||
}
|
||||
|
||||
runePages.addAll(PageHelper.pagesForLongText(TextHelper.localize(keyBase + "bloodrune" + ".info.1"), 370));
|
||||
entries.put(new ResourceLocation(keyBase + "bloodrune"), new EntryText(runePages, TextHelper.localize(keyBase + "bloodrune"), true));
|
||||
|
||||
List<IPage> inspectPages = new ArrayList<IPage>();
|
||||
|
||||
AltarRecipe inspectRecipe = RecipeHelper.getAltarRecipeForOutput(new ItemStack(RegistrarBloodMagicItems.SANGUINE_BOOK));
|
||||
if (inspectRecipe != null) {
|
||||
inspectPages.add(new PageAltarRecipe(inspectRecipe));
|
||||
}
|
||||
|
||||
inspectPages.addAll(PageHelper.pagesForLongText(TextHelper.localize(keyBase + "inspectoris" + ".info.1"), 370));
|
||||
entries.put(new ResourceLocation(keyBase + "inspectoris"), new EntryText(inspectPages, TextHelper.localize(keyBase + "inspectoris"), true));
|
||||
|
||||
List<IPage> speedRunePages = new ArrayList<IPage>();
|
||||
|
||||
IRecipe speedRecipe = RecipeHelper.getRecipeForOutput(new ItemStack(RegistrarBloodMagicBlocks.BLOOD_RUNE, 1, 1));
|
||||
if (speedRecipe != null) {
|
||||
speedRunePages.add(BookUtils.getPageForRecipe(speedRecipe));
|
||||
}
|
||||
|
||||
speedRunePages.addAll(PageHelper.pagesForLongText(TextHelper.localize(keyBase + "runeSpeed" + ".info.1"), 370));
|
||||
entries.put(new ResourceLocation(keyBase + "runeSpeed"), new EntryText(speedRunePages, TextHelper.localize(keyBase + "runeSpeed"), true));
|
||||
|
||||
List<IPage> waterPages = new ArrayList<IPage>();
|
||||
|
||||
TartaricForgeRecipe waterRecipe = RecipeHelper.getForgeRecipeForOutput(ItemComponent.getStack(ItemComponent.REAGENT_WATER));
|
||||
if (waterRecipe != null) {
|
||||
waterPages.add(new PageTartaricForgeRecipe(waterRecipe));
|
||||
}
|
||||
|
||||
PageAlchemyArray waterRecipePage = BookUtils.getAlchemyPage(new ItemStack(RegistrarBloodMagicItems.SIGIL_WATER));
|
||||
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));
|
||||
|
||||
List<IPage> lavaPages = new ArrayList<IPage>();
|
||||
|
||||
TartaricForgeRecipe lavaRecipe = RecipeHelper.getForgeRecipeForOutput(ItemComponent.getStack(ItemComponent.REAGENT_LAVA));
|
||||
if (lavaRecipe != null) {
|
||||
lavaPages.add(new PageTartaricForgeRecipe(lavaRecipe));
|
||||
}
|
||||
|
||||
PageAlchemyArray lavaRecipePage = BookUtils.getAlchemyPage(new ItemStack(RegistrarBloodMagicItems.SIGIL_LAVA));
|
||||
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));
|
||||
|
||||
List<IPage> lavaCrystalPages = new ArrayList<IPage>();
|
||||
|
||||
IRecipe lavaCrystalRecipe = RecipeHelper.getRecipeForOutput(new ItemStack(RegistrarBloodMagicItems.LAVA_CRYSTAL));
|
||||
if (lavaCrystalRecipe != null) {
|
||||
lavaCrystalPages.add(BookUtils.getPageForRecipe(lavaCrystalRecipe));
|
||||
}
|
||||
|
||||
lavaCrystalPages.addAll(PageHelper.pagesForLongText(TextHelper.localize(keyBase + "lavaCrystal" + ".info.1"), 370));
|
||||
entries.put(new ResourceLocation(keyBase + "lavaCrystal"), new EntryText(lavaCrystalPages, TextHelper.localize(keyBase + "lavaCrystal"), true));
|
||||
|
||||
List<IPage> apprenticeorbPages = new ArrayList<IPage>();
|
||||
|
||||
AltarRecipe apprenticeorbRecipe = RecipeHelper.getAltarRecipeForOutput(OrbRegistry.getOrbStack(RegistrarBloodMagic.ORB_APPRENTICE));
|
||||
if (apprenticeorbRecipe != null) {
|
||||
apprenticeorbPages.add(new PageAltarRecipe(apprenticeorbRecipe));
|
||||
}
|
||||
|
||||
apprenticeorbPages.addAll(PageHelper.pagesForLongText(TextHelper.localize(keyBase + "apprenticeorb" + ".info.1"), 370));
|
||||
entries.put(new ResourceLocation(keyBase + "apprenticeorb"), new EntryText(apprenticeorbPages, TextHelper.localize(keyBase + "apprenticeorb"), true));
|
||||
|
||||
List<IPage> daggerPages = new ArrayList<IPage>();
|
||||
|
||||
AltarRecipe daggerOfSacrificeRecipe = RecipeHelper.getAltarRecipeForOutput(new ItemStack(RegistrarBloodMagicItems.DAGGER_OF_SACRIFICE));
|
||||
if (daggerOfSacrificeRecipe != null) {
|
||||
daggerPages.add(new PageAltarRecipe(daggerOfSacrificeRecipe));
|
||||
}
|
||||
|
||||
daggerPages.addAll(PageHelper.pagesForLongText(TextHelper.localize(keyBase + "dagger" + ".info.1"), 370));
|
||||
entries.put(new ResourceLocation(keyBase + "dagger"), new EntryText(daggerPages, TextHelper.localize(keyBase + "dagger"), true));
|
||||
|
||||
List<IPage> runeSacrificePages = new ArrayList<IPage>();
|
||||
|
||||
IRecipe runeSacrificeRecipe = RecipeHelper.getRecipeForOutput(new ItemStack(RegistrarBloodMagicBlocks.BLOOD_RUNE, 1, 3));
|
||||
if (runeSacrificeRecipe != null) {
|
||||
runeSacrificePages.add(BookUtils.getPageForRecipe(runeSacrificeRecipe));
|
||||
}
|
||||
|
||||
runeSacrificePages.addAll(PageHelper.pagesForLongText(TextHelper.localize(keyBase + "runeSacrifice" + ".info.1"), 370));
|
||||
entries.put(new ResourceLocation(keyBase + "runeSacrifice"), new EntryText(runeSacrificePages, TextHelper.localize(keyBase + "runeSacrifice"), true));
|
||||
|
||||
List<IPage> runeSelfSacrificePages = new ArrayList<IPage>();
|
||||
|
||||
IRecipe runeSelfSacrificeRecipe = RecipeHelper.getRecipeForOutput(new ItemStack(RegistrarBloodMagicBlocks.BLOOD_RUNE, 1, 4));
|
||||
if (runeSelfSacrificeRecipe != null) {
|
||||
runeSelfSacrificePages.add(BookUtils.getPageForRecipe(runeSelfSacrificeRecipe));
|
||||
}
|
||||
|
||||
runeSelfSacrificePages.addAll(PageHelper.pagesForLongText(TextHelper.localize(keyBase + "runeSelfSacrifice" + ".info.1"), 370));
|
||||
entries.put(new ResourceLocation(keyBase + "runeSelfSacrifice"), new EntryText(runeSelfSacrificePages, TextHelper.localize(keyBase + "runeSelfSacrifice"), true));
|
||||
|
||||
List<IPage> holdingPages = new ArrayList<IPage>();
|
||||
|
||||
TartaricForgeRecipe holdingRecipe = RecipeHelper.getForgeRecipeForOutput(ItemComponent.getStack(ItemComponent.REAGENT_HOLDING));
|
||||
if (holdingRecipe != null) {
|
||||
holdingPages.add(new PageTartaricForgeRecipe(holdingRecipe));
|
||||
}
|
||||
|
||||
PageAlchemyArray holdingRecipePage = BookUtils.getAlchemyPage(new ItemStack(RegistrarBloodMagicItems.SIGIL_HOLDING));
|
||||
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));
|
||||
category.addEntry("holding", new EntryText(keyBase + "holding", true));
|
||||
category.getEntry("holding").addPage(BookUtils.getForgeRecipe(ItemComponent.getStack(ItemComponent.REAGENT_HOLDING)));
|
||||
category.getEntry("holding").addPage(BookUtils.getAlchemyPage(new ItemStack(RegistrarBloodMagicItems.SIGIL_HOLDING)));
|
||||
category.getEntry("holding").addPageList(PageHelper.pagesForLongText(I18n.format(keyBase + "holding.info.1"), 370));
|
||||
|
||||
List<IPage> airPages = new ArrayList<IPage>();
|
||||
|
||||
|
@ -633,14 +514,8 @@ public class CategoryArchitect {
|
|||
mimicPages.addAll(PageHelper.pagesForLongText(TextHelper.localize(keyBase + "mimic" + ".info.1"), 370));
|
||||
entries.put(new ResourceLocation(keyBase + "mimic"), new EntryText(mimicPages, TextHelper.localize(keyBase + "mimic"), true));
|
||||
|
||||
for (Entry<ResourceLocation, EntryAbstract> entry : entries.entrySet()) {
|
||||
for (IPage page : entry.getValue().pageList) {
|
||||
if (page instanceof PageText) {
|
||||
((PageText) page).setUnicodeFlag(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
category.entries.values().forEach(e -> e.pageList.stream().filter(p -> p instanceof PageText).forEach(p -> ((PageText) p).setUnicodeFlag(true)));
|
||||
|
||||
return entries;
|
||||
book.addCategory(category);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import amerifrance.guideapi.api.impl.abstraction.CategoryAbstract;
|
|||
import amerifrance.guideapi.api.util.GuiHelper;
|
||||
import amerifrance.guideapi.entry.EntryResourceLocation;
|
||||
import amerifrance.guideapi.gui.GuiBase;
|
||||
import com.google.common.collect.Lists;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
@ -17,12 +18,16 @@ 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 name, boolean unicode) {
|
||||
super(pageList, name, new ResourceLocation("bloodmagicguide", "textures/gui/bullet_point.png"), unicode);
|
||||
}
|
||||
|
||||
public EntryText(List<IPage> pageList, String unlocEntryName) {
|
||||
this(pageList, unlocEntryName, false);
|
||||
public EntryText(List<IPage> pageList, String name) {
|
||||
this(pageList, name, false);
|
||||
}
|
||||
|
||||
public EntryText(String name, boolean unicode) {
|
||||
this(Lists.newArrayList(), name, unicode);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package WayofTime.bloodmagic.compat.guideapi.page;
|
||||
|
||||
import WayofTime.bloodmagic.api.ItemStackWrapper;
|
||||
import WayofTime.bloodmagic.api.registry.AltarRecipeRegistry;
|
||||
import WayofTime.bloodmagic.api_impl.recipe.RecipeBloodAltar;
|
||||
import WayofTime.bloodmagic.util.helper.TextHelper;
|
||||
import amerifrance.guideapi.api.impl.Book;
|
||||
import amerifrance.guideapi.api.impl.Page;
|
||||
|
@ -11,60 +10,91 @@ 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.creativetab.CreativeTabs;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class PageAltarRecipe extends Page {
|
||||
|
||||
public List<ItemStack> input;
|
||||
public ItemStack output;
|
||||
public int tier;
|
||||
public int bloodRequired;
|
||||
public final ItemStack[] input;
|
||||
public final ItemStack output;
|
||||
public final int tier;
|
||||
public final int bloodRequired;
|
||||
|
||||
public PageAltarRecipe(AltarRecipeRegistry.AltarRecipe recipe) {
|
||||
this.input = ItemStackWrapper.toStackList(recipe.getInput());
|
||||
private long lastCycle = -1;
|
||||
private int cycleIdx = 0;
|
||||
private Random random = new Random();
|
||||
|
||||
public PageAltarRecipe(RecipeBloodAltar recipe) {
|
||||
this.input = recipe.getInput().getMatchingStacks();
|
||||
this.output = recipe.getOutput();
|
||||
this.tier = recipe.getMinTier().toInt();
|
||||
this.tier = recipe.getMinimumTier().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("bloodmagicguide" + ":textures/gui/altar.png"));
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
mc.getTextureManager().bindTexture(new ResourceLocation("bloodmagicguide", "textures/gui/altar.png"));
|
||||
|
||||
long time = mc.world.getTotalWorldTime();
|
||||
if (lastCycle < 0 || lastCycle < time - 20) {
|
||||
if (lastCycle > 0) {
|
||||
cycleIdx++;
|
||||
cycleIdx = Math.max(0, cycleIdx);
|
||||
}
|
||||
lastCycle = mc.world.getTotalWorldTime();
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
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);
|
||||
}
|
||||
ItemStack inputStack = input[getRandomizedCycle(0, input.length)];
|
||||
GuiHelper.drawItemStack(inputStack, inputX, inputY);
|
||||
if (GuiHelper.isMouseBetween(mouseX, mouseY, inputX, inputY, 15, 15))
|
||||
guiBase.renderToolTip(inputStack, mouseX, mouseY);
|
||||
|
||||
ItemStack outputStack = output;
|
||||
if (output.isEmpty())
|
||||
outputStack = new ItemStack(Blocks.BARRIER);
|
||||
|
||||
if (output.isEmpty()) {
|
||||
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);
|
||||
}
|
||||
GuiHelper.drawItemStack(outputStack, outputX, outputY);
|
||||
if (GuiHelper.isMouseBetween(mouseX, mouseY, outputX, outputY, 15, 15))
|
||||
guiBase.renderToolTip(outputStack, outputX, outputY);
|
||||
|
||||
if (output.getItem() == Item.getItemFromBlock(Blocks.BARRIER)) {
|
||||
if (outputStack.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.tier", String.valueOf(tier)), guiLeft + guiBase.xSize / 2, guiTop + 4 * guiBase.ySize / 6, 0);
|
||||
guiBase.drawCenteredString(fontRenderer, TextHelper.localize("guide.bloodmagic.page.lp", String.valueOf(bloodRequired)), guiLeft + guiBase.xSize / 2, guiTop + 4 * guiBase.ySize / 6 + 15, 0);
|
||||
}
|
||||
|
||||
protected ItemStack getNextItem(ItemStack stack, int position) {
|
||||
NonNullList<ItemStack> subItems = NonNullList.create();
|
||||
Item item = stack.getItem();
|
||||
|
||||
item.getSubItems(CreativeTabs.SEARCH, subItems);
|
||||
return subItems.get(getRandomizedCycle(position, subItems.size()));
|
||||
}
|
||||
|
||||
protected int getRandomizedCycle(int index, int max) {
|
||||
random.setSeed(index);
|
||||
return (index + random.nextInt(max) + cycleIdx) % max;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package WayofTime.bloodmagic.compat.guideapi.page;
|
||||
|
||||
import WayofTime.bloodmagic.api.recipe.TartaricForgeRecipe;
|
||||
import WayofTime.bloodmagic.api.registry.OrbRegistry;
|
||||
import WayofTime.bloodmagic.api_impl.recipe.RecipeTartaricForge;
|
||||
import WayofTime.bloodmagic.util.helper.TextHelper;
|
||||
import amerifrance.guideapi.api.impl.Book;
|
||||
import amerifrance.guideapi.api.impl.Page;
|
||||
|
@ -9,11 +9,14 @@ 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 com.google.common.collect.Lists;
|
||||
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.item.crafting.Ingredient;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
@ -23,93 +26,72 @@ import java.util.List;
|
|||
import java.util.Random;
|
||||
|
||||
public class PageTartaricForgeRecipe extends Page {
|
||||
public List<Object> input;
|
||||
public ItemStack output;
|
||||
public int tier;
|
||||
public double minimumWill;
|
||||
public double drainedWill;
|
||||
public final List<ItemStack[]> input;
|
||||
public final ItemStack output;
|
||||
public final int tier;
|
||||
public final double minimumWill;
|
||||
public final double drainedWill;
|
||||
|
||||
private long lastCycle = -1;
|
||||
private int cycleIdx = 0;
|
||||
private Random rand = new Random();
|
||||
private Random random = new Random();
|
||||
|
||||
public PageTartaricForgeRecipe(TartaricForgeRecipe recipe) {
|
||||
this.input = recipe.getInput();
|
||||
this.output = recipe.getRecipeOutput();
|
||||
public PageTartaricForgeRecipe(RecipeTartaricForge recipe) {
|
||||
input = Lists.newArrayList();
|
||||
for (Ingredient ingredient : recipe.getInput())
|
||||
input.add(ingredient.getMatchingStacks());
|
||||
|
||||
this.output = recipe.getOutput();
|
||||
this.tier = 0;
|
||||
this.minimumWill = recipe.getMinimumSouls();
|
||||
this.drainedWill = recipe.getSoulsDrained();
|
||||
this.drainedWill = recipe.getSoulDrain();
|
||||
}
|
||||
|
||||
@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"));
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
mc.getTextureManager().bindTexture(new ResourceLocation("bloodmagicguide", "textures/gui/soulForge.png"));
|
||||
|
||||
long time = mc.world.getTotalWorldTime();
|
||||
if (lastCycle < 0 || lastCycle < time - 20) {
|
||||
if (lastCycle > 0) {
|
||||
cycleIdx++;
|
||||
cycleIdx = Math.max(0, cycleIdx);
|
||||
}
|
||||
lastCycle = mc.world.getTotalWorldTime();
|
||||
}
|
||||
|
||||
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];
|
||||
ItemStack[] 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
ItemStack drawStack = component[getRandomizedCycle(x + (y * 2), component.length)];
|
||||
GuiHelper.drawItemStack(drawStack, stackX, stackY);
|
||||
if (GuiHelper.isMouseBetween(mouseX, mouseY, stackX, stackY, 15, 15))
|
||||
guiBase.renderToolTip(drawStack, 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);
|
||||
// }
|
||||
ItemStack outputStack = output;
|
||||
if (outputStack.isEmpty())
|
||||
outputStack = new ItemStack(Blocks.BARRIER);
|
||||
|
||||
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);
|
||||
GuiHelper.drawItemStack(outputStack, outputX, outputY);
|
||||
if (GuiHelper.isMouseBetween(mouseX, mouseY, outputX, outputY, 15, 15)) {
|
||||
guiBase.renderToolTip(output, outputX, outputY);
|
||||
guiBase.renderToolTip(outputStack, outputX, outputY);
|
||||
}
|
||||
|
||||
if (output.getItem() == Item.getItemFromBlock(Blocks.BARRIER)) {
|
||||
if (outputStack.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);
|
||||
|
@ -118,8 +100,16 @@ public class PageTartaricForgeRecipe extends Page {
|
|||
guiBase.drawCenteredString(fontRenderer, TextHelper.localize("guide.bloodmagic.page.drainedWill", String.valueOf(drainedWill)), guiLeft + guiBase.xSize / 2, guiTop + 4 * guiBase.ySize / 6, 0);
|
||||
}
|
||||
|
||||
protected ItemStack getNextItem(ItemStack stack, int position) {
|
||||
NonNullList<ItemStack> subItems = NonNullList.create();
|
||||
Item item = stack.getItem();
|
||||
|
||||
item.getSubItems(item.getCreativeTab(), subItems);
|
||||
return subItems.get(getRandomizedCycle(position, subItems.size()));
|
||||
}
|
||||
|
||||
protected int getRandomizedCycle(int index, int max) {
|
||||
rand.setSeed(index);
|
||||
return (index + rand.nextInt(max) + cycleIdx) % max;
|
||||
random.setSeed(index);
|
||||
return (index + random.nextInt(max) + cycleIdx) % max;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,55 +1,15 @@
|
|||
package WayofTime.bloodmagic.util.helper;
|
||||
|
||||
import WayofTime.bloodmagic.api.recipe.TartaricForgeRecipe;
|
||||
import WayofTime.bloodmagic.api.registry.AltarRecipeRegistry;
|
||||
import WayofTime.bloodmagic.api.registry.TartaricForgeRecipeRegistry;
|
||||
import WayofTime.bloodmagic.api_impl.BloodMagicAPI;
|
||||
import WayofTime.bloodmagic.api_impl.recipe.RecipeBloodAltar;
|
||||
import WayofTime.bloodmagic.api_impl.recipe.RecipeTartaricForge;
|
||||
import WayofTime.bloodmagic.compat.guideapi.page.PageAltarRecipe;
|
||||
import WayofTime.bloodmagic.compat.guideapi.page.PageTartaricForgeRecipe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraftforge.fml.common.registry.ForgeRegistries;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class RecipeHelper {
|
||||
public static IRecipe getRecipeForOutput(ItemStack stack) {
|
||||
for (IRecipe recipe : ForgeRegistries.RECIPES.getValues()) {
|
||||
if (recipe != null) {
|
||||
ItemStack resultStack = recipe.getRecipeOutput();
|
||||
if (!resultStack.isEmpty()) {
|
||||
if (resultStack.getItem() == stack.getItem() && resultStack.getItemDamage() == stack.getItemDamage()) {
|
||||
return recipe;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static AltarRecipeRegistry.AltarRecipe getAltarRecipeForOutput(ItemStack stack) {
|
||||
for (AltarRecipeRegistry.AltarRecipe recipe : AltarRecipeRegistry.getRecipes().values()) {
|
||||
if (recipe != null && !recipe.isFillable()) {
|
||||
ItemStack resultStack = recipe.getOutput();
|
||||
if (!resultStack.isEmpty()) {
|
||||
if (resultStack.getItem() == stack.getItem() && resultStack.getItemDamage() == stack.getItemDamage()) {
|
||||
return recipe;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static TartaricForgeRecipe getForgeRecipeForOutput(ItemStack stack) {
|
||||
for (TartaricForgeRecipe recipe : TartaricForgeRecipeRegistry.getRecipeList()) {
|
||||
if (recipe != null) {
|
||||
ItemStack resultStack = recipe.getRecipeOutput();
|
||||
if (!resultStack.isEmpty()) {
|
||||
if (resultStack.getItem() == stack.getItem() && resultStack.getItemDamage() == stack.getItemDamage()) {
|
||||
return recipe;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue