Posted September 27, 20159 yr I am trying to make a custom tool, but am unsure how to do this, by custom I mean custom custom, only effective on certain blocks with durability etc, without extending pickaxe / shovel etc. how do I go about doing this, do I still need ToolMaterial? should I extend one of the tool classes but override everything? any help is appreciated. thanks. PS: I am trying to make a 'rake' tool that when you click on a grass block with it it will gather a few sticks, rocks, etc. and then loose durability, but also has damage against entities etc.
September 27, 20159 yr Wouldn't overriding a hoe work well in your case? If anyone has a comprehensive, visual guide to GUIs - don't hesitate to message me. They make my head spin.
September 27, 20159 yr Author Wouldn't overriding a hoe work well in your case? yes but I really want to do more with it, and create other tools such as hammers, wrenches, etc
September 27, 20159 yr Extend ItemTool and call setHarvestLevel("someCustomToolClass", toolMaterial.getHarvestLevel()) in the constructor. As long as the ItemTool#toolClass field is null (which it will be if you extend ItemTool directly), getHarvestLevel and getToolClasses will return the result of the super methods (which use the values set by Item#setHarvestLevel ). You can then call Block#setHarvestLevel with the same tool class to allow a block to be harvested by that tool. Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
September 27, 20159 yr Author Extend ItemTool and call setHarvestLevel("someCustomToolClass", toolMaterial.getHarvestLevel()) in the constructor. As long as the ItemTool#toolClass field is null (which it will be if you extend ItemTool directly), getHarvestLevel and getToolClasses will return the result of the super methods (which use the values set by Item#setHarvestLevel ). You can then call Block#setHarvestLevel with the same tool class to allow a block to be harvested by that tool. the super constructor needs a float, an enum, and a set. for the float, damage i just put 2.0f, but for the enum I put EnumHelper.addToolMaterial("woodenrake", 0, 31, 0f, 2f, 2); and for the set, I put null (does that just mean none set)?
September 27, 20159 yr the super constructor needs a float, an enum, and a set. for the float, damage i just put 2.0f, but for the enum I put EnumHelper.addToolMaterial("woodenrake", 0, 31, 0f, 2f, 2); and for the set, I put null (does that just mean none set)? You should create the ToolMaterial once (probably in the same class where you instantiate and register your items, just before you do that) and then reference it for your tools. Multiple tools can share a ToolMaterial (e.g. all vanilla wooden tools use ToolMaterial.WOOD ). You can also just use an existing ToolMaterial . The Set is the Block s that the tool is effective against, but Forge replaces that with the harvest level system so it's not actually used unless some mod decides to ignore Forge's system and use the vanilla system. Just in case, you should pass an empty Set (just create a new HashSet ) instead of null ; that way the vanilla system won't crash with a NullPointerException . Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
September 27, 20159 yr Create a normal item an override canharvestblock in your item. Create a private float wich will be the efficiency of the tool and override func_150893_a and return the private efficiency float. Use onitemuse do create the rocks and stuff you wanted.
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.