summaryrefslogtreecommitdiff
path: root/src/main/java/ihl/recipes/RecipeInputWire.java
diff options
context:
space:
mode:
authorFoghrye4 <foghrye4@gmail.com>2017-08-10 18:52:45 +0300
committerFoghrye4 <foghrye4@gmail.com>2017-08-10 18:52:45 +0300
commit0427ab89f1753a44b30cbc35ce021cbbdc845109 (patch)
treeabe418ff5ec174e712fe8dedd434548a945b15a3 /src/main/java/ihl/recipes/RecipeInputWire.java
parent877312184c472d9845e5ef1008bc538f4634059f (diff)
fix missing source folder
Diffstat (limited to 'src/main/java/ihl/recipes/RecipeInputWire.java')
-rw-r--r--src/main/java/ihl/recipes/RecipeInputWire.java72
1 files changed, 72 insertions, 0 deletions
diff --git a/src/main/java/ihl/recipes/RecipeInputWire.java b/src/main/java/ihl/recipes/RecipeInputWire.java
new file mode 100644
index 0000000..a7d5310
--- /dev/null
+++ b/src/main/java/ihl/recipes/RecipeInputWire.java
@@ -0,0 +1,72 @@
+package ihl.recipes;
+
+import java.util.Arrays;
+import java.util.List;
+
+import ic2.api.recipe.IRecipeInput;
+import ihl.interfaces.IWire;
+import ihl.items_blocks.FlexibleCableItem;
+import ihl.utils.IHLUtils;
+import net.minecraft.item.ItemStack;
+
+public class RecipeInputWire implements IRecipeInput {
+ public final ItemStack input;
+ public final int amount;
+
+ public RecipeInputWire(final ItemStack aInput) {
+ this(aInput, IHLUtils.getWireLength(aInput));
+ }
+
+ public RecipeInputWire(final ItemStack aInput, int aAmount) {
+ if (aInput.getItem() == null || !(aInput.getItem() instanceof IWire)) {
+ throw new IllegalArgumentException("Invalid item stack specfied");
+ } else {
+ this.input = aInput;
+ this.amount = aAmount;
+ }
+ }
+
+ public RecipeInputWire(String string, int i) {
+ this(IHLUtils.getThisModWireItemStackWithLength(string, i), i);
+ }
+
+ public RecipeInputWire(String material, int length, int transverseSection) {
+ this(IHLUtils.getUninsulatedWire(material, length, transverseSection), length);
+ }
+
+ public RecipeInputWire(String material, int length, int transverseSection, String insulationMaterial,
+ int insulationThickness, int insulationBreakdownVoltage) {
+ this(IHLUtils.getInsulatedWire(material, length, transverseSection, insulationMaterial, insulationThickness),
+ length);
+ }
+
+ @Override
+ public boolean matches(ItemStack subject) {
+ if (subject.getItem() == this.input.getItem()
+ && (subject.getItemDamage() == this.input.getItemDamage() || this.input.getItemDamage() == 32767)) {
+ if (subject.getItem() instanceof FlexibleCableItem) {
+ FlexibleCableItem item = (FlexibleCableItem) subject.getItem();
+ return item.isSameWire(this.input, subject);
+ } else {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public int getAmount() {
+ return this.amount;
+ }
+
+ @Override
+ public List<ItemStack> getInputs() {
+ return Arrays.asList(new ItemStack[] { this.input });
+ }
+
+ @Override
+ public String toString() {
+ ItemStack stack = this.input.copy();
+ return "RInputWireItemStack<" + stack + ">";
+ }
+}