Updated Sanguine Scientiem. (#1730)

* Initial work on Patchouli Processors

Created Processors for Blood Altar and Hellfire Forge recipes so the upcoming Patchouli Guide will be able to show the current recipes rather than having them hard coded to the mod's defaults.

Still to do: Alchemy Array, Alchemy Table, ARC, and to clean up these first-time passes.

* Improved Altar and Hellfire Forge process

Used Switch statements where possible, and made the multiple inputs on the Hellfire Forge handled under a single entry.  Changed key "LP" to lower case (also done on template file).

* Added item input Cycle.  Created Alchemy Array, and Forge + Array Processors.

* Added Alchemy Table Processor

* Various Processor Changes.

Added ARCProcessor.

Overhauled AlchemyTableProcessor.  It now only handles one recipe at a time.  The Templates were changed to use nested templates.

ForgeAndArrayProcessor was removed and replaced with similar nested templates.

* Removed uneeded comments from ARCProcessor.

* Uploaded New Book's Content

This book was written by Wrincewind and myself on #wrincewind/Blood-Magic-Manual.

Co-Authored-By: wrincewind <1457878+wrincewind@users.noreply.github.com>

* Book updates.

Co-Authored-By: wrincewind <1457878+wrincewind@users.noreply.github.com>

Co-authored-by: wrincewind <1457878+wrincewind@users.noreply.github.com>
This commit is contained in:
VT-14 2020-12-26 14:57:15 -05:00 committed by GitHub
parent 9d18353a2e
commit 2ec58c1e60
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
132 changed files with 3517 additions and 373 deletions

View file

@ -0,0 +1,104 @@
package wayoftime.bloodmagic.compat.patchouli.processors;
import java.util.Arrays;
import java.util.stream.Collectors;
import org.apache.logging.log4j.LogManager;
import net.minecraft.client.Minecraft;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fluids.FluidStack;
import vazkii.patchouli.api.IComponentProcessor;
import vazkii.patchouli.api.IVariable;
import vazkii.patchouli.api.IVariableProvider;
import wayoftime.bloodmagic.common.recipe.BloodMagicRecipeType;
import wayoftime.bloodmagic.recipe.RecipeARC;
public class ARCProcessor implements IComponentProcessor
{
private RecipeARC recipe;
@Override
public void setup(IVariableProvider variables)
{
ResourceLocation id = new ResourceLocation(variables.get("recipe").asString());
IRecipe<?> recipe = Minecraft.getInstance().world.getRecipeManager().getRecipe(id).get();
if (recipe.getType().equals(BloodMagicRecipeType.ARC))
{
this.recipe = (RecipeARC) recipe;
}
if (this.recipe == null)
{
LogManager.getLogger().warn("Guidebook missing Alchemical Reaction Chamber recipe " + id);
}
}
@Override
public IVariable process(String key)
{
if (recipe == null)
{
return null;
} else if (key.startsWith("output"))
{
int index = Integer.parseInt(key.substring("output".length())) - 1;
if (recipe.getAllListedOutputs().size() > index)
{
return IVariable.from(recipe.getAllListedOutputs().get(index));
} else
{
return null;
}
} else if (key.startsWith("chance"))
{
int index = Integer.parseInt(key.substring("chance".length())) - 2; // Index 0 = 2nd output.
if (recipe.getAllOutputChances().length > index)
{
double chance = recipe.getAllOutputChances()[index] * 100;
if (chance < 1)
{
return IVariable.wrap("<1");
}
return IVariable.wrap(Math.round(chance));
}
} else if (key.startsWith("show_chance"))
{
int index = Integer.parseInt(key.substring("show_chance".length())) - 2; // Index 0 = 2nd output.
if (recipe.getAllOutputChances().length > index)
{
return IVariable.wrap(true);
}
}
switch (key)
{
case "show_fluid_tooltip":
if (recipe.getFluidIngredient() != null || recipe.getFluidOutput() != FluidStack.EMPTY)
{
return IVariable.wrap(true);
}
return IVariable.wrap(false);
case "input":
return IVariable.wrapList(Arrays.stream(recipe.getInput().getMatchingStacks()).map(IVariable::from).collect(Collectors.toList()));
case "tool":
return IVariable.wrapList(Arrays.stream(recipe.getTool().getMatchingStacks()).map(IVariable::from).collect(Collectors.toList()));
case "tooltip_fluid_input":
if (recipe.getFluidIngredient() != null)
{
FluidStack fluid = recipe.getFluidIngredient().getRepresentations().get(0);
return IVariable.wrap(fluid.getAmount() + "mb of " + fluid.getTranslationKey());
}
return IVariable.wrap("None");
case "tooltip_fluid_output":
if (recipe.getFluidOutput() != FluidStack.EMPTY)
{
FluidStack fluid = recipe.getFluidOutput();
return IVariable.wrap(fluid.getAmount() + "mb of " + fluid.getTranslationKey());
}
return IVariable.wrap("None");
default:
return null;
}
}
}

View file

@ -0,0 +1,56 @@
package wayoftime.bloodmagic.compat.patchouli.processors;
import java.util.Arrays;
import java.util.stream.Collectors;
import org.apache.logging.log4j.LogManager;
import net.minecraft.client.Minecraft;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.util.ResourceLocation;
import vazkii.patchouli.api.IComponentProcessor;
import vazkii.patchouli.api.IVariable;
import vazkii.patchouli.api.IVariableProvider;
import wayoftime.bloodmagic.common.recipe.BloodMagicRecipeType;
import wayoftime.bloodmagic.recipe.RecipeAlchemyArray;
public class AlchemyArrayProcessor implements IComponentProcessor
{
private RecipeAlchemyArray recipe;
@Override
public void setup(IVariableProvider variables)
{
ResourceLocation id = new ResourceLocation(variables.get("recipe").asString());
IRecipe<?> recipe = Minecraft.getInstance().world.getRecipeManager().getRecipe(id).get();
if (recipe.getType().equals(BloodMagicRecipeType.ARRAY))
{
this.recipe = (RecipeAlchemyArray) recipe;
}
if (this.recipe == null)
{
LogManager.getLogger().warn("Guidebook missing Alchemy Array recipe " + id);
}
}
@Override
public IVariable process(String key)
{
if (recipe == null)
{
return null;
}
switch (key)
{
case "baseinput":
return IVariable.wrapList(Arrays.stream(recipe.getBaseInput().getMatchingStacks()).map(IVariable::from).collect(Collectors.toList()));
case "addedinput":
return IVariable.wrapList(Arrays.stream(recipe.getAddedInput().getMatchingStacks()).map(IVariable::from).collect(Collectors.toList()));
case "output":
return IVariable.from(recipe.getOutput());
default:
return null;
}
}
}

View file

@ -0,0 +1,89 @@
package wayoftime.bloodmagic.compat.patchouli.processors;
import java.util.Arrays;
import java.util.stream.Collectors;
import org.apache.logging.log4j.LogManager;
import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.util.ResourceLocation;
import vazkii.patchouli.api.IComponentProcessor;
import vazkii.patchouli.api.IVariable;
import vazkii.patchouli.api.IVariableProvider;
import wayoftime.bloodmagic.common.item.BloodMagicItems;
import wayoftime.bloodmagic.common.recipe.BloodMagicRecipeType;
import wayoftime.bloodmagic.recipe.RecipeAlchemyTable;
public class AlchemyTableProcessor implements IComponentProcessor
{
private RecipeAlchemyTable recipe;
@Override
public void setup(IVariableProvider variables)
{
ResourceLocation id = new ResourceLocation(variables.get("recipe").asString());
IRecipe<?> recipe = Minecraft.getInstance().world.getRecipeManager().getRecipe(id).get();
if (recipe.getType().equals(BloodMagicRecipeType.ALCHEMYTABLE))
{
this.recipe = (RecipeAlchemyTable) recipe;
}
if (this.recipe == null)
{
LogManager.getLogger().warn("Guidebook missing Alchemy Table recipe " + id);
}
}
@Override
public IVariable process(String key)
{
if (recipe == null)
{
return null;
} else if (key.startsWith("input"))
{
int index = Integer.parseInt(key.substring("input".length())) - 1;
if (recipe.getInput().size() > index)
{
return IVariable.wrapList(Arrays.stream(recipe.getInput().get(index).getMatchingStacks()).map(IVariable::from).collect(Collectors.toList()));
} else
{
return null;
}
}
switch (key)
{
case "output":
return IVariable.from(recipe.getOutput());
case "syphon":
return IVariable.wrap(recipe.getSyphon());
case "time":
return IVariable.wrap(recipe.getTicks());
case "orb":
switch (recipe.getMinimumTier())
{
case 0: // same as Case 1
case 1:
return IVariable.from(new ItemStack(BloodMagicItems.WEAK_BLOOD_ORB.get()));
case 2:
return IVariable.from(new ItemStack(BloodMagicItems.APPRENTICE_BLOOD_ORB.get()));
case 3:
return IVariable.from(new ItemStack(BloodMagicItems.MAGICIAN_BLOOD_ORB.get()));
case 4:
return IVariable.from(new ItemStack(BloodMagicItems.MASTER_BLOOD_ORB.get()));
// case 5: return IVariable.from(new
// ItemStack(BloodMagicItems.ARCHMAGES_BLOOD_ORB.get()));
// case 6: return IVariable.from(new
// ItemStack(BloodMagicItems.TRANSCENDENT_BLOOD_ORB.get()));
default:
LogManager.getLogger().warn("Guidebook unable to find large enough Blood Orb for " + recipe.getId());
return IVariable.from(new ItemStack(Items.BARRIER));
}
default:
return null;
}
}
}

View file

@ -0,0 +1,58 @@
package wayoftime.bloodmagic.compat.patchouli.processors;
import java.util.Arrays;
import java.util.stream.Collectors;
import org.apache.logging.log4j.LogManager;
import net.minecraft.client.Minecraft;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.util.ResourceLocation;
import vazkii.patchouli.api.IComponentProcessor;
import vazkii.patchouli.api.IVariable;
import vazkii.patchouli.api.IVariableProvider;
import wayoftime.bloodmagic.common.recipe.BloodMagicRecipeType;
import wayoftime.bloodmagic.recipe.RecipeBloodAltar;
public class BloodAltarProcessor implements IComponentProcessor
{
private RecipeBloodAltar recipe;
@Override
public void setup(IVariableProvider variables)
{
ResourceLocation id = new ResourceLocation(variables.get("recipe").asString());
IRecipe<?> recipe = Minecraft.getInstance().world.getRecipeManager().getRecipe(id).get();
if (recipe.getType().equals(BloodMagicRecipeType.ALTAR))
{
this.recipe = (RecipeBloodAltar) recipe;
}
if (this.recipe == null)
{
LogManager.getLogger().warn("Guidebook missing Blood Altar recipe " + id);
}
}
@Override
public IVariable process(String key)
{
if (recipe == null)
{
return null;
}
switch (key)
{
case "input":
return IVariable.wrapList(Arrays.stream(recipe.getInput().getMatchingStacks()).map(IVariable::from).collect(Collectors.toList()));
case "output":
return IVariable.from(recipe.getOutput());
case "tier":
return IVariable.wrap(recipe.getMinimumTier() + 1);
case "lp":
return IVariable.wrap(recipe.getSyphon());
default:
return null;
}
}
}

View file

@ -0,0 +1,95 @@
package wayoftime.bloodmagic.compat.patchouli.processors;
import java.util.Arrays;
import java.util.stream.Collectors;
import org.apache.logging.log4j.LogManager;
import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.util.ResourceLocation;
import vazkii.patchouli.api.IComponentProcessor;
import vazkii.patchouli.api.IVariable;
import vazkii.patchouli.api.IVariableProvider;
import wayoftime.bloodmagic.common.item.BloodMagicItems;
import wayoftime.bloodmagic.common.recipe.BloodMagicRecipeType;
import wayoftime.bloodmagic.recipe.RecipeTartaricForge;
public class TartaricForgeProcessor implements IComponentProcessor
{
private RecipeTartaricForge recipe;
@Override
public void setup(IVariableProvider variables)
{
ResourceLocation id = new ResourceLocation(variables.get("recipe").asString());
IRecipe<?> recipe = Minecraft.getInstance().world.getRecipeManager().getRecipe(id).get();
if (recipe.getType().equals(BloodMagicRecipeType.TARTARICFORGE))
{
this.recipe = (RecipeTartaricForge) recipe;
}
if (this.recipe == null)
{
LogManager.getLogger().warn("Guidebook missing Hellfire Forge recipe " + id);
}
}
@Override
public IVariable process(String key)
{
if (recipe == null)
{
return null;
}
if (key.startsWith("input"))
{
int index = Integer.parseInt(key.substring("input".length())) - 1;
if (recipe.getInput().size() > index)
{
return IVariable.wrapList(Arrays.stream(recipe.getInput().get(index).getMatchingStacks()).map(IVariable::from).collect(Collectors.toList()));
} else
{
return null;
}
}
switch (key)
{
case "output":
return IVariable.from(recipe.getOutput());
case "willrequired":
return IVariable.wrap(recipe.getMinimumSouls());
case "willdrain":
return IVariable.wrap(recipe.getSoulDrain());
case "will":
if (recipe.getMinimumSouls() <= 1)
{
return IVariable.from(new ItemStack(BloodMagicItems.MONSTER_SOUL_RAW.get()));
} else if (recipe.getMinimumSouls() <= 64)
{
return IVariable.from(new ItemStack(BloodMagicItems.PETTY_GEM.get()));
} else if (recipe.getMinimumSouls() <= 256)
{
return IVariable.from(new ItemStack(BloodMagicItems.LESSER_GEM.get()));
} else if (recipe.getMinimumSouls() <= 1024)
{
return IVariable.from(new ItemStack(BloodMagicItems.COMMON_GEM.get()));
} else if (recipe.getMinimumSouls() <= 4096)
{
return IVariable.from(new ItemStack(BloodMagicItems.GREATER_GEM.get()));
// } else if (recipe.getMinimumSouls() <= 16384) {
// return IVariable.from(new ItemStack(BloodMagicItems.GRAND_GEM.get()));
// }
} else
{
LogManager.getLogger().warn("Guidebook could not find a large enough Tartaric Gem for " + recipe.getId());
return IVariable.from(new ItemStack(Items.BARRIER));
}
default:
return null;
}
}
}