Update for Forestry 4; Forestry-Dev.jar is now included via gradle
fix #252
This commit is contained in:
parent
5e147f86b9
commit
4bea2e5fc9
11 changed files with 469 additions and 461 deletions
11
build.gradle
11
build.gradle
|
@ -37,6 +37,17 @@ minecraft {
|
|||
runDir = "eclipse"
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven {
|
||||
name = "forestry"
|
||||
url = "http://maven.ic2.player.to/"
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile "net.sengir.forestry:forestry_${config.minecraft.version}:${config.forestry.version}:dev"
|
||||
}
|
||||
|
||||
processResources
|
||||
{
|
||||
// this will ensure that this task is redone when the versions change.
|
||||
|
|
|
@ -2,3 +2,5 @@ minecraft.version=1.7.10
|
|||
forge.version=10.13.4.1448-1.7.10
|
||||
|
||||
mod.version=0.9.4
|
||||
|
||||
forestry.version=4.0.8.36
|
||||
|
|
Binary file not shown.
|
@ -2,29 +2,31 @@ package modtweaker2.mods.forestry;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import modtweaker2.helpers.ReflectionHelper;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import forestry.factory.gadgets.MachineCarpenter;
|
||||
import forestry.factory.tiles.TileCarpenter;
|
||||
|
||||
public class ForestryHelper {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static void addCarpenterRecipeBox(ItemStack box) {
|
||||
ArrayList<ItemStack> recipeBoxes = (ArrayList<ItemStack>) ReflectionHelper.getStaticObject(MachineCarpenter.RecipeManager.class, "boxes");
|
||||
|
||||
if(recipeBoxes != null) {
|
||||
recipeBoxes.add(box);
|
||||
}
|
||||
List<ItemStack> recipeBoxes = (ArrayList<ItemStack>) ReflectionHelper.getStaticObject(TileCarpenter.RecipeManager.class, "boxes");
|
||||
|
||||
if(recipeBoxes != null) {
|
||||
recipeBoxes.add(box);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static void addCarpenterRecipeFluids(Fluid newFluid) {
|
||||
HashSet<Fluid> recipeFluids = (HashSet<Fluid>) ReflectionHelper.getStaticObject(MachineCarpenter.RecipeManager.class, "recipeFluids");
|
||||
|
||||
Set<Fluid> recipeFluids = (HashSet<Fluid>) ReflectionHelper.getStaticObject(TileCarpenter.RecipeManager.class, "recipeFluids");
|
||||
|
||||
if(recipeFluids != null) {
|
||||
recipeFluids.add(newFluid);
|
||||
recipeFluids.add(newFluid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,17 +25,17 @@ import net.minecraft.item.ItemStack;
|
|||
import stanhebben.zenscript.annotations.Optional;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
import forestry.core.utils.ShapedRecipeCustom;
|
||||
import forestry.factory.gadgets.MachineCarpenter;
|
||||
import forestry.factory.gadgets.MachineCarpenter.Recipe;
|
||||
import forestry.factory.gadgets.MachineCarpenter.RecipeManager;
|
||||
import forestry.core.recipes.ShapedRecipeCustom;
|
||||
import forestry.factory.tiles.TileCarpenter;
|
||||
import forestry.factory.tiles.TileCarpenter.Recipe;
|
||||
import forestry.factory.tiles.TileCarpenter.RecipeManager;
|
||||
|
||||
@ZenClass("mods.forestry.Carpenter")
|
||||
public class Carpenter {
|
||||
|
||||
public static final String name = "Forestry Carpenter";
|
||||
|
||||
public static final String name = "Forestry Carpenter";
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Adds a shaped recipe for the Carpenter
|
||||
|
@ -83,7 +83,7 @@ public class Carpenter {
|
|||
private static class Add extends BaseListAddition<Recipe> {
|
||||
|
||||
public Add(Recipe recipe) {
|
||||
super(Carpenter.name, MachineCarpenter.RecipeManager.recipes);
|
||||
super(Carpenter.name, TileCarpenter.RecipeManager.recipes);
|
||||
recipes.add(recipe);
|
||||
|
||||
// The Carpenter has a list of valid Fluids, access them via
|
||||
|
@ -98,12 +98,12 @@ public class Carpenter {
|
|||
|
||||
@Override
|
||||
protected String getRecipeInfo(Recipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getCraftingResult());
|
||||
return LogHelper.getStackDescription(recipe.getCraftingResult());
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
/**
|
||||
* Removes a recipe for the Carpenter
|
||||
*
|
||||
|
@ -112,37 +112,35 @@ public class Carpenter {
|
|||
*/
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IIngredient output, @Optional IIngredient liquid) {
|
||||
List<Recipe> recipes = new LinkedList<Recipe>();
|
||||
|
||||
for(Recipe recipe : RecipeManager.recipes) {
|
||||
if( recipe != null && recipe.getCraftingResult() != null && matches(output, toIItemStack(recipe.getCraftingResult())) ) {
|
||||
if (liquid != null) {
|
||||
if (matches(liquid, toILiquidStack(recipe.getLiquid())))
|
||||
recipes.add(recipe);
|
||||
} else {
|
||||
recipes.add(recipe);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!recipes.isEmpty()) {
|
||||
MineTweakerAPI.apply(new Remove(recipes));
|
||||
} else {
|
||||
LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored!", Carpenter.name, output.toString()));
|
||||
}
|
||||
|
||||
List<Recipe> recipes = new LinkedList<Recipe>();
|
||||
|
||||
for(Recipe recipe : RecipeManager.recipes) {
|
||||
if( recipe != null && recipe.getCraftingResult() != null && matches(output, toIItemStack(recipe.getCraftingResult())) ) {
|
||||
if (liquid != null) {
|
||||
if (matches(liquid, toILiquidStack(recipe.getLiquid())))
|
||||
recipes.add(recipe);
|
||||
} else {
|
||||
recipes.add(recipe);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!recipes.isEmpty()) {
|
||||
MineTweakerAPI.apply(new Remove(recipes));
|
||||
} else {
|
||||
LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored!", Carpenter.name, output.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static class Remove extends BaseListRemoval<Recipe> {
|
||||
|
||||
|
||||
public Remove(List<Recipe> recipes) {
|
||||
super(Carpenter.name, RecipeManager.recipes, recipes);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getRecipeInfo(Recipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getCraftingResult());
|
||||
return LogHelper.getStackDescription(recipe.getCraftingResult());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,17 +20,17 @@ import net.minecraft.item.ItemStack;
|
|||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
import forestry.api.recipes.ICentrifugeRecipe;
|
||||
import forestry.factory.gadgets.MachineCentrifuge.CentrifugeRecipe;
|
||||
import forestry.factory.gadgets.MachineCentrifuge.RecipeManager;
|
||||
import forestry.factory.tiles.TileCentrifuge.CentrifugeRecipe;
|
||||
import forestry.factory.tiles.TileCentrifuge.RecipeManager;
|
||||
|
||||
|
||||
@ZenClass("mods.forestry.Centrifuge")
|
||||
public class Centrifuge {
|
||||
|
||||
public static final String name = "Forestry Centrifuge";
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
public static final String name = "Forestry Centrifuge";
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Adds a recipe for the Centrifuge
|
||||
*
|
||||
|
@ -46,7 +46,7 @@ public class Centrifuge {
|
|||
}
|
||||
MineTweakerAPI.apply(new Add(new CentrifugeRecipe(timePerItem, toStack(ingredient), products)));
|
||||
}
|
||||
|
||||
|
||||
@ZenMethod
|
||||
@Deprecated
|
||||
public static void addRecipe(int timePerItem, IItemStack itemInput, IItemStack[] output, int[] chances) {
|
||||
|
@ -58,53 +58,52 @@ public class Centrifuge {
|
|||
}
|
||||
MineTweakerAPI.apply(new Add(new CentrifugeRecipe(timePerItem, toStack(itemInput), products)));
|
||||
}
|
||||
|
||||
private static class Add extends BaseListAddition<ICentrifugeRecipe> {
|
||||
|
||||
public Add(ICentrifugeRecipe recipe) {
|
||||
super(Centrifuge.name, RecipeManager.recipes);
|
||||
recipes.add(recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getRecipeInfo(ICentrifugeRecipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getInput());
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
private static class Add extends BaseListAddition<ICentrifugeRecipe> {
|
||||
public Add(ICentrifugeRecipe recipe) {
|
||||
super(Centrifuge.name, RecipeManager.recipes);
|
||||
recipes.add(recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getRecipeInfo(ICentrifugeRecipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getInput());
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Removes a recipe for the Centrifuge
|
||||
*
|
||||
* @param ingredient item input
|
||||
* @param input item input
|
||||
*/
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IIngredient input) {
|
||||
List<ICentrifugeRecipe> recipes = new LinkedList<ICentrifugeRecipe>();
|
||||
|
||||
for(ICentrifugeRecipe recipe : RecipeManager.recipes) {
|
||||
if(recipe != null && matches(input, toIItemStack(recipe.getInput()))) {
|
||||
recipes.add(recipe);
|
||||
}
|
||||
}
|
||||
|
||||
if(!recipes.isEmpty()) {
|
||||
MineTweakerAPI.apply(new Remove(recipes));
|
||||
} else {
|
||||
LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored!", Centrifuge.name, input.toString()));
|
||||
}
|
||||
List<ICentrifugeRecipe> recipes = new LinkedList<ICentrifugeRecipe>();
|
||||
|
||||
for(ICentrifugeRecipe recipe : RecipeManager.recipes) {
|
||||
if(recipe != null && matches(input, toIItemStack(recipe.getInput()))) {
|
||||
recipes.add(recipe);
|
||||
}
|
||||
}
|
||||
|
||||
if(!recipes.isEmpty()) {
|
||||
MineTweakerAPI.apply(new Remove(recipes));
|
||||
} else {
|
||||
LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored!", Centrifuge.name, input.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static class Remove extends BaseListRemoval<ICentrifugeRecipe> {
|
||||
|
||||
|
||||
public Remove(List<ICentrifugeRecipe> recipes) {
|
||||
super(Centrifuge.name, RecipeManager.recipes, recipes);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected String getRecipeInfo(ICentrifugeRecipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getInput());
|
||||
return LogHelper.getStackDescription(recipe.getInput());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,17 +28,17 @@ import stanhebben.zenscript.annotations.ZenClass;
|
|||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
import forestry.api.fuels.FermenterFuel;
|
||||
import forestry.api.fuels.FuelManager;
|
||||
import forestry.factory.gadgets.MachineFermenter.Recipe;
|
||||
import forestry.factory.gadgets.MachineFermenter.RecipeManager;
|
||||
import forestry.factory.tiles.TileFermenter.Recipe;
|
||||
import forestry.factory.tiles.TileFermenter.RecipeManager;
|
||||
|
||||
@ZenClass("mods.forestry.Fermenter")
|
||||
public class Fermenter {
|
||||
|
||||
public static final String name = "Forestry Fermenter";
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
public static final String name = "Forestry Fermenter";
|
||||
public static final String nameFuel = name + " (Fuel)";
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Adds a fermenter recipe. Amount of fluid output is calculated: fermentationValue * fluidOutputModifier
|
||||
* Note: the actual consumption of fluid input depends on the fermentation fuel
|
||||
|
@ -49,17 +49,17 @@ public class Fermenter {
|
|||
* @param fermentationValue amount of inputFluid on organic item requires
|
||||
* @param fluidOutputModifier Output multiplier (this is usually a from the input fluid
|
||||
*/
|
||||
@ZenMethod
|
||||
@ZenMethod
|
||||
public static void addRecipe(ILiquidStack fluidOutput, IItemStack resource, ILiquidStack fluidInput, int fermentationValue, float fluidOutputModifier) {
|
||||
MineTweakerAPI.apply(new Add(new Recipe(toStack(resource), fermentationValue, fluidOutputModifier, toFluid(fluidOutput), toFluid(fluidInput))));
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@ZenMethod
|
||||
|
||||
@Deprecated
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack resource, ILiquidStack fluidInput, int fermentationValue, float fluidOutputModifier, ILiquidStack fluidOutput) {
|
||||
MineTweakerAPI.apply(new Add(new Recipe(toStack(resource), fermentationValue, fluidOutputModifier, toFluid(fluidOutput), toFluid(fluidInput))));
|
||||
}
|
||||
|
||||
|
||||
private static class Add extends BaseListAddition<Recipe> {
|
||||
public Add(Recipe recipe) {
|
||||
super(Fermenter.name, RecipeManager.recipes);
|
||||
|
@ -68,50 +68,50 @@ public class Fermenter {
|
|||
|
||||
@Override
|
||||
public void apply() {
|
||||
// add liquids to valid input / output
|
||||
for(Recipe recipe : successful) {
|
||||
RecipeManager.recipeFluidInputs.add(recipe.liquid.getFluid());
|
||||
RecipeManager.recipeFluidOutputs.add(recipe.output.getFluid());
|
||||
}
|
||||
|
||||
super.apply();
|
||||
// add liquids to valid input / output
|
||||
for(Recipe recipe : successful) {
|
||||
RecipeManager.recipeFluidInputs.add(recipe.liquid.getFluid());
|
||||
RecipeManager.recipeFluidOutputs.add(recipe.output.getFluid());
|
||||
}
|
||||
|
||||
super.apply();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
super.undo();
|
||||
|
||||
// Tidy up valid inputs
|
||||
for(Iterator<Fluid> iter = RecipeManager.recipeFluidInputs.iterator(); iter.hasNext();) {
|
||||
boolean found = false;
|
||||
Fluid fluid = iter.next();
|
||||
for(Recipe recipe : list) {
|
||||
if(recipe != null && recipe.liquid != null && recipe.liquid.getFluid().equals(fluid)) {
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(!found) {
|
||||
iter.remove();
|
||||
}
|
||||
}
|
||||
|
||||
// Tidy up valid outputs
|
||||
for(Iterator<Fluid> iter = RecipeManager.recipeFluidOutputs.iterator(); iter.hasNext();) {
|
||||
boolean found = false;
|
||||
Fluid fluid = iter.next();
|
||||
for(Recipe recipe : list) {
|
||||
if(recipe != null && recipe.output != null && recipe.output.getFluid().equals(fluid)) {
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(!found) {
|
||||
iter.remove();
|
||||
}
|
||||
}
|
||||
super.undo();
|
||||
|
||||
// Tidy up valid inputs
|
||||
for(Iterator<Fluid> iter = RecipeManager.recipeFluidInputs.iterator(); iter.hasNext();) {
|
||||
boolean found = false;
|
||||
Fluid fluid = iter.next();
|
||||
for(Recipe recipe : list) {
|
||||
if(recipe != null && recipe.liquid != null && recipe.liquid.getFluid().equals(fluid)) {
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(!found) {
|
||||
iter.remove();
|
||||
}
|
||||
}
|
||||
|
||||
// Tidy up valid outputs
|
||||
for(Iterator<Fluid> iter = RecipeManager.recipeFluidOutputs.iterator(); iter.hasNext();) {
|
||||
boolean found = false;
|
||||
Fluid fluid = iter.next();
|
||||
for(Recipe recipe : list) {
|
||||
if(recipe != null && recipe.output != null && recipe.output.getFluid().equals(fluid)) {
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(!found) {
|
||||
iter.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo(Recipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.output);
|
||||
|
@ -119,90 +119,89 @@ public class Fermenter {
|
|||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IIngredient input) {
|
||||
List<Recipe> recipes = new LinkedList<Recipe>();
|
||||
|
||||
for(Recipe recipe : RecipeManager.recipes) {
|
||||
// check for input items
|
||||
if(recipe != null && recipe.resource != null && matches(input, toIItemStack(recipe.resource))) {
|
||||
recipes.add(recipe);
|
||||
}
|
||||
|
||||
// check for input liquids
|
||||
if(recipe != null && recipe.resource != null && matches(input, toILiquidStack(recipe.liquid))) {
|
||||
recipes.add(recipe);
|
||||
}
|
||||
}
|
||||
|
||||
if(!recipes.isEmpty()) {
|
||||
MineTweakerAPI.apply(new Remove(recipes));
|
||||
} else {
|
||||
LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored!", Fermenter.name, input.toString()));
|
||||
}
|
||||
List<Recipe> recipes = new LinkedList<Recipe>();
|
||||
|
||||
for(Recipe recipe : RecipeManager.recipes) {
|
||||
// check for input items
|
||||
if(recipe != null && recipe.resource != null && matches(input, toIItemStack(recipe.resource))) {
|
||||
recipes.add(recipe);
|
||||
}
|
||||
|
||||
// check for input liquids
|
||||
if(recipe != null && recipe.resource != null && matches(input, toILiquidStack(recipe.liquid))) {
|
||||
recipes.add(recipe);
|
||||
}
|
||||
}
|
||||
|
||||
if(!recipes.isEmpty()) {
|
||||
MineTweakerAPI.apply(new Remove(recipes));
|
||||
} else {
|
||||
LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored!", Fermenter.name, input.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static class Remove extends BaseListRemoval<Recipe> {
|
||||
|
||||
|
||||
public Remove(List<Recipe> recipes) {
|
||||
super(Fermenter.name, RecipeManager.recipes, recipes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
super.apply();
|
||||
|
||||
// Tidy up valid inputs
|
||||
for(Iterator<Fluid> iter = RecipeManager.recipeFluidInputs.iterator(); iter.hasNext();) {
|
||||
boolean found = false;
|
||||
Fluid fluid = iter.next();
|
||||
for(Recipe recipe : list) {
|
||||
if(recipe != null && recipe.liquid != null && recipe.liquid.getFluid().equals(fluid)) {
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(!found) {
|
||||
iter.remove();
|
||||
}
|
||||
}
|
||||
|
||||
// Tidy up valid outputs
|
||||
for(Iterator<Fluid> iter = RecipeManager.recipeFluidOutputs.iterator(); iter.hasNext();) {
|
||||
boolean found = false;
|
||||
Fluid fluid = iter.next();
|
||||
for(Recipe recipe : list) {
|
||||
if(recipe != null && recipe.output != null && recipe.output.getFluid().equals(fluid)) {
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(!found) {
|
||||
iter.remove();
|
||||
}
|
||||
}
|
||||
super.apply();
|
||||
|
||||
// Tidy up valid inputs
|
||||
for(Iterator<Fluid> iter = RecipeManager.recipeFluidInputs.iterator(); iter.hasNext();) {
|
||||
boolean found = false;
|
||||
Fluid fluid = iter.next();
|
||||
for(Recipe recipe : list) {
|
||||
if(recipe != null && recipe.liquid != null && recipe.liquid.getFluid().equals(fluid)) {
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(!found) {
|
||||
iter.remove();
|
||||
}
|
||||
}
|
||||
|
||||
// Tidy up valid outputs
|
||||
for(Iterator<Fluid> iter = RecipeManager.recipeFluidOutputs.iterator(); iter.hasNext();) {
|
||||
boolean found = false;
|
||||
Fluid fluid = iter.next();
|
||||
for(Recipe recipe : list) {
|
||||
if(recipe != null && recipe.output != null && recipe.output.getFluid().equals(fluid)) {
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(!found) {
|
||||
iter.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
// add liquids to valid input / output
|
||||
for(Recipe recipe : successful) {
|
||||
RecipeManager.recipeFluidInputs.add(recipe.liquid.getFluid());
|
||||
RecipeManager.recipeFluidOutputs.add(recipe.output.getFluid());
|
||||
}
|
||||
|
||||
super.undo();
|
||||
// add liquids to valid input / output
|
||||
for(Recipe recipe : successful) {
|
||||
RecipeManager.recipeFluidInputs.add(recipe.liquid.getFluid());
|
||||
RecipeManager.recipeFluidOutputs.add(recipe.output.getFluid());
|
||||
}
|
||||
super.undo();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo(Recipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.output);
|
||||
}
|
||||
@Override
|
||||
public String getRecipeInfo(Recipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.output);
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
/**
|
||||
* Adds fermenter fuel.
|
||||
* Note: the actual consumption of fluid input depends on the fermentation fuel
|
||||
|
@ -211,14 +210,14 @@ public class Fermenter {
|
|||
* @param fermentPerCycle How much is fermented per work cycle, i.e. how much fluid of the input is consumed.
|
||||
* @param burnDuration Amount of work cycles a single item of this fuel lasts before expiring.
|
||||
*/
|
||||
@ZenMethod
|
||||
@ZenMethod
|
||||
public static void addFuel(IItemStack item, int fermentPerCycle, int burnDuration) {
|
||||
MineTweakerAPI.apply(new AddFuel(new FermenterFuel(toStack(item), fermentPerCycle, burnDuration)));
|
||||
}
|
||||
|
||||
|
||||
private static class AddFuel extends BaseMapAddition<ItemStack, FermenterFuel> {
|
||||
public AddFuel(FermenterFuel fuelEntry) {
|
||||
super(Fermenter.name, FuelManager.fermenterFuel);
|
||||
super(Fermenter.nameFuel, FuelManager.fermenterFuel);
|
||||
recipes.put(fuelEntry.item, fuelEntry);
|
||||
}
|
||||
|
||||
|
@ -229,38 +228,38 @@ public class Fermenter {
|
|||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
/**
|
||||
* Removes a fermenter fuel.
|
||||
*
|
||||
* @param fermenterItem Item that is a valid fuel for the fermenter
|
||||
*/
|
||||
@ZenMethod
|
||||
@ZenMethod
|
||||
public static void removeFuel(IIngredient fermenterItem) {
|
||||
Map<ItemStack, FermenterFuel> fuelItems = new HashMap<ItemStack, FermenterFuel>();
|
||||
|
||||
for(Entry<ItemStack, FermenterFuel> fuelItem : FuelManager.fermenterFuel.entrySet()) {
|
||||
if(fuelItem != null && matches(fermenterItem, toIItemStack(fuelItem.getValue().item))) {
|
||||
fuelItems.put(fuelItem.getKey(), fuelItem.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
if(!fuelItems.isEmpty()) {
|
||||
MineTweakerAPI.apply(new RemoveFuel(fuelItems));
|
||||
} else {
|
||||
LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored!", Fermenter.name, fermenterItem.toString()));
|
||||
}
|
||||
Map<ItemStack, FermenterFuel> fuelItems = new HashMap<ItemStack, FermenterFuel>();
|
||||
|
||||
for(Entry<ItemStack, FermenterFuel> fuelItem : FuelManager.fermenterFuel.entrySet()) {
|
||||
if(fuelItem != null && matches(fermenterItem, toIItemStack(fuelItem.getValue().item))) {
|
||||
fuelItems.put(fuelItem.getKey(), fuelItem.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
if(!fuelItems.isEmpty()) {
|
||||
MineTweakerAPI.apply(new RemoveFuel(fuelItems));
|
||||
} else {
|
||||
LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored!", Fermenter.name, fermenterItem.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
private static class RemoveFuel extends BaseMapRemoval<ItemStack, FermenterFuel> {
|
||||
public RemoveFuel(Map<ItemStack, FermenterFuel> recipes) {
|
||||
super(Fermenter.name, FuelManager.fermenterFuel, recipes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo(Entry<ItemStack, FermenterFuel> fuelEntry) {
|
||||
return LogHelper.getStackDescription(fuelEntry.getKey());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static class RemoveFuel extends BaseMapRemoval<ItemStack, FermenterFuel> {
|
||||
public RemoveFuel(Map<ItemStack, FermenterFuel> recipes) {
|
||||
super(Fermenter.nameFuel, FuelManager.fermenterFuel, recipes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo(Entry<ItemStack, FermenterFuel> fuelEntry) {
|
||||
return LogHelper.getStackDescription(fuelEntry.getKey());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -21,21 +21,21 @@ import modtweaker2.utils.BaseMapAddition;
|
|||
import modtweaker2.utils.BaseMapRemoval;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
import forestry.api.fuels.FermenterFuel;
|
||||
import forestry.api.fuels.FuelManager;
|
||||
import forestry.api.fuels.MoistenerFuel;
|
||||
import forestry.factory.gadgets.MachineMoistener;
|
||||
import forestry.factory.gadgets.MachineMoistener.Recipe;
|
||||
import forestry.factory.gadgets.MachineMoistener.RecipeManager;
|
||||
import forestry.factory.tiles.TileMoistener;
|
||||
import forestry.factory.tiles.TileMoistener.Recipe;
|
||||
import forestry.factory.tiles.TileMoistener.RecipeManager;
|
||||
|
||||
@ZenClass("mods.forestry.Moistener")
|
||||
public class Moistener {
|
||||
|
||||
public static final String name = "Forestry Moistener";
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
public static final String name = "Forestry Moistener";
|
||||
public static final String nameFuel = name + " (Fuel)";
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Adds a recipe for the Moistener
|
||||
*
|
||||
* @param output recipe output
|
||||
|
@ -43,21 +43,19 @@ public class Moistener {
|
|||
* @param timePerItem time per item to process
|
||||
*/
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack product, IItemStack resource, int timePerItem) {
|
||||
MineTweakerAPI.apply(new Add(new Recipe(toStack(resource), toStack(product), timePerItem)));
|
||||
|
||||
public static void addRecipe(IItemStack output, IItemStack resource, int timePerItem) {
|
||||
MineTweakerAPI.apply(new Add(new Recipe(toStack(resource), toStack(output), timePerItem)));
|
||||
}
|
||||
|
||||
|
||||
@Deprecated
|
||||
@ZenMethod
|
||||
public static void addRecipe(int timePerItem, IItemStack resource, IItemStack product) {
|
||||
MineTweakerAPI.apply(new Add(new Recipe(toStack(resource), toStack(product), timePerItem)));
|
||||
|
||||
}
|
||||
|
||||
private static class Add extends BaseListAddition<Recipe> {
|
||||
public Add(Recipe recipe) {
|
||||
super(Moistener.name, MachineMoistener.RecipeManager.recipes);
|
||||
super(Moistener.name, TileMoistener.RecipeManager.recipes);
|
||||
recipes.add(recipe);
|
||||
}
|
||||
|
||||
|
@ -71,19 +69,18 @@ public class Moistener {
|
|||
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IIngredient output) {
|
||||
List<Recipe> recipes = new LinkedList<Recipe>();
|
||||
|
||||
for (Recipe recipe : RecipeManager.recipes) {
|
||||
if (recipe != null && recipe.product != null && matches(output, toIItemStack(recipe.product))) {
|
||||
recipes.add(recipe);
|
||||
}
|
||||
}
|
||||
|
||||
if(!recipes.isEmpty()) {
|
||||
MineTweakerAPI.apply(new Remove(recipes));
|
||||
} else {
|
||||
LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored!", Moistener.name, output.toString()));
|
||||
}
|
||||
List<Recipe> recipes = new LinkedList<Recipe>();
|
||||
for (Recipe recipe : RecipeManager.recipes) {
|
||||
if (recipe != null && recipe.product != null && matches(output, toIItemStack(recipe.product))) {
|
||||
recipes.add(recipe);
|
||||
}
|
||||
}
|
||||
|
||||
if(!recipes.isEmpty()) {
|
||||
MineTweakerAPI.apply(new Remove(recipes));
|
||||
} else {
|
||||
LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored!", Moistener.name, output.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
private static class Remove extends BaseListRemoval<Recipe> {
|
||||
|
@ -91,10 +88,10 @@ public class Moistener {
|
|||
super(Moistener.name, RecipeManager.recipes, recipes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo(Recipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.product);
|
||||
}
|
||||
@Override
|
||||
public String getRecipeInfo(Recipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.product);
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -107,18 +104,18 @@ public class Moistener {
|
|||
* @param moistenerValue How much this item contributes to the final product of the moistener (i.e. mycelium)
|
||||
* @param stage What stage this product represents. Resources with lower stage value will be consumed first. (First Stage is 0)
|
||||
*/
|
||||
@ZenMethod
|
||||
@ZenMethod
|
||||
public static void addFuel(IItemStack item, IItemStack product, int moistenerValue, int stage) {
|
||||
if(stage >= 0) {
|
||||
MineTweakerAPI.apply(new AddFuel(new MoistenerFuel(toStack(item), toStack(product), moistenerValue, stage)));
|
||||
} else {
|
||||
LogHelper.logWarning(String.format("No %s Recipe add for %s. Stage parameter must positive!", Moistener.name, item.toString()));
|
||||
}
|
||||
if(stage >= 0) {
|
||||
MineTweakerAPI.apply(new AddFuel(new MoistenerFuel(toStack(item), toStack(product), moistenerValue, stage)));
|
||||
} else {
|
||||
LogHelper.logWarning(String.format("No %s Recipe add for %s. Stage parameter must positive!", Moistener.name, item.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static class AddFuel extends BaseMapAddition<ItemStack, MoistenerFuel> {
|
||||
public AddFuel(MoistenerFuel fuelEntry) {
|
||||
super(Moistener.name, FuelManager.moistenerResource);
|
||||
super(Moistener.nameFuel, FuelManager.moistenerResource);
|
||||
recipes.put(fuelEntry.item, fuelEntry);
|
||||
}
|
||||
|
||||
|
@ -129,37 +126,37 @@ public class Moistener {
|
|||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
/**
|
||||
* Removes a moistener fuel.
|
||||
*
|
||||
* @param moistenerItem Item that is a valid fuel for the moistener
|
||||
*/
|
||||
@ZenMethod
|
||||
@ZenMethod
|
||||
public static void removeFuel(IIngredient moistenerItem) {
|
||||
Map<ItemStack, MoistenerFuel> fuelItems = new HashMap<ItemStack, MoistenerFuel>();
|
||||
|
||||
for(Entry<ItemStack, MoistenerFuel> fuelItem : FuelManager.moistenerResource.entrySet()) {
|
||||
if(fuelItem != null && matches(moistenerItem, toIItemStack(fuelItem.getValue().item))) {
|
||||
fuelItems.put(fuelItem.getKey(), fuelItem.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
if(!fuelItems.isEmpty()) {
|
||||
MineTweakerAPI.apply(new RemoveFuel(fuelItems));
|
||||
} else {
|
||||
LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored!", Moistener.name, moistenerItem.toString()));
|
||||
}
|
||||
Map<ItemStack, MoistenerFuel> fuelItems = new HashMap<ItemStack, MoistenerFuel>();
|
||||
|
||||
for(Entry<ItemStack, MoistenerFuel> fuelItem : FuelManager.moistenerResource.entrySet()) {
|
||||
if(fuelItem != null && matches(moistenerItem, toIItemStack(fuelItem.getValue().item))) {
|
||||
fuelItems.put(fuelItem.getKey(), fuelItem.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
if(!fuelItems.isEmpty()) {
|
||||
MineTweakerAPI.apply(new RemoveFuel(fuelItems));
|
||||
} else {
|
||||
LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored!", Moistener.name, moistenerItem.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
private static class RemoveFuel extends BaseMapRemoval<ItemStack, MoistenerFuel> {
|
||||
public RemoveFuel(Map<ItemStack, MoistenerFuel> recipes) {
|
||||
super(Moistener.nameFuel, FuelManager.moistenerResource, recipes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo(Entry<ItemStack, MoistenerFuel> fuelEntry) {
|
||||
return LogHelper.getStackDescription(fuelEntry.getKey());
|
||||
}
|
||||
}
|
||||
|
||||
private static class RemoveFuel extends BaseMapRemoval<ItemStack, MoistenerFuel> {
|
||||
public RemoveFuel(Map<ItemStack, MoistenerFuel> recipes) {
|
||||
super(Moistener.name, FuelManager.moistenerResource, recipes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo(Entry<ItemStack, MoistenerFuel> fuelEntry) {
|
||||
return LogHelper.getStackDescription(fuelEntry.getKey());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,18 +22,19 @@ import modtweaker2.utils.BaseListRemoval;
|
|||
import stanhebben.zenscript.annotations.Optional;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
import forestry.factory.gadgets.MachineSqueezer;
|
||||
import forestry.factory.gadgets.MachineSqueezer.Recipe;
|
||||
import forestry.factory.gadgets.MachineSqueezer.RecipeManager;
|
||||
import forestry.factory.tiles.TileSqueezer;
|
||||
import forestry.factory.tiles.TileSqueezer.RecipeManager;
|
||||
import forestry.factory.recipes.ISqueezerRecipe;
|
||||
import forestry.factory.recipes.SqueezerRecipe;
|
||||
|
||||
@ZenClass("mods.forestry.Squeezer")
|
||||
public class Squeezer {
|
||||
|
||||
|
||||
public static final String name = "Forestry Squeezer";
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/*
|
||||
|
||||
/**
|
||||
* Adds a recipe without additional item output
|
||||
*
|
||||
* @param fluidOutput recipe fluid amount
|
||||
|
@ -42,9 +43,9 @@ public class Squeezer {
|
|||
*/
|
||||
@ZenMethod
|
||||
public static void addRecipe(ILiquidStack fluidOutput, int timePerItem, IItemStack[] ingredients) {
|
||||
MineTweakerAPI.apply(new Add( new Recipe(timePerItem, toStacks(ingredients), toFluid(fluidOutput), null, 0) ));
|
||||
MineTweakerAPI.apply(new Add(new SqueezerRecipe(timePerItem, toStacks(ingredients), toFluid(fluidOutput), null, 0)));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds a recipe with additional item output
|
||||
*
|
||||
|
@ -55,45 +56,45 @@ public class Squeezer {
|
|||
*/
|
||||
@ZenMethod
|
||||
public static void addRecipe(ILiquidStack fluidOutput, WeightedItemStack itemOutput, IItemStack[] ingredients, int timePerItem) {
|
||||
MineTweakerAPI.apply(new Add(new Recipe(timePerItem, toStacks(ingredients), toFluid(fluidOutput), toStack(itemOutput.getStack()), (int) itemOutput.getPercent())));
|
||||
MineTweakerAPI.apply(new Add(new SqueezerRecipe(timePerItem, toStacks(ingredients), toFluid(fluidOutput), toStack(itemOutput.getStack()), (int) itemOutput.getPercent())));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
@Deprecated
|
||||
public static void addRecipe(int timePerItem, IItemStack[] resources, ILiquidStack liquid, IItemStack remnants, int chance) {
|
||||
MineTweakerAPI.apply(new Add(new Recipe(timePerItem, toStacks(resources), toFluid(liquid), toStack(remnants), chance)));
|
||||
MineTweakerAPI.apply(new Add(new SqueezerRecipe(timePerItem, toStacks(resources), toFluid(liquid), toStack(remnants), chance)));
|
||||
}
|
||||
|
||||
private static class Add extends BaseListAddition<Recipe> {
|
||||
public Add(Recipe recipe) {
|
||||
super(Squeezer.name, MachineSqueezer.RecipeManager.recipes);
|
||||
|
||||
private static class Add extends BaseListAddition<ISqueezerRecipe> {
|
||||
public Add(ISqueezerRecipe recipe) {
|
||||
super(Squeezer.name, TileSqueezer.RecipeManager.recipes);
|
||||
recipes.add(recipe);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
super.apply();
|
||||
for (Recipe recipe : recipes) {
|
||||
RecipeManager.recipeInputs.addAll(Arrays.asList(recipe.resources));
|
||||
for (ISqueezerRecipe recipe : recipes) {
|
||||
RecipeManager.recipeInputs.addAll(Arrays.asList(recipe.getResources()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
super.undo();
|
||||
for (Recipe recipe : recipes) {
|
||||
RecipeManager.recipeInputs.removeAll(Arrays.asList(recipe.resources));
|
||||
for (ISqueezerRecipe recipe : recipes) {
|
||||
RecipeManager.recipeInputs.removeAll(Arrays.asList(recipe.getResources()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo(Recipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.liquid);
|
||||
public String getRecipeInfo(ISqueezerRecipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getFluidOutput());
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
/**
|
||||
* Removes a recipe for the Centrifuge
|
||||
*
|
||||
|
@ -102,15 +103,15 @@ public class Squeezer {
|
|||
*/
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IIngredient liquid, @Optional IIngredient[] ingredients) {
|
||||
List<Recipe> recipes = new LinkedList<Recipe>();
|
||||
|
||||
for (Recipe r : RecipeManager.recipes) {
|
||||
if (r != null && r.liquid != null && matches(liquid, toILiquidStack(r.liquid))) {
|
||||
List<ISqueezerRecipe> recipes = new LinkedList<ISqueezerRecipe>();
|
||||
|
||||
for (ISqueezerRecipe r : RecipeManager.recipes) {
|
||||
if (r != null && r.getFluidOutput() != null && matches(liquid, toILiquidStack(r.getFluidOutput()))) {
|
||||
// optional check for ingredients
|
||||
if (ingredients != null) {
|
||||
boolean matched = false;
|
||||
for (int i = 0; i < ingredients.length; i++) {
|
||||
if ( matches(ingredients[i], toIItemStack(r.resources[i])) )
|
||||
if ( matches(ingredients[i], toIItemStack(r.getResources()[i])) )
|
||||
matched = true;
|
||||
else {
|
||||
matched = false;
|
||||
|
@ -134,31 +135,30 @@ public class Squeezer {
|
|||
}
|
||||
}
|
||||
|
||||
private static class Remove extends BaseListRemoval<Recipe> {
|
||||
public Remove(List<Recipe> recipes) {
|
||||
super(Squeezer.name, MachineSqueezer.RecipeManager.recipes, recipes);
|
||||
|
||||
private static class Remove extends BaseListRemoval<ISqueezerRecipe> {
|
||||
public Remove(List<ISqueezerRecipe> recipes) {
|
||||
super(Squeezer.name, TileSqueezer.RecipeManager.recipes, recipes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
super.apply();
|
||||
for (Recipe recipe : recipes) {
|
||||
RecipeManager.recipeInputs.removeAll(Arrays.asList(recipe.resources));
|
||||
for (ISqueezerRecipe recipe : recipes) {
|
||||
RecipeManager.recipeInputs.removeAll(Arrays.asList(recipe.getResources()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
super.undo();
|
||||
for (Recipe recipe : recipes) {
|
||||
RecipeManager.recipeInputs.addAll(Arrays.asList(recipe.resources));
|
||||
for (ISqueezerRecipe recipe : recipes) {
|
||||
RecipeManager.recipeInputs.addAll(Arrays.asList(recipe.getResources()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo(Recipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.liquid);
|
||||
public String getRecipeInfo(ISqueezerRecipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getFluidOutput());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,17 +16,17 @@ import modtweaker2.utils.BaseListRemoval;
|
|||
import stanhebben.zenscript.annotations.Optional;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
import forestry.factory.gadgets.MachineStill;
|
||||
import forestry.factory.gadgets.MachineStill.Recipe;
|
||||
import forestry.factory.gadgets.MachineStill.RecipeManager;
|
||||
import forestry.factory.tiles.TileStill;
|
||||
import forestry.factory.tiles.TileStill.Recipe;
|
||||
import forestry.factory.tiles.TileStill.RecipeManager;
|
||||
|
||||
@ZenClass("mods.forestry.Still")
|
||||
public class Still {
|
||||
|
||||
|
||||
public static final String name = "Forestry Still";
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
/**
|
||||
* Adds a recipe for the Still
|
||||
*
|
||||
|
@ -41,7 +41,7 @@ public class Still {
|
|||
|
||||
MineTweakerAPI.apply(new Add(new Recipe(timePerUnit, toFluid(fluidInput), toFluid(fluidOutput))));
|
||||
}
|
||||
|
||||
|
||||
@Deprecated
|
||||
@ZenMethod
|
||||
public static void addRecipe(int timePerUnit, ILiquidStack input, ILiquidStack output) {
|
||||
|
@ -50,13 +50,13 @@ public class Still {
|
|||
|
||||
MineTweakerAPI.apply(new Add(new Recipe(timePerUnit, toFluid(input), toFluid(output))));
|
||||
}
|
||||
|
||||
|
||||
private static class Add extends BaseListAddition<Recipe> {
|
||||
public Add(Recipe recipe) {
|
||||
super("Forestry Still", MachineStill.RecipeManager.recipes);
|
||||
super("Forestry Still", TileStill.RecipeManager.recipes);
|
||||
recipes.add(recipe);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
super.apply();
|
||||
|
@ -64,7 +64,7 @@ public class Still {
|
|||
RecipeManager.recipeFluidInputs.add(recipe.input.getFluid());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
super.undo();
|
||||
|
@ -72,7 +72,7 @@ public class Still {
|
|||
RecipeManager.recipeFluidInputs.remove(recipe.input.getFluid());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo(Recipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.output);
|
||||
|
@ -80,7 +80,7 @@ public class Still {
|
|||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
/**
|
||||
* Removes a recipe for the Still
|
||||
*
|
||||
|
@ -90,7 +90,7 @@ public class Still {
|
|||
@ZenMethod
|
||||
public static void removeRecipe(IIngredient output, @Optional ILiquidStack input) {
|
||||
List<Recipe> recipes = new LinkedList<Recipe>();
|
||||
|
||||
|
||||
for (Recipe r : RecipeManager.recipes) {
|
||||
if (r != null && r.output != null && matches(output, toILiquidStack(r.output))) {
|
||||
if (input != null) {
|
||||
|
@ -102,14 +102,14 @@ public class Still {
|
|||
recipes.add(r);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(!recipes.isEmpty()) {
|
||||
MineTweakerAPI.apply(new Remove(recipes));
|
||||
} else {
|
||||
LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored!", Still.name, LogHelper.getStackDescription(output)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static class Remove extends BaseListRemoval<Recipe> {
|
||||
public Remove(List<Recipe> recipes) {
|
||||
super(Still.name, RecipeManager.recipes, recipes);
|
||||
|
@ -119,7 +119,7 @@ public class Still {
|
|||
public String getRecipeInfo(Recipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.output);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
super.apply();
|
||||
|
@ -127,7 +127,7 @@ public class Still {
|
|||
RecipeManager.recipeFluidInputs.remove(recipe.input.getFluid());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
super.undo();
|
||||
|
|
|
@ -17,18 +17,19 @@ import net.minecraftforge.fluids.FluidRegistry;
|
|||
import stanhebben.zenscript.annotations.Optional;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
import forestry.core.utils.ShapedRecipeCustom;
|
||||
import forestry.factory.gadgets.MachineFabricator.Recipe;
|
||||
import forestry.factory.gadgets.MachineFabricator.RecipeManager;
|
||||
import forestry.factory.gadgets.MachineFabricator.Smelting;
|
||||
import forestry.core.recipes.ShapedRecipeCustom;
|
||||
import forestry.api.recipes.IFabricatorRecipe;
|
||||
import forestry.factory.recipes.FabricatorRecipe;
|
||||
import forestry.factory.tiles.TileFabricator.RecipeManager;
|
||||
import forestry.factory.tiles.TileFabricator.Smelting;
|
||||
|
||||
@ZenClass("mods.forestry.ThermionicFabricator")
|
||||
public class ThermionicFabricator {
|
||||
|
||||
public static final String nameSmelting = "Forestry Thermionic Fabricator (Smelting)";
|
||||
public static final String nameCasting = "Forestry Thermionic Fabricator (Casting)";
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public static final String nameSmelting = "Forestry Thermionic Fabricator (Smelting)";
|
||||
public static final String nameCasting = "Forestry Thermionic Fabricator (Casting)";
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Adds a smelting recipe for the Thermionic Fabricator
|
||||
|
@ -39,19 +40,19 @@ public class ThermionicFabricator {
|
|||
*/
|
||||
@ZenMethod
|
||||
public static void addSmelting(int fluidOutput, IItemStack itemInput, int meltingPoint) {
|
||||
//The machines internal tank accept only liquid glass, therefor this function only accept the amount and hardcode the fluid to glass
|
||||
MineTweakerAPI.apply(new AddSmelting(new Smelting(toStack(itemInput), FluidRegistry.getFluidStack("glass", fluidOutput), meltingPoint)));
|
||||
//The machines internal tank accept only liquid glass, therefor this function only accept the amount and hardcode the fluid to glass
|
||||
MineTweakerAPI.apply(new AddSmelting(new Smelting(toStack(itemInput), FluidRegistry.getFluidStack("glass", fluidOutput), meltingPoint)));
|
||||
}
|
||||
|
||||
|
||||
@Deprecated
|
||||
@ZenMethod
|
||||
public static void addSmelting(IItemStack itemInput, int meltingPoint, int fluidOutput) {
|
||||
//The machines internal tank accept only liquid glass, therefor this function only accept the amount and hardcode the fluid to glass
|
||||
MineTweakerAPI.apply(new AddSmelting(new Smelting(toStack(itemInput), FluidRegistry.getFluidStack("glass", fluidOutput), meltingPoint)));
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
/**
|
||||
* Adds a casting recipe for the Thermionic Fabricator
|
||||
*
|
||||
|
@ -62,119 +63,118 @@ public class ThermionicFabricator {
|
|||
*/
|
||||
@ZenMethod
|
||||
public static void addCast(IItemStack output, IIngredient[][] ingredients, int fluidInput, @Optional IItemStack plan) {
|
||||
MineTweakerAPI.apply(new AddCast(new Recipe(toStack(plan), FluidRegistry.getFluidStack("glass", fluidInput), ShapedRecipeCustom.createShapedRecipe(toStack(output), toShapedObjects(ingredients)))));
|
||||
MineTweakerAPI.apply(new AddCast(new FabricatorRecipe(toStack(plan), FluidRegistry.getFluidStack("glass", fluidInput), ShapedRecipeCustom.createShapedRecipe(toStack(output), toShapedObjects(ingredients)))));
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@ZenMethod
|
||||
public static void addCast(ILiquidStack fluidInput, IIngredient[][] ingredients, IItemStack plan, IItemStack output) {
|
||||
|
||||
MineTweakerAPI.apply(new AddCast(new Recipe(toStack(plan), toFluid(fluidInput), ShapedRecipeCustom.createShapedRecipe(toStack(output), toShapedObjects(ingredients)))));
|
||||
MineTweakerAPI.apply(new AddCast(new FabricatorRecipe(toStack(plan), toFluid(fluidInput), ShapedRecipeCustom.createShapedRecipe(toStack(output), toShapedObjects(ingredients)))));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Implements the actions to add a recipe
|
||||
Since the machine has two crafting Steps, this is a constructors for both
|
||||
*/
|
||||
private static class AddSmelting extends BaseListAddition<Smelting> {
|
||||
|
||||
|
||||
public AddSmelting(Smelting recipe) {
|
||||
super(ThermionicFabricator.nameSmelting, RecipeManager.smeltings);
|
||||
recipes.add(recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo(Smelting recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getResource());
|
||||
}
|
||||
}
|
||||
|
||||
private static class AddCast extends BaseListAddition<Recipe> {
|
||||
|
||||
public AddCast(Recipe recipe) {
|
||||
super(ThermionicFabricator.nameCasting, RecipeManager.recipes);
|
||||
recipes.add(recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo(Recipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.asIRecipe().getRecipeOutput());
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ZenMethod
|
||||
public static void removeSmelting(IIngredient itemInput) {
|
||||
List<Smelting> recipes = new LinkedList<Smelting>();
|
||||
|
||||
for (Smelting r : RecipeManager.smeltings) {
|
||||
if (r != null && r.getResource() != null && matches(itemInput, toIItemStack(r.getResource()))) {
|
||||
recipes.add(r);
|
||||
}
|
||||
}
|
||||
|
||||
if(!recipes.isEmpty()) {
|
||||
MineTweakerAPI.apply(new RemoveSmelting(recipes));
|
||||
} else {
|
||||
LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored!", ThermionicFabricator.nameSmelting, itemInput.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeCast(IIngredient product) {
|
||||
List<Recipe> recipes = new LinkedList<Recipe>();
|
||||
|
||||
for (Recipe r : RecipeManager.recipes) {
|
||||
if (r != null && r.asIRecipe().getRecipeOutput() != null && matches(product, toIItemStack(r.asIRecipe().getRecipeOutput()))) {
|
||||
recipes.add(r);
|
||||
}
|
||||
}
|
||||
|
||||
if(!recipes.isEmpty()) {
|
||||
MineTweakerAPI.apply(new RemoveCasts(recipes));
|
||||
} else {
|
||||
LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored!", ThermionicFabricator.nameSmelting, product.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated //Not sure why this is called Casts, Cast aint an array
|
||||
@ZenMethod
|
||||
public static void removeCasts(IIngredient product) {
|
||||
List<Recipe> recipes = new LinkedList<Recipe>();
|
||||
|
||||
for (Recipe r : RecipeManager.recipes) {
|
||||
if (r != null && r.asIRecipe().getRecipeOutput() != null && matches(product, toIItemStack(r.asIRecipe().getRecipeOutput()))) {
|
||||
recipes.add(r);
|
||||
}
|
||||
}
|
||||
|
||||
if(!recipes.isEmpty()) {
|
||||
MineTweakerAPI.apply(new RemoveCasts(recipes));
|
||||
} else {
|
||||
LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored!", ThermionicFabricator.nameSmelting, product.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
private static class RemoveSmelting extends BaseListRemoval<Smelting> {
|
||||
public RemoveSmelting(List<Smelting> recipes) {
|
||||
super(ThermionicFabricator.nameSmelting, RecipeManager.smeltings, recipes);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo(Smelting recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getResource());
|
||||
}
|
||||
}
|
||||
|
||||
private static class RemoveCasts extends BaseListRemoval<Recipe> {
|
||||
public RemoveCasts(List<Recipe> recipes) {
|
||||
super(ThermionicFabricator.nameCasting, RecipeManager.recipes, recipes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo(Recipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.asIRecipe().getRecipeOutput());
|
||||
}
|
||||
}
|
||||
private static class AddCast extends BaseListAddition<IFabricatorRecipe> {
|
||||
|
||||
public AddCast(IFabricatorRecipe recipe) {
|
||||
super(ThermionicFabricator.nameCasting, RecipeManager.recipes);
|
||||
recipes.add(recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo(IFabricatorRecipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getRecipeOutput());
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ZenMethod
|
||||
public static void removeSmelting(IIngredient itemInput) {
|
||||
List<Smelting> recipes = new LinkedList<Smelting>();
|
||||
|
||||
for (Smelting r : RecipeManager.smeltings) {
|
||||
if (r != null && r.getResource() != null && matches(itemInput, toIItemStack(r.getResource()))) {
|
||||
recipes.add(r);
|
||||
}
|
||||
}
|
||||
|
||||
if(!recipes.isEmpty()) {
|
||||
MineTweakerAPI.apply(new RemoveSmelting(recipes));
|
||||
} else {
|
||||
LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored!", ThermionicFabricator.nameSmelting, itemInput.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeCast(IIngredient product) {
|
||||
List<IFabricatorRecipe> recipes = new LinkedList<IFabricatorRecipe>();
|
||||
|
||||
for (IFabricatorRecipe r : RecipeManager.recipes) {
|
||||
if (r != null && r.getRecipeOutput() != null && matches(product, toIItemStack(r.getRecipeOutput()))) {
|
||||
recipes.add(r);
|
||||
}
|
||||
}
|
||||
|
||||
if(!recipes.isEmpty()) {
|
||||
MineTweakerAPI.apply(new RemoveCasts(recipes));
|
||||
} else {
|
||||
LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored!", ThermionicFabricator.nameSmelting, product.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@ZenMethod
|
||||
public static void removeCasts(IIngredient product) {
|
||||
List<IFabricatorRecipe> recipes = new LinkedList<IFabricatorRecipe>();
|
||||
|
||||
for (IFabricatorRecipe r : RecipeManager.recipes) {
|
||||
if (r != null && r.getRecipeOutput() != null && matches(product, toIItemStack(r.getRecipeOutput()))) {
|
||||
recipes.add(r);
|
||||
}
|
||||
}
|
||||
|
||||
if(!recipes.isEmpty()) {
|
||||
MineTweakerAPI.apply(new RemoveCasts(recipes));
|
||||
} else {
|
||||
LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored!", ThermionicFabricator.nameSmelting, product.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
private static class RemoveSmelting extends BaseListRemoval<Smelting> {
|
||||
public RemoveSmelting(List<Smelting> recipes) {
|
||||
super(ThermionicFabricator.nameSmelting, RecipeManager.smeltings, recipes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo(Smelting recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getResource());
|
||||
}
|
||||
}
|
||||
|
||||
private static class RemoveCasts extends BaseListRemoval<IFabricatorRecipe> {
|
||||
public RemoveCasts(List<IFabricatorRecipe> recipes) {
|
||||
super(ThermionicFabricator.nameCasting, RecipeManager.recipes, recipes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo(IFabricatorRecipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getRecipeOutput());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue