[Beginner] Creating a new Tool Set [22/4/11] [1.4_01] [2.11]
3 posters
Page 1 of 1
[Beginner] Creating a new Tool Set [22/4/11] [1.4_01] [2.11]
To create a new tool set takes a small amount of time. First of all, open up mod_Emeralds.java and take a look. Can you guess what we have to do? That's right, we need to register some more stuff. Find this line:
And put this right under it:
This should be mostly obvious - it creates a bunch of new items which have IDs ranging from 2001-2005, called things like emeraldPick and emeraldHoe. But wait- what's this "EnumToolMaterial" thingy, you might ask? well, open up EnumToolMaterial and we'll find out!
In EnumToolMaterial, there are only 2 things we need to worry about. The first is this bit:
This is right at the top of the file. Each of the numbers means a different thing- I'll edit this to include them when I remember the rest. In WOOD, the 59 is the number of uses, the second 0 is its strength, the 2.0F determines what it can break.
The other part we have to worry about is here:
All this does is declare each of the things described above. So now, we have to edit it to add in our own item's tool materials! But wait, you say! There's already an EMERALD decsribed! Well, that's why I called the one in mod_Emeralds.java 2EMERALD! So, to make 2EMERALD, we have to edit those two code lines to this:
This makes the 2EMERALD have 800 uses, and have 7F strength (among other things).
This is the second part you need to add:
Now, save EnumToolMaterial and open up mod_Emeralds again. By now, you should know how to add texture overrides, but here's a basic one just in case:
Finally, you can add the names:
Now, this will compile and obfuscate, but you'll notice there are no recipes yet. This is why we need to move on to the next tutorial - Adding a Recipe!
- Code:
public static final Item emeraldItem = new Item(2000).setItemName("emeraldItem");
And put this right under it:
- Code:
public static final Item emeraldPick = new ItemPickaxe(2001, EnumToolMaterial.2EMERALD).setItemName("emeraldPick");
public static final Item emeraldShovel = new ItemSpade(2002, EnumToolMaterial.2EMERALD).setItemName("emeraldShovel");
public static final Item emeraldAxe = new ItemAxe(2003, EnumToolMaterial.2EMERALD).setItemName("emeraldAxe");
public static final Item emeraldHoe = new ItemHoe(2004, EnumToolMaterial.2EMERALD).setItemName("emeraldHoe");
public static final Item emeraldSword = new ItemSword(2005, EnumToolMaterial.2EMERALD).setItemName("emeraldSword");
This should be mostly obvious - it creates a bunch of new items which have IDs ranging from 2001-2005, called things like emeraldPick and emeraldHoe. But wait- what's this "EnumToolMaterial" thingy, you might ask? well, open up EnumToolMaterial and we'll find out!
In EnumToolMaterial, there are only 2 things we need to worry about. The first is this bit:
- Code:
WOOD("WOOD", 0, 0, 59, 2.0F, 0),
STONE("STONE", 1, 1, 131, 4F, 1),
IRON("IRON", 2, 2, 250, 6F, 2),
EMERALD("EMERALD", 3, 3, 1561, 8F, 3),
GOLD("GOLD", 4, 0, 32, 12F, 0),
This is right at the top of the file. Each of the numbers means a different thing- I'll edit this to include them when I remember the rest. In WOOD, the 59 is the number of uses, the second 0 is its strength, the 2.0F determines what it can break.
The other part we have to worry about is here:
- Code:
public static final EnumToolMaterial WOOD;
public static final EnumToolMaterial STONE;
public static final EnumToolMaterial IRON;
public static final EnumToolMaterial EMERALD;
public static final EnumToolMaterial GOLD;
All this does is declare each of the things described above. So now, we have to edit it to add in our own item's tool materials! But wait, you say! There's already an EMERALD decsribed! Well, that's why I called the one in mod_Emeralds.java 2EMERALD! So, to make 2EMERALD, we have to edit those two code lines to this:
- Code:
WOOD("WOOD", 0, 0, 59, 2.0F, 0),
STONE("STONE", 1, 1, 131, 4F, 1),
IRON("IRON", 2, 2, 250, 6F, 2),
EMERALD("EMERALD", 3, 3, 1561, 8F, 3),
GOLD("GOLD", 4, 0, 32, 12F, 0),
2EMERALD("2EMERALD", 3, 2, 800, 7F, 2),
This makes the 2EMERALD have 800 uses, and have 7F strength (among other things).
This is the second part you need to add:
- Code:
public static final EnumToolMaterial WOOD;
public static final EnumToolMaterial STONE;
public static final EnumToolMaterial IRON;
public static final EnumToolMaterial EMERALD;
public static final EnumToolMaterial GOLD;
public static final EnumToolMaterial 2EMERALD;
Now, save EnumToolMaterial and open up mod_Emeralds again. By now, you should know how to add texture overrides, but here's a basic one just in case:
- Code:
emeraldPick.iconIndex = ModLoader.addOverride("/gui/items.png", "/tutorial/emeraldpick.png");
emeraldShovel.iconIndex = ModLoader.addOverride("/gui/items.png", "/tutorial/emeraldshovel.png");
emeraldAxe.iconIndex = ModLoader.addOverride("/gui/items.png", "/tutorial/emeraldaxe.png");
emeraldHoe.iconIndex = ModLoader.addOverride("/gui/items.png", "/tutorial/emeraldhoe.png");
emeraldSword.iconIndex = ModLoader.addOverride("/gui/items.png", "/tutorial/emeraldsword.png");
Finally, you can add the names:
- Code:
ModLoader.AddName(emeraldPick, "Emerald Pickaxe");
ModLoader.AddName(emeraldShovel, "Emerald Shovel");
ModLoader.AddName(emeraldAxe, "Emerald Axe");
ModLoader.AddName(emeraldHoe, "Emerald Hoe");
ModLoader.AddName(emeraldSword, "Emerald Sword");
Now, this will compile and obfuscate, but you'll notice there are no recipes yet. This is why we need to move on to the next tutorial - Adding a Recipe!
Re: [Beginner] Creating a new Tool Set [22/4/11] [1.4_01] [2.11]
Don't you also need to make ItemEmeraldPick etc?
Vorn- Recruit
- Posts : 1
Join date : 2011-04-23
Re: [Beginner] Creating a new Tool Set [22/4/11] [1.4_01] [2.11]
no. it extends ItemPickaxe.Vorn wrote:Don't you also need to make ItemEmeraldPick etc?
shoopdawhoop23- Moderator
- Posts : 56
Join date : 2011-04-22
Similar topics
» [Beginner] Creating a new Block [22/4/11] [1.4_01] [2.11]
» [Beginner] Creating a new Item [22/4/11] [1.4_01] [2.11]
» [Beginner] Creating a new Recipe [22/4/11] [1.4_01] [2.11]
» [Unanswered] Emeralds basic question(s): Block idDrop issue and tool use lockup.
» [Beginner] Setting up MCP [23/4/11] [1.4_01] [2.11]
» [Beginner] Creating a new Item [22/4/11] [1.4_01] [2.11]
» [Beginner] Creating a new Recipe [22/4/11] [1.4_01] [2.11]
» [Unanswered] Emeralds basic question(s): Block idDrop issue and tool use lockup.
» [Beginner] Setting up MCP [23/4/11] [1.4_01] [2.11]
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|