Change how leaf fletchlings are handled to be more general. Basically ALL leaves can be used for leaf fletchlings now.

This commit is contained in:
Bernhard Bonigl committed 2014-08-23 11:28:56 +02:00
1 parent 1dd13c5a5f
commit 175352108e
5 files changed
+47 -38

No files matched your search

@@ -217,7 +217,7 @@ public class TConstructRegistry
* multiple times the parts are added to the recipe's input list Valid part
* amounts are 2, 3, and 4.
*
* @see ToolBuidler
* @see ToolBuilder
* @param output
* The ToolCore to craft
* @param parts
@@ -241,8 +241,6 @@ public class TConstructRegistry
*
* @param materialID
* Unique ID, stored for each part
* @exception materialID
* must be unique
* @param materialName
* Unique name for data lookup purposes
* @param harvestLevel
@@ -283,8 +281,6 @@ public class TConstructRegistry
*
* @param materialID
* Unique ID, stored for each part
* @exception materialID
* must be unique
* @param materialName
* Unique name for data lookup purposes
* @param displayName
@@ -327,8 +323,6 @@ public class TConstructRegistry
*
* @param materialID
* Unique ID, stored for each part
* @exception materialID
* must be unique
* @param material
* Complete tool material to add. Uses the name in the material
* for lookup purposes.
@@ -456,7 +450,7 @@ public class TConstructRegistry
{
for (CustomMaterial mat : customMaterials)
{
if (mat.getClass().equals(clazz) && input.isItemEqual(mat.input))
if (mat.getClass().equals(clazz) && mat.matches(input))
return mat;
}
return null;
@@ -15,4 +15,12 @@ public class FletchingMaterial extends CustomMaterial
this.breakChance = breakChance;
this.mass = mass;
}
public FletchingMaterial(int materialID, int value, String oredict, ItemStack craftingItem, float accuracy, float breakChance, float mass)
{
super(materialID, value, oredict, craftingItem);
this.accuracy = accuracy;
this.breakChance = breakChance;
this.mass = mass;
}
}
@@ -1,4 +1,34 @@
package tconstruct.library.tools;
public class FletchlingLeafMaterial {
import mantle.blocks.BlockUtils;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import tconstruct.tools.TinkerToolEvents;
public class FletchlingLeafMaterial extends FletchingMaterial {
public FletchlingLeafMaterial(int materialID, int value, String oredict, ItemStack craftingItem, float accuracy, float breakChance, float mass) {
super(materialID, value, oredict, craftingItem, accuracy, breakChance, mass);
}
@Override
public boolean matches(ItemStack stack) {
if(matchesLeaves(stack))
return true;
return super.matches(stack);
}
public static boolean matchesLeaves (ItemStack stack)
{
if (stack != null)
{
Block block = BlockUtils.getBlockFromItemStack(stack);
if (block != null)
{
if (block.isLeaves(null, 0, 0, 0))
return true;
}
}
return false;
}
}