diff --git a/src/main/java/tconstruct/library/crafting/ToolBuilder.java b/src/main/java/tconstruct/library/crafting/ToolBuilder.java index 633ba19a9fe..23632233232 100644 --- a/src/main/java/tconstruct/library/crafting/ToolBuilder.java +++ b/src/main/java/tconstruct/library/crafting/ToolBuilder.java @@ -116,11 +116,8 @@ public int getMaterialID (ItemStack stack) if (stack == null) return -1; Item item = stack.getItem(); - if (item == Items.stick) - return 0; - else if (item == Items.bone) - return 5; - else if (item instanceof IToolPart) + + if (item instanceof IToolPart) return ((IToolPart) item).getMaterialID(stack); return -1; diff --git a/src/main/java/tconstruct/tools/TinkerToolEvents.java b/src/main/java/tconstruct/tools/TinkerToolEvents.java index 31b12ae4e5d..48673a8d8b7 100644 --- a/src/main/java/tconstruct/tools/TinkerToolEvents.java +++ b/src/main/java/tconstruct/tools/TinkerToolEvents.java @@ -19,14 +19,12 @@ import net.minecraft.util.Vec3; import net.minecraftforge.event.entity.living.LivingAttackEvent; import net.minecraftforge.event.entity.living.LivingDropsEvent; +import net.minecraftforge.oredict.OreDictionary; import net.minecraftforge.oredict.OreDictionary.OreRegisterEvent; import tconstruct.TConstruct; import tconstruct.armor.player.TPlayerStats; import tconstruct.library.TConstructRegistry; -import tconstruct.library.event.PartBuilderEvent; -import tconstruct.library.event.SmelteryCastEvent; -import tconstruct.library.event.SmelteryCastedEvent; -import tconstruct.library.event.ToolCraftEvent; +import tconstruct.library.event.*; import tconstruct.library.tools.AbilityHelper; import tconstruct.library.tools.ArrowMaterial; import tconstruct.library.tools.BowMaterial; @@ -39,6 +37,8 @@ import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.gameevent.PlayerEvent.ItemCraftedEvent; +import java.util.List; + public class TinkerToolEvents { @SubscribeEvent @@ -58,7 +58,25 @@ public void onCrafting (ItemCraftedEvent event) } } } - + + @SubscribeEvent + public void buildTool(ToolBuildEvent event) + { + // check if the handle is a bone + if(event.handleStack.getItem() == Items.bone) { + event.handleStack = new ItemStack(TinkerTools.toolRod, 1, 5); // bone tool rod + return; + } + + // check if the handle is a stick + List sticks = OreDictionary.getOres("stickWood"); + for(ItemStack stick : sticks) + if (OreDictionary.itemMatches(stick, event.handleStack, false)) { + event.handleStack = new ItemStack(TinkerTools.toolRod, 1, 0); // wooden tool rod + return; + } + } + @SubscribeEvent public void craftTool (ToolCraftEvent.NormalTool event) {