Jump to content

[Solved] Add a custom tool ?


Soviet

Recommended Posts

Hello,

 

I'm looking for a tutorial on how to make custom tools and armour on Minecraft 1.5.2. I've followed Havvy's tutorials, but the tools tutorial isn't done yet; I would like to know if anyone would be willing to help me out or to give me a proper tutorial.

 

Thanks by advance,

Have a great day.

Link to comment
Share on other sites

You need Material for these tools, I think you want to have your own material..

all these lines you need to write into the base class of your mod!

 

 

public static EnumToolMaterial matname = EnumHelper.addToolMaterial("unlocalNameofMaterial",harvest level,maxUses,efficiency,damage,enchantibility);

 

Example of Material:

 

public static EnumToolMaterial STAR = EnumHelper.addToolMaterial("STAR", 2, 625, 6.0F, 4, 10);

 

And this is for the custom tool:

You need to extend:

ItemAxe for custom axe

ItemPickaxe for custom pickaxe

ItemHoe for custom hoe

ItemSword for custom sword

ItemSpade for custom shovel

ItemTool for custom universal tool

Example create a class customAxe and edit the:

public class customAxe

to

public class customAxe extends ItemAxe

And you have to add unimplemented methods...  :)

Check out my m2cAPI: http://pastebin.com/SJmjgdgK [WIP! If something doesnt work or you have a better resolution, write me a PM]

If you want to use my API please give me a Karma/Thank you

Sorry for some bad words ´cause I am not a walkin´ library!

Link to comment
Share on other sites

You need Material for these tools, I think you want to have your own material..

all these lines you need to write into the base class of your mod!

 

 

public static EnumToolMaterial matname = EnumHelper.addToolMaterial("unlocalNameofMaterial",harvest level,maxUses,efficiency,damage,enchantibility);

 

Example of Material:

 

public static EnumToolMaterial STAR = EnumHelper.addToolMaterial("STAR", 2, 625, 6.0F, 4, 10);

 

And this is for the custom tool:

You need to extend:

ItemAxe for custom axe

ItemPickaxe for custom pickaxe

ItemHoe for custom hoe

ItemSword for custom sword

ItemSpade for custom shovel

ItemTool for custom universal tool

Example create a class customAxe and edit the:

public class customAxe

to

public class customAxe extends ItemAxe

And you have to add unimplemented methods...  :)

 

Can you explain what are the numbers in the EnumHelper ? (I know the harvest level of 3 = minable obsidian, but I forgot about the others)

Link to comment
Share on other sites

public static EnumToolMaterial steelMaterial = EnumHelper.addToolMaterial("materialSteel", 2,550,6.2F,2.5,9);

 

My imports:

 

import s0vietique.alloycraft.common.CommonProxyClass;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.EnumToolMaterial;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.MinecraftForge;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.Mod.PostInit;
import cpw.mods.fml.common.Mod.PreInit;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;

 

Link to comment
Share on other sites

I think you need int, not double in section of the code with bold text

public static EnumToolMaterial steelMaterial = EnumHelper.addToolMaterial("materialSteel", 2,550,6.2F,2.5,9);

So, it need to be (I think):

public static EnumToolMaterial steelMaterial = EnumHelper.addToolMaterial("materialSteel", 2,550,6.2F,3,9);

And you need to import this:

import net.minecraftforge.common.EnumHelper;

I wish this will get out the error!  ;)

 

//EDIT

You need to take attention on the variable types, like: (examples)

Float - 0.0F,0.5F,1.6F

Double - 0.0,1.0

Boolean - true/false

Int - 1,2,3,5

String - "String"

Check out my m2cAPI: http://pastebin.com/SJmjgdgK [WIP! If something doesnt work or you have a better resolution, write me a PM]

If you want to use my API please give me a Karma/Thank you

Sorry for some bad words ´cause I am not a walkin´ library!

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.