Pure daisy now allows variable time recipes, closes #137.

This commit is contained in:
Vincent Lee committed 2016-02-26 19:48:43 -06:00
1 parent 47001131b0
commit 18ea3e6bfb
3 files changed
+31 -13

No files matched your search

@@ -413,13 +413,24 @@ public final class BotaniaAPI {
}
/**
* Registers a Pure Daisy Recipe.
* Registers a Pure Daisy Recipe with the default time of 150 ticks per block
* @param input The block that works as an input for the recipe. Can be a Block or an oredict String.
* @param outputState The blockstate to be placed upon recipe completion.
* @return The recipe created.
*/
public static RecipePureDaisy registerPureDaisyRecipe(Object input, IBlockState outputState) {
RecipePureDaisy recipe = new RecipePureDaisy(input, outputState);
return registerPureDaisyRecipe(input, outputState, 150);
}
/**
* Registers a Pure Daisy Recipe.
* @param input The block that works as an input for the recipe. Can be a Block or an oredict String.
* @param outputState The blockstate to be placed upon recipe completion.
* @param time The amount of time in ticks to complete this recipe
* @return The recipe created.
*/
public static RecipePureDaisy registerPureDaisyRecipe(Object input, IBlockState outputState, int time) {
RecipePureDaisy recipe = new RecipePureDaisy(input, outputState, time);
pureDaisyRecipes.add(recipe);
return recipe;
}
@@ -14,6 +14,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.google.common.base.Preconditions;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.item.ItemStack;
@@ -26,15 +27,18 @@ public class RecipePureDaisy {
private static final Map<String, List<ItemStack>> oreMap = new HashMap<>();
Object input;
IBlockState outputState;
private final Object input;
private final IBlockState outputState;
private final int time;
public RecipePureDaisy(Object input, IBlockState state) {
public RecipePureDaisy(Object input, IBlockState state, int time) {
Preconditions.checkArgument(time >= 0, "Time must be nonnegative");
this.input = input;
this.outputState = state;
this.time = time;
if(input != null && !(input instanceof String || input instanceof Block))
throw new IllegalArgumentException("input must be an oredict String or a Block.");
}
/**
@@ -92,4 +96,8 @@ public class RecipePureDaisy {
return outputState;
}
public int getTime() {
return time;
}
}