MC Modding
Please register and join the community!

Tools (pickaxe, axe, shovel, hoe, sword)

Page 1 of 2 1, 2  Next

View previous topic View next topic Go down

Tools (pickaxe, axe, shovel, hoe, sword)

Post by austin56101 on Sat Oct 22, 2011 5:15 am

NOT MADE BY ME, MADE BY HENRY

Here is the code I wrote in the tutorial. You can copy paste it if you like. Just make sure you paste it into a new file called mod_Tools.java. Or, if you want to change the name, make sure you replace wherever it says “mod_Tools” to the name of your mod. Also, don’t forget to name your textures accordingly.
//THIS CODE GOES INTO YOUR mod_Tools.java FILE! (or whatever you named your mod_*YourModNameHere*.java file)
Code:
package net.minecraft.src;
import java.util.Random;

public class mod_Tools extends BaseMod
{

   //Here we declare all of our new tools.
   public static final Item Pick = new ItemPickaxe(2001, EnumToolMaterial.EMERALD).setItemName("asdf");
   public static final Item Spade = new ItemSpade(2002, EnumToolMaterial.EMERALD).setItemName("sdfa");
   public static final Item Axe = new ItemAxe(2003, EnumToolMaterial.EMERALD).setItemName("dfas");
   public static final Item Hoe = new ItemHoe(2004, EnumToolMaterial.EMERALD).setItemName("fasd");
   public static final Item Sword = new ItemSword(2005, EnumToolMaterial.EMERALD).setItemName("adsf");

   public mod_Tools()
   {

   //Here we override all the textures, and add our own.
        //Make sure the name of your texture is the same what you write here
      Pick.iconIndex = ModLoader.addOverride("/gui/items.png", "/Pick.png");
      Spade.iconIndex = ModLoader.addOverride("/gui/items.png", "/Spade.png");
      Axe.iconIndex = ModLoader.addOverride("/gui/items.png", "/Axe.png");
      Hoe.iconIndex = ModLoader.addOverride("/gui/items.png", "/Hoe.png");
      Sword.iconIndex = ModLoader.addOverride("/gui/items.png", "/Sword.png");

   //Here we add the in game names to all the tools.
      ModLoader.AddName(Pick, "Pickaxe");
      ModLoader.AddName(Spade, "Shovel");
      ModLoader.AddName(Axe, "Axe");
      ModLoader.AddName(Hoe, "Hoe");
      ModLoader.AddName(Sword, "Sword");

   //Here are all the recipes for each tool (all of them are made out of dirt)
      ModLoader.AddRecipe(new ItemStack(Pick, 1), new Object[] {
      "***", " * ", " * ", Character.valueOf('*'), Block.dirt
      });
      ModLoader.AddRecipe(new ItemStack(Axe, 1), new Object[] {
      "** ", "** ", " * ", Character.valueOf('*'), Block.dirt
      });
      ModLoader.AddRecipe(new ItemStack(Spade, 1), new Object[] {
      "* *", " * ", " * ", Character.valueOf('*'), Block.dirt
      });
      ModLoader.AddRecipe(new ItemStack(Hoe, 1), new Object[] {
      "** ", " * ", " * ", Character.valueOf('*'), Block.dirt
      });
      ModLoader.AddRecipe(new ItemStack(Sword, 1), new Object[] {
      " * ", " * ", " * ", Character.valueOf('*'), Block.dirt
      });
   }

   public String Version()
   {
      return "3.14159265";
   }
}


Last edited by austin56101 on Sat Oct 22, 2011 8:00 pm; edited 1 time in total (Reason for editing : /code)
avatar
austin56101
Moderator
Moderator

Posts : 85
Join date : 2011-10-22
Age : 21
Location : Cali!

View user profile

Back to top Go down

Re: Tools (pickaxe, axe, shovel, hoe, sword)

Post by breakyorself on Sat Oct 22, 2011 6:03 am

