MC Modding
Please register and join the community!


Join the forum, it's quick and easy

MC Modding
Please register and join the community!
MC Modding
Would you like to react to this message? Create an account in a few clicks or log in to continue.

creating a new type of tool

2 posters

Go down

creating a new type of tool Empty creating a new type of tool

Post by lcass Mon Oct 31, 2011 5:58 pm

So I have again seen some request's lots from ikke so here it is how to make a new type of tool to go with your mod remember to do the graphics. now when I have things that say tooltype and I put them in caps that means you delete them aswell or you will get lots of null pointer exceptions its to seperate out the TileEntitys in some of my tutorials remember to still change the name here bit.....

first you will need two class the mod_namehere.class and you will need TOOLTYPE.class.

so lets start out with the TOOLTYPE.class now its pretty much the same here if you dont know how to change the enumtoolmatirial go look at the tutorial done by austin56101 (yer I know I have bad spelling)
lets get started I will explain more at the bottom.
Code:
// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) braces deadcode

package net.minecraft.src;


// Referenced classes of package net.minecraft.src:
//            ItemTool, Block, EnumToolMaterial

public class TOOLTYPEnamehere extends ItemTool
{

    public TOOLTYPEnamehere(int i, EnumToolMaterial enumtoolmaterial)
    {
        super(i, 1, enumtoolmaterial, blocksEffectiveAgainst);
    }

    public boolean canHarvestBlock(Block block)
    {
        if(block == mod_emerald.emerald)
        {
            return true;
        }
        return block == Block.blockSnow;
       
    }
   

    private static Block blocksEffectiveAgainst[];

    static
    {
        blocksEffectiveAgainst = (new Block[] {
            Block.stone, Block.cobblestone, Block.wood, Block.oreRedstone, Block.snow, Block.blockDiamond, Block.blockClay, Block.tilledField
        });
    }
}
right now lets go through this the part about the snow you don't need to worry about delete it or if you know what your doing edit it to a specific function.

in the static section the bits where it says
Code:
blocksEffectiveAgainst = (new Block[] {
            Block.stone, Block.cobblestone, Block.wood, Block.oreRedstone, Block.snow, Block.blockDiamond, Block.blockClay, Block.tilledField
edit the block types it can destroy so I used the one from a spade and change it so now you want to edit those to what blocks it returns the items on you should know what I am meaning about if you have read all of the other tutorials on tool making and blocks ( and after playing minecraft)

so now onto the mod_file this will be one I use from my code same one henry the coder did but not a full set.
you should know exactly what to do from this point on I will just post up the code.
Code:
package net.minecraft.src;
import java.util.Random;

public class mod_namehere extends BaseMod
{
public static final Item TOOLTYPEnamehere = new TOOLTYPEnamehere(20211,EnumToolMaterial.ruby). setItemName("namehereitem");

   public mod_namehere()
   {
      TOOLTYPEnamehere.iconIndex = ModLoader.addOverride("/gui/items.png", "/namehere/namehere.png");
      
      
      ModLoader.AddName(TOOLTYPEnamehere,"namehere");
      
      
      ModLoader.AddRecipe(new ItemStack(TOOLTYPEnamehere, 1), new Object[] {
          "EEE","EPE"," P ", Character.valueOf('P'), Item.stick , Character.valueOf('E') , mod_plutore.plutore
          });
      
   }

   public String Version()
   {
      return "1.8.1";
   }
}
hopefully this helps you guys with your new tools have fun.

lcass
Member

Posts : 145
Join date : 2011-10-24
Location : england

https://www.youtube.com/user/thealcasgroup

Back to top Go down

creating a new type of tool Empty Re: creating a new type of tool

Post by ikke009 Mon Oct 31, 2011 6:23 pm

This still doesnt explain what i requested, if destroy a block called emeraldblock with my new tooltype chisel, i get an item called emeraldcrystal. if i destroy emeraldblock with a pickaxe, i get an emeraldblock.
if i destroy emeraldblock with anything else, i get nothing.
ikke009
ikke009
Member

Posts : 65
Join date : 2011-10-24
Age : 29
Location : The netherlands

Back to top Go down

creating a new type of tool Empty Re: creating a new type of tool

Post by lcass Mon Oct 31, 2011 6:43 pm

ahhh I have no ffinh Idea unless youwere to do onblockrightclick for the chisel then set it as the return it wouldn't make a diff you can keep it the same for pick

lcass
Member

Posts : 145
Join date : 2011-10-24
Location : england

https://www.youtube.com/user/thealcasgroup

Back to top Go down

creating a new type of tool Empty Re: creating a new type of tool

Post by Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum