This commit is contained in:
Jared 2016-08-28 16:16:56 +02:00
parent b548e77eac
commit 4ebb12efe6
3 changed files with 31 additions and 9 deletions

View file

@ -25,7 +25,7 @@ public abstract class ForestryListAddition<T extends IForestryRecipe, C extends
protected abstract String getRecipeInfo(T recipe);
@Override
public final void apply() {
public void apply() {
for (T recipe : recipes) {
if (recipe != null) {
if (craftingProvider.addRecipe(recipe)) {

View file

@ -20,7 +20,7 @@ public abstract class ForestryListRemoval<T extends IForestryRecipe, C extends I
protected abstract String getRecipeInfo(T recipe);
@Override
public final void apply() {
public void apply() {
for (T recipe : recipes) {
if (recipe != null) {
if (craftingProvider.removeRecipe(recipe)) {

View file

@ -4,6 +4,7 @@ import forestry.api.recipes.ICarpenterManager;
import forestry.api.recipes.ICarpenterRecipe;
import forestry.api.recipes.IDescriptiveRecipe;
import forestry.api.recipes.RecipeManagers;
import forestry.factory.recipes.CarpenterRecipeManager;
import minetweaker.MineTweakerAPI;
import minetweaker.api.item.IIngredient;
import minetweaker.api.item.IItemStack;
@ -34,12 +35,12 @@ public class Carpenter {
/**
* Adds shaped recipe to Carpenter
*
* @param output recipe product
* @param ingredients required ingredients
* @param packagingTime amount of ticks per crafting operation
** @param fluidInput required mB of fluid (optional)
** @param box required box in top slot (optional)
** @param remainingItems no idea (optional)
* @param output recipe product
* @param ingredients required ingredients
* @param packagingTime amount of ticks per crafting operation
* * @param fluidInput required mB of fluid (optional)
* * @param box required box in top slot (optional)
* * @param remainingItems no idea (optional)
*/
@ZenMethod
public static void addRecipe(IItemStack output, IIngredient[][] ingredients, int packagingTime, @Optional ILiquidStack fluidInput, @Optional IItemStack box, @Optional IItemStack[] remainingItems) {
@ -69,6 +70,17 @@ public class Carpenter {
recipes.add(recipe);
}
@Override
public void apply() {
super.apply();
successful.forEach(ent -> {
if (!CarpenterRecipeManager.getRecipeFluids().contains(ent.getFluidResource().getFluid())) {
CarpenterRecipeManager.getRecipeFluids().add(ent.getFluidResource().getFluid());
}
});
}
@Override
protected String getRecipeInfo(ICarpenterRecipe recipe) {
return LogHelper.getStackDescription(recipe.getCraftingGridRecipe().getRecipeOutput());
@ -93,7 +105,7 @@ public class Carpenter {
* Removes recipe from Carpenter
*
* @param output = recipe result
** @param fluidInput = required type of fluid (optional)
* * @param fluidInput = required type of fluid (optional)
*/
@ZenMethod
public static void removeRecipe(IIngredient output, @Optional IIngredient fluidInput) {
@ -126,6 +138,16 @@ public class Carpenter {
super(Carpenter.name, RecipeManagers.carpenterManager, recipes);
}
@Override
public void apply() {
super.apply();
successful.forEach(ent -> {
if (CarpenterRecipeManager.getRecipeFluids().contains(ent.getFluidResource().getFluid())) {
CarpenterRecipeManager.getRecipeFluids().remove(ent.getFluidResource().getFluid());
}
});
}
@Override
protected String getRecipeInfo(ICarpenterRecipe recipe) {
return LogHelper.getStackDescription(recipe.getCraftingGridRecipe().getRecipeOutput());