For the code i suggest using {code}/*code in here*/ {/code} but replace the { whith [.
avatar
breakyorself
Member

Posts : 60
Join date : 2011-10-19

View user profile

Back to top Go down

Re: Tools (pickaxe, axe, shovel, hoe, sword)

Post by proshitness on Sat Oct 22, 2011 5:36 pm

dude, put it in a ["code] ["/code] without the : "
that make it a lot simpler.

proshitness
Member

Posts : 4
Join date : 2011-10-20

View user profile

Back to top Go down

Re: Tools (pickaxe, axe, shovel, hoe, sword)

Post by breakyorself on Sat Oct 22, 2011 5:44 pm

proshitness wrote:dude, put it in a ["code] ["/code] without the : "
that make it a lot simpler.
I kinda posted that Neutral.
avatar
breakyorself
Member

Posts : 60
Join date : 2011-10-19

View user profile

Back to top Go down

Re: Tools (pickaxe, axe, shovel, hoe, sword)

Post by austin56101 on Sat Oct 22, 2011 10:11 pm

sorry i just fixed it
avatar
austin56101
Moderator
Moderator

Posts : 85
Join date : 2011-10-22
Age : 21
Location : Cali!

View user profile

Back to top Go down

Re: Tools (pickaxe, axe, shovel, hoe, sword)

Post by Strengthowns on Sun Oct 23, 2011 5:09 am

Ahh. The newer posts are burying it! I'll fix the options now.
avatar
Strengthowns
Admin

Posts : 79
Join date : 2011-06-14
Location : Right here!

View user profile http://www.mcmodding.4umer.com

Back to top Go down

Re: Tools (pickaxe, axe, shovel, hoe, sword)

Post by ikke009 on Tue Oct 25, 2011 8:27 pm

Why is the spade recipe "* *", "*", "*", and not 3 times "*" like the sword?
avatar
ikke009
Member

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

View user profile

Back to top Go down

Re: Tools (pickaxe, axe, shovel, hoe, sword)

Post by filip151 on Tue Oct 25, 2011 8:30 pm

ikke009 wrote:Why is the spade recipe "* *", "*", "*", and not 3 times "*" like the sword?
Because the recipes collide, that's why! If it would be done your way, the game would crash!

filip151
Member

Posts : 11
Join date : 2011-10-21
Age : 19
Location : Norway, Oslo Poland, Swiecie

View user profile

Back to top Go down

Re: Tools (pickaxe, axe, shovel, hoe, sword)

Post by austin56101 on Tue Oct 25, 2011 8:56 pm

Lol yea^
avatar
austin56101
Moderator
Moderator

Posts : 85
Join date : 2011-10-22
Age : 21
Location : Cali!

View user profile

Back to top Go down

Re: Tools (pickaxe, axe, shovel, hoe, sword)

Post by Themountaindewosse on Tue Oct 25, 2011 9:35 pm

how do you make like your own item into tools?

Themountaindewosse
Member

Posts : 3
Join date : 2011-10-24

View user profile

Back to top Go down

Re: Tools (pickaxe, axe, shovel, hoe, sword)

Post by austin56101 on Tue Oct 25, 2011 9:40 pm

What type of item?
I think that he still is planning on making the adv items mod
avatar
austin56101
Moderator
Moderator

Posts : 85
Join date : 2011-10-22
Age : 21
Location : Cali!

View user profile

Back to top Go down

Re: Tools (pickaxe, axe, shovel, hoe, sword)

Post by Themountaindewosse on Tue Oct 25, 2011 9:52 pm

i mean if i have like a ingot that i made how do i make that into tools?

Themountaindewosse
Member

Posts : 3
Join date : 2011-10-24

View user profile

Back to top Go down

Re: Tools (pickaxe, axe, shovel, hoe, sword)

Post by austin56101 on Tue Oct 25, 2011 10:07 pm

mod_yourfile.yourignot
In your recipie
avatar
austin56101
Moderator
Moderator

Posts : 85
Join date : 2011-10-22
Age : 21
Location : Cali!

View user profile

Back to top Go down

Re: Tools (pickaxe, axe, shovel, hoe, sword)

Post by Themountaindewosse on Tue Oct 25, 2011 10:17 pm

thanks What a Face

Themountaindewosse
Member

Posts : 3
Join date : 2011-10-24

View user profile

Back to top Go down

Re: Tools (pickaxe, axe, shovel, hoe, sword)

Post by austin56101 on Wed Oct 26, 2011 2:02 am

np np just doing my job Smile
avatar
austin56101
Moderator
Moderator

Posts : 85
Join date : 2011-10-22
Age : 21
Location : Cali!

View user profile

Back to top Go down

Re: Tools (pickaxe, axe, shovel, hoe, sword)

Post by jesshankin22 on Thu Oct 27, 2011 8:31 pm

ok so what's going on.... I installed modloader and decompiled it correctly, but when i run the mod it says " cannot find symbol ModLoader" and help???
^

jesshankin22
Member

Posts : 47
Join date : 2011-10-24

View user profile

Back to top Go down

Re: Tools (pickaxe, axe, shovel, hoe, sword)

Post by ikke009 on Thu Oct 27, 2011 8:49 pm

complete wrong topic, but you have to recompile first before running your client..
avatar
ikke009
Member

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

View user profile

Back to top Go down

Re: Tools (pickaxe, axe, shovel, hoe, sword)

Post by lcass on Thu Oct 27, 2011 9:59 pm

do you have any idea on how to add something eg a picksword I may look into it maybe see how they did it in the uranium mod

lcass
Member

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

View user profile http://www.youtube.com/user/thealcasgroup

Back to top Go down

Re: Tools (pickaxe, axe, shovel, hoe, sword)

Post by austin56101 on Thu Oct 27, 2011 10:10 pm

Please delete your post
Repost in help section
avatar
austin56101
Moderator
Moderator

Posts : 85
Join date : 2011-10-22
Age : 21
Location : Cali!

View user profile

Back to top Go down

Re: Tools (pickaxe, axe, shovel, hoe, sword)

Post by lcass on Thu Oct 27, 2011 10:19 pm

soz it does fit in with the post though its items

lcass
Member

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

View user profile http://www.youtube.com/user/thealcasgroup

Back to top Go down

Re: Tools (pickaxe, axe, shovel, hoe, sword)

Post by austin56101 on Fri Oct 28, 2011 1:04 am

jesshankin22 wrote:ok so what's going on.... I installed modloader and decompiled it correctly, but when i run the mod it says " cannot find symbol ModLoader" and help???
^
This belongs in the help section
avatar
austin56101
Moderator
Moderator

Posts : 85
Join date : 2011-10-22
Age : 21
Location : Cali!

View user profile

Back to top Go down

Re: Tools (pickaxe, axe, shovel, hoe, sword)

Post by ikke009 on Fri Oct 28, 2011 11:21 am

you, as a moderator, should be able to do that yourself, since jess isnt reacting. but we are getting a bit off topic.. theundecidedt made a video yesterday about this, its very good i am going to make some tools this afternoon with the help of this tutorial and that video..
avatar
ikke009
Member

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

View user profile

Back to top Go down

Re: Tools (pickaxe, axe, shovel, hoe, sword)

Post by mastereric on Fri Oct 28, 2011 2:46 pm

jesshankin22 wrote:ok so what's going on.... I installed modloader and decompiled it correctly, but when i run the mod it says " cannot find symbol ModLoader" and help???
I had this error. Before decompiling you should have installed Modloader on the jar.

This worked perfectly! Thank you!
avatar
mastereric
Member

Posts : 30
Join date : 2011-10-26

View user profile

Back to top Go down

Re: Tools (pickaxe, axe, shovel, hoe, sword)

Post by MrCreeper07 on Sat Oct 29, 2011 4:56 am

hey so theres only one class for all the tools?

EDIT: also how do you just add one tool like a sword?
avatar
MrCreeper07
Member

Posts : 18
Join date : 2011-10-23

View user profile

Back to top Go down

Re: Tools (pickaxe, axe, shovel, hoe, sword)

Post by jesshankin22 on Sat Oct 29, 2011 4:59 am

you would just delete all the other tools' coding... and btw austin... I'm not positive on how to delete posts.... sorry about that =/

jesshankin22
Member

Posts : 47
Join date : 2011-10-24

View user profile

Back to top Go down

Re: Tools (pickaxe, axe, shovel, hoe, sword)

Post by Sponsored content


Sponsored content


Back to top Go down

Page 1 of 2 1, 2  Next

View previous topic View next topic Back to top


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