Commit 5
This commit is contained in:
parent
d88df32fdd
commit
aec13da277
|
@ -41,17 +41,17 @@ public class Carpenter {
|
|||
* Adds a shaped recipe for the Carpenter
|
||||
*
|
||||
* @param output recipe output
|
||||
* @param fluidInput recipe fluid amount
|
||||
* @param ingredients recipe ingredients
|
||||
* @param fluidInput recipe fluid amount
|
||||
* @param packagingTime time per crafting operation
|
||||
* @param box recipes casting item (optional)
|
||||
*/
|
||||
@ZenMethod
|
||||
public static void addRecipe(IIngredient[][] ingredients, int packagingTime, IItemStack output, @Optional ILiquidStack fluidInput, @Optional IItemStack box) {
|
||||
public static void addRecipe(IItemStack output, IIngredient[][] ingredients, @Optional ILiquidStack fluidInput, int packagingTime, @Optional IItemStack box) {
|
||||
MineTweakerAPI.apply(new Add(new Recipe(packagingTime, toFluid(fluidInput), toStack(box), ShapedRecipeCustom.createShapedRecipe(toStack(output), toShapedObjects(ingredients)) )));
|
||||
}
|
||||
|
||||
//Deprecated
|
||||
@Deprecated
|
||||
@ZenMethod
|
||||
public static void addRecipe(int packagingTime, ILiquidStack liquid, IItemStack[] ingredients, IItemStack ingredient, IItemStack product) {
|
||||
ArrayList<ItemStack> stacks = new ArrayList<ItemStack>();
|
||||
|
@ -79,7 +79,7 @@ public class Carpenter {
|
|||
recipes.add(recipe);
|
||||
|
||||
// The Carpenter has a list of valid Fluids, access them via
|
||||
// Relfection because of private
|
||||
// Reflection because of private
|
||||
if (recipe.getLiquid() != null)
|
||||
ForestryHelper.addCarpenterRecipeFluids(recipe.getLiquid().getFluid());
|
||||
|
||||
|
@ -99,7 +99,8 @@ public class Carpenter {
|
|||
/**
|
||||
* Removes a recipe for the Carpenter
|
||||
*
|
||||
* @param ingredient item input
|
||||
* @param output = item output
|
||||
* @param liquid = liquid input
|
||||
*/
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IIngredient output, @Optional IIngredient liquid) {
|
||||
|
|
|
@ -17,7 +17,6 @@ import modtweaker2.helpers.LogHelper;
|
|||
import modtweaker2.utils.BaseListAddition;
|
||||
import modtweaker2.utils.BaseListRemoval;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import stanhebben.zenscript.annotations.Optional;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
import forestry.api.recipes.ICentrifugeRecipe;
|
||||
|
@ -38,27 +37,16 @@ public class Centrifuge {
|
|||
* @param output List of items to produce with associated chance
|
||||
* @param timePerItem time per item to process
|
||||
* @param ingredient item input
|
||||
* @param output List of percentages to produce a item (same order as in item list)
|
||||
*/
|
||||
@ZenMethod
|
||||
public static void addRecipe(WeightedItemStack[] output, int timePerItem, IItemStack ingredient, @Optional int[] chances) {
|
||||
public static void addRecipe(WeightedItemStack[] output, int timePerItem, IItemStack ingredient) {
|
||||
Map<ItemStack, Float> products = new HashMap<ItemStack, Float>();
|
||||
int i = 0;
|
||||
for (WeightedItemStack product : output) {
|
||||
products.put(toStack(product.getStack()), ((float) chances[i] / 100));
|
||||
i++;
|
||||
products.put(toStack(product.getStack()), product.getChance());
|
||||
}
|
||||
MineTweakerAPI.apply(new Add(new CentrifugeRecipe(timePerItem, toStack(ingredient), products)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a recipe for the Centrifuge
|
||||
*
|
||||
* @param output List of items to produce
|
||||
* @param output List of percentages to produce a item (same order as in item list)
|
||||
* @param timePerItem time per item to process
|
||||
* @param itemInput item input
|
||||
*/
|
||||
@ZenMethod
|
||||
@Deprecated
|
||||
public static void addRecipe(int timePerItem, IItemStack itemInput, IItemStack[] output, int[] chances) {
|
||||
|
|
|
@ -208,7 +208,7 @@ public class Fermenter {
|
|||
* Note: the actual consumption of fluid input depends on the fermentation fuel
|
||||
*
|
||||
* @param item Item that is a valid fuel for the fermenter
|
||||
* @param fermentPerCycle How much is fermeted per work cycle, i.e. how much fluid of the input is consumed.
|
||||
* @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
|
||||
|
|
|
@ -35,6 +35,20 @@ public class Moistener {
|
|||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Adds a recipe for the Moistener
|
||||
*
|
||||
* @param output recipe output
|
||||
* @param resource organic item
|
||||
* @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)));
|
||||
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@ZenMethod
|
||||
public static void addRecipe(int timePerItem, IItemStack resource, IItemStack product) {
|
||||
MineTweakerAPI.apply(new Add(new Recipe(toStack(resource), toStack(product), timePerItem)));
|
||||
|
|
|
@ -33,18 +33,6 @@ public class Squeezer {
|
|||
public static final String name = "Forestry Squeezer";
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/**
|
||||
* Adds a recipe without additional item output
|
||||
*
|
||||
* @param fluidOutput recipe fluid amount
|
||||
* @param ingredients recipe ingredients
|
||||
* @param timePerItem time per crafting operation
|
||||
*/
|
||||
@ZenMethod
|
||||
public static void addRecipe(ILiquidStack fluidOutput, int timePerItem, IItemStack[] ingredients) {
|
||||
MineTweakerAPI.apply(new Add( new Recipe(timePerItem, toStacks(ingredients), toFluid(fluidOutput), null, 0) ));
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a recipe with additional item output
|
||||
*
|
||||
|
@ -54,7 +42,7 @@ public class Squeezer {
|
|||
* @param timePerItem time per crafting operation
|
||||
*/
|
||||
@ZenMethod
|
||||
public static void addRecipe(ILiquidStack fluidOutput, WeightedItemStack itemOutput, int timePerItem, IItemStack[] ingredients) {
|
||||
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()) ));
|
||||
}
|
||||
|
||||
|
|
|
@ -26,6 +26,24 @@ public class Still {
|
|||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Adds a recipe for the Still
|
||||
*
|
||||
* @param fluidOutput recipe fluid amount
|
||||
* @param fluidInput recipe fluid input
|
||||
* @param timePerUnit time per crafting operation
|
||||
*/
|
||||
@ZenMethod
|
||||
public static void addRecipe(ILiquidStack fluidOutput, ILiquidStack fluidInput, int timePerUnit) {
|
||||
fluidOutput.amount(fluidOutput.getAmount() / 100);
|
||||
fluidInput.amount(fluidInput.getAmount() / 100);
|
||||
|
||||
MineTweakerAPI.apply(new Add(new Recipe(timePerUnit, toFluid(fluidInput), toFluid(fluidOutput))));
|
||||
MachineStill.RecipeManager.recipeFluidInputs.add(getFluid(fluidInput));
|
||||
MachineStill.RecipeManager.recipeFluidOutputs.add(getFluid(fluidOutput));
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@ZenMethod
|
||||
public static void addRecipe(int timePerUnit, ILiquidStack input, ILiquidStack output) {
|
||||
output.amount(output.getAmount() / 100);
|
||||
|
|
|
@ -32,16 +32,49 @@ public class ThermionicFabricator {
|
|||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//first production step: smelting item into liquid
|
||||
/**
|
||||
* Adds a smelting recipe for the Thermionic Fabricator
|
||||
*
|
||||
* @param fluidOutput recipe fluid amount
|
||||
* @param itemInput recipe input input
|
||||
* @param meltingPoint point at where itemInput melts down
|
||||
*/
|
||||
@ZenMethod
|
||||
public static void addSmelting(int fluidOutput, IItemStack itemInput, int meltingPoint) {
|
||||
//fluidOutput hardcoded to Liquid 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
|
||||
*
|
||||
* @param product recipe output item
|
||||
* @param ingredients list of input items
|
||||
* @param fluidInput recipe fluid input
|
||||
* @param plan recipe plan item
|
||||
*/
|
||||
@ZenMethod
|
||||
public static void addCast(IItemStack product, IItemStack[][] ingredients, int fluidInput, IItemStack plan) {
|
||||
ItemStack[] flatList = new ItemStack[9];
|
||||
for ( int i = 0; i < 3; i++) {
|
||||
for ( int j = 0; j < 3; j++) {
|
||||
flatList[i*3 + j] = toStack(ingredients[i][j]);
|
||||
}
|
||||
}
|
||||
|
||||
//second step: casting liquid + objetcs + plan into result
|
||||
MineTweakerAPI.apply(new AddCast(new Recipe(toStack(plan), FluidRegistry.getFluidStack("glass", fluidInput), new ShapedRecipeCustom(3, 3, flatList, toStack(product)))));
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@ZenMethod
|
||||
public static void addCast(ILiquidStack fluidInput, IItemStack[][] ingredients, IItemStack plan, IItemStack product) {
|
||||
ItemStack[] flatList = new ItemStack[9];
|
||||
|
@ -83,10 +116,9 @@ public class ThermionicFabricator {
|
|||
return LogHelper.getStackDescription(recipe.asIRecipe().getRecipeOutput());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
@ZenMethod
|
||||
public static void removeSmelting(IIngredient itemInput) {
|
||||
List<Smelting> recipes = new LinkedList<Smelting>();
|
||||
|
@ -104,6 +136,24 @@ public class ThermionicFabricator {
|
|||
}
|
||||
}
|
||||
|
||||
@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>();
|
||||
|
|
Loading…
Reference in a new issue