Added JEI recipes for repairing Sentient Tools & Living Armor (#1606)

* Added sentient tool repair recipes to JEI.

* Added living armor repair recipes to JEI.
This commit is contained in:
Tobias 2019-05-19 15:37:21 +00:00 committed by Nick Ignoffo
parent a5a5899b7c
commit 39f1ac0c7d

View file

@ -34,9 +34,15 @@ import WayofTime.bloodmagic.util.Constants;
import WayofTime.bloodmagic.util.helper.ItemHelper.LivingUpgrades;
import mezz.jei.api.*;
import mezz.jei.api.recipe.IRecipeCategoryRegistration;
import mezz.jei.api.recipe.IRecipeWrapper;
import mezz.jei.api.recipe.IVanillaRecipeFactory;
import mezz.jei.api.recipe.VanillaRecipeCategoryUid;
import net.minecraft.item.ItemStack;
import javax.annotation.Nonnull;
import java.util.Collection;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
@JEIPlugin
@ -58,6 +64,8 @@ public class BloodMagicJEIPlugin implements IModPlugin {
registry.addRecipes(BloodMagicAPI.INSTANCE.getRecipeRegistrar().getAlchemyRecipes(), Constants.Compat.JEI_CATEGORY_ALCHEMYTABLE);
registry.addRecipes(AlchemyTableRecipeRegistry.getRecipeList(), Constants.Compat.JEI_CATEGORY_ALCHEMYTABLE);
registry.addRecipes(getAnvilRecipes(), VanillaRecipeCategoryUid.ANVIL);
registry.handleRecipes(RecipeBloodAltar.class, AltarRecipeJEI::new, Constants.Compat.JEI_CATEGORY_ALTAR);
registry.handleRecipes(RecipeTartaricForge.class, TartaricForgeRecipeJEI::new, Constants.Compat.JEI_CATEGORY_SOULFORGE);
registry.handleRecipes(RecipeAlchemyArray.class, AlchemyArrayCraftingRecipeJEI::new, Constants.Compat.JEI_CATEGORY_ALCHEMYARRAY);
@ -127,4 +135,98 @@ public class BloodMagicJEIPlugin implements IModPlugin {
new ArmourDowngradeRecipeCategory()
);
}
public Collection<IRecipeWrapper> getAnvilRecipes() {
IVanillaRecipeFactory vanillaRecipeFactory = jeiHelper.getVanillaRecipeFactory();
/* Sentient Tool repair recipes */
List<ItemStack> outputSwords = new LinkedList<>();
List<ItemStack> outputPickaxes = new LinkedList<>();
List<ItemStack> outputAxes = new LinkedList<>();
List<ItemStack> outputBows = new LinkedList<>();
List<ItemStack> outputShovels = new LinkedList<>();
List<ItemStack> inputRightSentient = new LinkedList<>();
List<List<ItemStack>> sentientOutputs = new LinkedList<>();
List<ItemStack> sentientTools = new LinkedList<>();
sentientTools.add(new ItemStack(RegistrarBloodMagicItems.SENTIENT_AXE));
sentientTools.add(new ItemStack(RegistrarBloodMagicItems.SENTIENT_PICKAXE));
sentientTools.add(new ItemStack(RegistrarBloodMagicItems.SENTIENT_BOW));
sentientTools.add(new ItemStack(RegistrarBloodMagicItems.SENTIENT_SHOVEL));
sentientTools.add(new ItemStack(RegistrarBloodMagicItems.SENTIENT_SWORD));
for (int i = 4; i > 0; i--) {
for (ItemStack j : sentientTools) {
int maxDmg = j.getMaxDamage();
j.setItemDamage(maxDmg - (maxDmg / 4) * i);
}
outputAxes.add(sentientTools.get(0).copy());
outputPickaxes.add(sentientTools.get(1).copy());
outputBows.add(sentientTools.get(2).copy());
outputShovels.add(sentientTools.get(3).copy());
outputSwords.add(sentientTools.get(4).copy());
inputRightSentient.add(new ItemStack(RegistrarBloodMagicItems.ITEM_DEMON_CRYSTAL, i));
}
sentientOutputs.add(outputAxes);
sentientOutputs.add(outputPickaxes);
sentientOutputs.add(outputBows);
sentientOutputs.add(outputShovels);
sentientOutputs.add(outputSwords);
Collection<IRecipeWrapper> collection = new LinkedList<>();
for (int i = 0; i < 5; i++) {
ItemStack inputLeft = sentientTools.get(i);
inputLeft.setItemDamage(inputLeft.getMaxDamage());
collection.add(vanillaRecipeFactory.createAnvilRecipe(inputLeft, inputRightSentient, sentientOutputs.get(i)));
}
/* Living Armor repair recipes */
List<ItemStack> outputHelmets = new LinkedList<>();
List<ItemStack> outputChestplates = new LinkedList<>();
List<ItemStack> outputLeggings = new LinkedList<>();
List<ItemStack> outputBoots = new LinkedList<>();
List<ItemStack> inputRightLiving = new LinkedList<>();
List<List<ItemStack>> livingOutputs = new LinkedList<>();
List<ItemStack> livingTools = new LinkedList<>();
livingTools.add(new ItemStack(RegistrarBloodMagicItems.LIVING_ARMOUR_HELMET));
livingTools.add(new ItemStack(RegistrarBloodMagicItems.LIVING_ARMOUR_CHEST));
livingTools.add(new ItemStack(RegistrarBloodMagicItems.LIVING_ARMOUR_LEGGINGS));
livingTools.add(new ItemStack(RegistrarBloodMagicItems.LIVING_ARMOUR_BOOTS));
for (int i = 4; i > 0; i--) {
for (ItemStack j : livingTools) {
int maxDmg = j.getMaxDamage();
j.setItemDamage(maxDmg - (maxDmg / 4) * i);
}
outputHelmets.add(livingTools.get(0).copy());
outputChestplates.add(livingTools.get(1).copy());
outputLeggings.add(livingTools.get(2).copy());
outputBoots.add(livingTools.get(3).copy());
inputRightLiving.add(new ItemStack(RegistrarBloodMagicItems.COMPONENT, i, 8));
}
livingOutputs.add(outputHelmets);
livingOutputs.add(outputChestplates);
livingOutputs.add(outputLeggings);
livingOutputs.add(outputBoots);
for (int i = 0; i < 4; i++) {
ItemStack inputLeft = livingTools.get(i);
inputLeft.setItemDamage(inputLeft.getMaxDamage());
collection.add(vanillaRecipeFactory.createAnvilRecipe(inputLeft, inputRightLiving, livingOutputs.get(i)));
}
return collection;
}
}