I have a mod with a custom textured block. Everything works fine but when I play Minecraft, the block stays white and without my texture. My texture is in the mcp/eclipse/client/bin. Can someone please help me!
Here is my code:
package net.minecraft.src;
public class mod_Godstone extends BaseMod
{ public static final Block Godstone = new Godstone(160, 0).setBlockName("Godstone").setHardness(6F).setResistance(6F).setLightValue(3F);
public void load(){
Godstone.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/Godstone.png");
ModLoader.registerBlock(Godstone);
ModLoader.addName(Godstone, "Godstone");
ModLoader.addRecipe(new ItemStack(Godstone, 1), new Object []{"#", Character.valueOf('#'), Block.stone});
}
public String getVersion()
{
return "1.2.5";
}
}
Here is one of the code lines underneath the "Minecraft mc" bit:
mc.installResource("newsound/mob/spottedgrannymod/grannydefault.ogg", new File(mc.mcDataDir,"newsound/mob/spottedgrannymod/grannydefault.ogg"));
is this right? becuase my mob sound is inside "newsound/mob/spottedgranny" bu ti wasnt sure if i was meant to change it to be the same or not :/ PLease help mate
The correct line to use would be this:
mc.installResource("newsound/mob/spottedgrannymod/grannydefault.ogg", new File(mc.mcDataDir,"newsound/mob/spottedgrannymod/grannydefault.ogg"));
Im making the tools for my mod and i cant figure out how to fix this error:
== MCP 6.2 (data: 6.2, client: 1.2.5, server: 1.2.5) ==
# found jad, jad patches, ff patches, osx patches, srgs, name csvs, doc csvs, pa
ram csvs, astyle, astyle config
== Recompiling client ==
> Cleaning bin
> Recompiling
'"C:\Program Files\Java\jdk1.7.0_04\bin\javac" -Xlint:-options -deprecation -g -
source 1.6 -target 1....' failed : 1
== ERRORS FOUND ==
src\minecraft\net\minecraft\src\mod_Tools.java:4: error: cannot find symbol
public static final Item pickaxe = new ItemLeadPickaxe(2000, EnumToolMaterial.LE
AD).setItemName("pickaxe");
^
symbol: variable LEAD
location: class EnumToolMaterial
src\minecraft\net\minecraft\src\mod_Tools.java:5: error: cannot find symbol
public static final Item axe = new ItemLeadAxe(2001, EnumToolMaterial.LEAD).setI
temName("axe");
^
symbol: variable LEAD
location: class EnumToolMaterial
src\minecraft\net\minecraft\src\mod_Tools.java:6: error: cannot find symbol
public static final Item shovel = new ItemLeadShovel(2002, EnumToolMaterial.LEAD
).setItemName("shovel");
^
symbol: variable LEAD
location: class EnumToolMaterial
src\minecraft\net\minecraft\src\mod_Tools.java:7: error: cannot find symbol
public static final Item sword = new ItemLeadSword(2003, EnumToolMaterialLead.LE
AD).setItemName("sword");
^
symbol: variable LEAD
location: class EnumToolMaterialLead
src\minecraft\net\minecraft\src\mod_Tools.java:8: error: cannot find symbol
public static final Item hoe = new ItemLeadHoe(2004, EnumToolMaterialLead.LEAD).
setItemName("hoe");
^
symbol: variable LEAD
location: class EnumToolMaterialLead
5 errors
==================
!! Can not find server sources, try decompiling !!
Press any key to continue . . .
This is my coding:
package net.minecraft.src;
public class mod_Tools extends BaseMod
{
public static final Item pickaxe = new ItemLeadPickaxe(2000, EnumToolMaterial.LEAD).setItemName("pickaxe");
public static final Item axe = new ItemLeadAxe(2001, EnumToolMaterial.LEAD).setItemName("axe");
public static final Item shovel = new ItemLeadShovel(2002, EnumToolMaterial.LEAD).setItemName("shovel");
public static final Item sword = new ItemLeadSword(2003, EnumToolMaterialLead.LEAD).setItemName("sword");
public static final Item hoe = new ItemLeadHoe(2004, EnumToolMaterialLead.LEAD).setItemName("hoe");
public void load()
{
pickaxe.iconIndex = ModLoader.addOverride("/gui/items.png", "/LeadPickaxe.png");
axe.iconIndex = ModLoader.addOverride("/gui/items.png", "/LeadAxe.png");
shovel.iconIndex = ModLoader.addOverride("/gui/items.png", "/LeadShovel.png");
sword.iconIndex = ModLoader.addOverride("/gui/items.png", "/LeadSword.png");
hoe.iconIndex = ModLoader.addOverride("/gui/items.png", "/LeadHoe.png");
ModLoader.addName(pickaxe, "Lead Pickaxe");
ModLoader.addName(axe, "Lead Axe");
ModLoader.addName(shovel, "Lead Shovel");
ModLoader.addName(sword, "Lead Sword");
ModLoader.addName(hoe, "Lead Hoe");
ModLoader.addRecipe(new ItemStack(pickaxe, 1), new Object [] {
"###", " % ", " % ", '#', mod_tutorials.LeadIngot, '%', Item.stick
});
ModLoader.addRecipe(new ItemStack(axe, 1), new Object [] {
"##", "#%", " %", '#', mod_tutorials.LeadIngot, '%', Item.stick
});
ModLoader.addRecipe(new ItemStack(shovel, 1), new Object [] {
"#", "%", "%", '#', mod_tutorials.LeadIngot, '%', Item.stick
});
ModLoader.addRecipe(new ItemStack(sword, 1), new Object [] {
"#", "#", "%", '#', mod_tutorials.LeadIngot, '%', Item.stick
});
ModLoader.addRecipe(new ItemStack(hoe, 1), new Object [] {
"##", " %", " %", '#', mod_tutorials.LeadIngot, '%', Item.stick
});
}
public String getVersion()
{
return "1.2.5";
}
}
How can i fix this?
You are trying to use EnumToolMaterial for the first three tools. Change it to EnumToolMaterialLead in those lines.
“Computers are incredibly fast, accurate and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination."
Why are you still using Lead stuff... i thought you'd said you'd change it :/
I really don't mean any offence, but lead is not that original of an idea. That's like being upset that someone else besides yourself thought of adding rubies or sapphires to their code... Though, I'll back you up on the fact that I do recall him saying he'd change it.
package net.minecraft.src;
public class mod_Tools extends BaseMod
{
public static final Item pickaxe = new ItemLeadPickaxe(2000, EnumToolMaterial.LEAD).setItemName("pickaxe");
public static final Item axe = new ItemLeadAxe(2001, EnumToolMaterial.LEAD).setItemName("axe");
public static final Item shovel = new ItemLeadShovel(2002, EnumToolMaterial.LEAD).setItemName("shovel");
public static final Item sword = new ItemLeadSword(2003, EnumToolMaterialLead.LEAD).setItemName("sword");
public static final Item hoe = new ItemLeadHoe(2004, EnumToolMaterialLead.LEAD).setItemName("hoe");
public void load()
{
pickaxe.iconIndex = ModLoader.addOverride("/gui/items.png", "/LeadPickaxe.png");
axe.iconIndex = ModLoader.addOverride("/gui/items.png", "/LeadAxe.png");
shovel.iconIndex = ModLoader.addOverride("/gui/items.png", "/LeadShovel.png");
sword.iconIndex = ModLoader.addOverride("/gui/items.png", "/LeadSword.png");
hoe.iconIndex = ModLoader.addOverride("/gui/items.png", "/LeadHoe.png");
ModLoader.addName(pickaxe, "Lead Pickaxe");
ModLoader.addName(axe, "Lead Axe");
ModLoader.addName(shovel, "Lead Shovel");
ModLoader.addName(sword, "Lead Sword");
ModLoader.addName(hoe, "Lead Hoe");
ModLoader.addRecipe(new ItemStack(pickaxe, 1), new Object [] {
"###", " % ", " % ", '#', mod_tutorials.LeadIngot, '%', Item.stick
});
ModLoader.addRecipe(new ItemStack(axe, 1), new Object [] {
"##", "#%", " %", '#', mod_tutorials.LeadIngot, '%', Item.stick
});
ModLoader.addRecipe(new ItemStack(shovel, 1), new Object [] {
"#", "%", "%", '#', mod_tutorials.LeadIngot, '%', Item.stick
});
ModLoader.addRecipe(new ItemStack(sword, 1), new Object [] {
"#", "#", "%", '#', mod_tutorials.LeadIngot, '%', Item.stick
});
ModLoader.addRecipe(new ItemStack(hoe, 1), new Object [] {
"##", " %", " %", '#', mod_tutorials.LeadIngot, '%', Item.stick
});
}
public String getVersion()
{
return "1.2.5";
}
}
ItemLeadIngot:
package net.minecraft.src;
public class ItemLeadIngot extends Item{
public ItemLeadIngot(int i){
super(i);
maxStackSize = 64;
}
}
First of all, this code you're using changes or adds to a base class, which is EnumToolMaterials. If you actually added LEAD to EnumToolMaterials, I don't think you'll get much help here, as these tutorials are aimed at not editing base classes. If you want Lead as a new type of Tool Material, follow the Tools tutorial posted in the second post of this thread. (Right under the main post)
Secondly, your code is a mess. Some of the tools refer to EnumToolMaterials, others refer to EnumToolMaterialsLead. As mentioned above, the purpose of these tutorials (in your case) is to not have any of your tools change or reference EnumToolMaterials at all. So here's a couple things that need fixing up:
Lead ingots themselves do not need its own class file if the only property you're giving it is a max stack of 64. By default, an "= new Item" will default to a stack size of 64. The only thing you really need the lead for is for your recipes. So, it doesn't need its own class file, as it doesn't have any special qualities. So, the only thing you need for your ingots are the same as every other items you made. (Refer to the bottom of my post for further details on this)
If lead is literally the only type of new tool you plan on adding, then your item declarations are fine. But if you plan on adding a different type after that, simply leaving them as public static final item pickaxe is ill-advised. Make sure to give your declarations meaningful names so that you don't have to go looking for it every time you add or change code for it. (such as pickaxeLead or leadPickaxe)
You want all of your tools material types to come from a class file you created rather than one already in the game. This being said, "EnumToolMaterialsLead" is fine if you plan on ONLY adding lead. If you're going to add more than just lead, try giving it a more general name.
Each one of your items is referring to a class file which I'm not sure you've even created, as you've not brought it or posted the code to at all. When you say "public static final Item pickaxe = new ItemLeadPickaxe", it means your code is trying to create a new ItemLeadPickaxe. This cannot happen if it doesn't have its own class file. You'd need to create the "ItemLeadPickaxe" class file first. Same goes for the other tool types. (again, refer to the tools tutorial in the second post on the first page of this thread)
Some of the things I mentioned are not absolutely necessary, but I'd say you don't fully understand the coding itself. It might be a better idea to just follow along. In learning how these things work, you'll need at least patience, and to read everything through carefully. If you can't follow along, or don't have the patience to do so, then you may not be ready for something like coding. (And no, I'm not saying that you don't. I'm just giving you a heads up)
About your Lead Ingots. You need to declare the ingot in your code. I'd suggest to delete the class file you made for ItemLeadIngot, and instead add the following to your mod_* class
public static final Item leadIngot = new Item(1999).setItemName("leadIngot");
As well as the necessary overrides and code to make it work in-game. (ModLoader.AddName, and if you plan on making it out of something else such as an ore or other block, give it a recipe also)
Sorry for the novel.
EDIT: Sorry, TechGuy. I started typing up this reply before you posted again. :s Not trying to steal anyones thunder... lol
Okay this maybe completely retarded but i'm starting from scratch here (no experience or anything) I have followed all of the "getting started" steps seems to be ok so far. However, When i went to the Modloader section you have code. Seems simple enough, I just don't have any clue where to type that code into. Help would be very much appreciated.
Okay this maybe completely retarded but i'm starting from scratch here (no experience or anything) I have followed all of the "getting started" steps seems to be ok so far. However, When i went to the Modloader section you have code. Seems simple enough, I just don't have any clue where to type that code into. Help would be very much appreciated.
If you're referring to "The ModLoader Basics" section, you don't need to add that code at all. That's just showing you what certain methods do for when you add code later on. But most of your code will be placed in a new file.
On the top bar (with all the little pictures), you'll want to click "New Java Class" (The green C with a little yellow + on it). From there, type in the name for your file that will hold most of your mod information. (mod_Example) Make sure that the first 'm' in "mod_Example" is lower-case. Java is very picky about misplaced capitalization. You might need to create more classes at other times, but this is the class where you'll declare mostly all new content.
Rollback Post to RevisionRollBack
I used to maintain the Minecraft Forums Mod List. However, life has stepped in the way of that. Perhaps later...
If you're referring to "The ModLoader Basics" section, you don't need to add that code at all. That's just showing you what certain methods do for when you add code later on. But most of your code will be placed in a new file.
On the top bar (with all the little pictures), you'll want to click "New Java Class" (The green C with a little yellow + on it). From there, type in the name for your file that will hold most of your mod information. (mod_Example) Make sure that the first 'm' in "mod_Example" is lower-case. Java is very picky about misplaced capitalization. You might need to create more classes at other times, but this is the class where you'll declare mostly all new content.
thank you very much. So nothing in the Modloader basics needs to be added to any other class or the one i created?
I really don't mean any offence, but lead is not that original of an idea. That's like being upset that someone else besides yourself thought of adding rubies or sapphires to their code... Though, I'll back you up on the fact that I do recall him saying he'd change it.
First of all, this code you're using changes or adds to a base class, which is EnumToolMaterials. If you actually added LEAD to EnumToolMaterials, I don't think you'll get much help here, as these tutorials are aimed at not editing base classes. If you want Lead as a new type of Tool Material, follow the Tools tutorial posted in the second post of this thread. (Right under the main post)
Secondly, your code is a mess. Some of the tools refer to EnumToolMaterials, others refer to EnumToolMaterialsLead. As mentioned above, the purpose of these tutorials (in your case) is to not have any of your tools change or reference EnumToolMaterials at all. So here's a couple things that need fixing up:
Lead ingots themselves do not need its own class file if the only property you're giving it is a max stack of 64. By default, an "= new Item" will default to a stack size of 64. The only thing you really need the lead for is for your recipes. So, it doesn't need its own class file, as it doesn't have any special qualities. So, the only thing you need for your ingots are the same as every other items you made. (Refer to the bottom of my post for further details on this)
If lead is literally the only type of new tool you plan on adding, then your item declarations are fine. But if you plan on adding a different type after that, simply leaving them as public static final item pickaxe is ill-advised. Make sure to give your declarations meaningful names so that you don't have to go looking for it every time you add or change code for it. (such as pickaxeLead or leadPickaxe)
You want all of your tools material types to come from a class file you created rather than one already in the game. This being said, "EnumToolMaterialsLead" is fine if you plan on ONLY adding lead. If you're going to add more than just lead, try giving it a more general name.
Each one of your items is referring to a class file which I'm not sure you've even created, as you've not brought it or posted the code to at all. When you say "public static final Item pickaxe = new ItemLeadPickaxe", it means your code is trying to create a new ItemLeadPickaxe. This cannot happen if it doesn't have its own class file. You'd need to create the "ItemLeadPickaxe" class file first. Same goes for the other tool types. (again, refer to the tools tutorial in the second post on the first page of this thread)
Some of the things I mentioned are not absolutely necessary, but I'd say you don't fully understand the coding itself. It might be a better idea to just follow along. In learning how these things work, you'll need at least patience, and to read everything through carefully. If you can't follow along, or don't have the patience to do so, then you may not be ready for something like coding. (And no, I'm not saying that you don't. I'm just giving you a heads up)
About your Lead Ingots. You need to declare the ingot in your code. I'd suggest to delete the class file you made for ItemLeadIngot, and instead add the following to your mod_* class
public static final Item leadIngot = new Item(1999).setItemName("leadIngot");
As well as the necessary overrides and code to make it work in-game. (ModLoader.AddName, and if you plan on making it out of something else such as an ore or other block, give it a recipe also)
Sorry for the novel.
EDIT: Sorry, TechGuy. I started typing up this reply before you posted again. :s Not trying to steal anyones thunder... lol
Haha, no problem. You explained everything and I didn't Your reply is much for useful than mine was.
Rollback Post to RevisionRollBack
“Computers are incredibly fast, accurate and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination."
thank you very much. So nothing in the Modloader basics needs to be added to any other class or the one i created?
Some parts will be added to the one you create, but those parts will be specified during each tutorial. Give it a whirl, and if you have any problems, either post here, or contact me via PM.
Rollback Post to RevisionRollBack
I used to maintain the Minecraft Forums Mod List. However, life has stepped in the way of that. Perhaps later...
Some parts will be added to the one you create, but those parts will be specified during each tutorial. Give it a whirl, and if you have any problems, either post here, or contact me via PM.
thanks again i really appreciate your help. I have a mod idea that i'm trying to get made (obviously) didn't get a lot of attention in the mods request forums. And this all goes into that one class i made or do i make multiple classes based on mod_block ect.?
thanks again i really appreciate your help. I have a mod idea that i'm trying to get made (obviously) didn't get a lot of attention in the mods request forums. And this all goes into that one class i made or do i make multiple classes based on mod_block ect.?
You only need to make new classes for blocks/items that have special properties such as it drops something else when mined, or if it's an advanced block like stairs or slabs.
Rollback Post to RevisionRollBack
I used to maintain the Minecraft Forums Mod List. However, life has stepped in the way of that. Perhaps later...
I have a mod with a custom textured block. Everything works fine but when I play Minecraft, the block stays white and without my texture. My texture is in the mcp/eclipse/client/bin. Can someone please help me!
Here is my code:
package net.minecraft.src;
public class mod_Godstone extends BaseMod
{ public static final Block Godstone = new Godstone(160, 0).setBlockName("Godstone").setHardness(6F).setResistance(6F).setLightValue(3F);
public void load(){
Godstone.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/Godstone.png");
ModLoader.registerBlock(Godstone);
ModLoader.addName(Godstone, "Godstone");
ModLoader.addRecipe(new ItemStack(Godstone, 1), new Object []{"#", Character.valueOf('#'), Block.stone});
}
public String getVersion()
{
return "1.2.5";
}
}
I think it doesn't recognize the path. You should add your textures to a folder. So it becomes: mcp/eclipse/client/bin/MODNAME.
Can someone help me with this error from modloader:
Mods loaded: 3
ModLoader 1.2.5
mod_Godstone 1.2.5
mod_Godstonesword 1.2.5
Minecraft has crashed!
----------------------
Minecraft has stopped running because it encountered a problem.
--- BEGIN ERROR REPORT 9ffe00c1 --------
Generated 13-6-12 16:28
Minecraft: Minecraft 1.2.5
OS: Windows Vista (x86) version 6.0
Java: 1.6.0_31, Sun Microsystems Inc.
VM: Java HotSpot(TM) Client VM (mixed mode), Sun Microsystems Inc.
LWJGL: 2.4.2
OpenGL: ATI Mobility Radeon HD 3470 version 2.1.7770 Release, ATI Technologies Inc.
java.lang.NullPointerException
at net.minecraft.src.CraftingManager.addRecipe(CraftingManager.java:398)
at net.minecraft.src.ModLoader.addRecipe(ModLoader.java:412)
at net.minecraft.src.mod_Godstonesword.load(mod_Godstonesword.java:11)
at net.minecraft.src.ModLoader.init(ModLoader.java:856)
at net.minecraft.src.ModLoader.addAllRenderers(ModLoader.java:157)
at net.minecraft.src.RenderManager.<init>(RenderManager.java:85)
at net.minecraft.src.RenderManager.<clinit>(RenderManager.java:12)
at net.minecraft.client.Minecraft.startGame(Minecraft.java:424)
at net.minecraft.client.Minecraft.run(Minecraft.java:786)
at java.lang.Thread.run(Unknown Source)
--- END ERROR REPORT 19a55624 ----------
Here is the code.
Godstone_mod.java:
package net.minecraft.src;
public class mod_Godstone extends BaseMod
{ public static final Block Godstone = new Godstone(160, 0).setBlockName("Godstone").setHardness(5F).setResistance(6F).setLightValue(3F);
public void load(){
Godstone.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/Godstone.png");
ModLoader.registerBlock(Godstone);
ModLoader.addName(Godstone, "Godstone");
ModLoader.addRecipe(new ItemStack(Godstone, 1), new Object []{" # ", "","" ,Character.valueOf('#'), Block.stone, Character.valueOf('@'), Item.diamond});
}
public String getVersion()
{
return "1.2.5";
}
}
Godstone.java:
package net.minecraft.src;
import java.util.Random;
public class Godstone extends Block
{
public static int Godstone;
public static int iconIndex;
public static int itemIndex;
public Godstone (int i, int j)
{
super(i, j, Material.wood);
}
public int idDropped(int i, Random random, int j)
{
return mod_Godstone.Godstone.blockID;
}
public int quantityDropped(Random random)
{
return 1;
}}
Godstonesword_mod.java:
package net.minecraft.src;
public class mod_Godstonesword extends BaseMod
{
public static final Item Godstonesword = new Godstonesword (5000).setItemName("Godstonesword");
public void load()
{
Godstone.itemIndex = ModLoader.addOverride("/gui/items.png", "Godstonesword.pgn");
ModLoader.addName(Godstonesword, "Godstone sword");
ModLoader.addRecipe(new ItemStack(Godstonesword, 1), new Object [] {" # ", "@#@", " % ", Character.valueOf('#'),Block.Godstone, Character.valueOf('@'), Item.stick ,Character.valueOf('%'), Item.diamond});
}
public String getVersion()
{
return "1.2.5";
}
}
Godstonesword.java:
package net.minecraft.src;
public class Godstonesword extends Item
{
public Godstonesword(int i)
{
super(i);
maxStackSize = 1;
maxDamage = 1750;
field_22047_d = 10;
}
public void hitEntity(ItemStack itemstack, EntityLiving entityliving)
{
itemstack.damageItem(1, entityliving);
}
public void hitBlock(ItemStack itemstack, int i, int j, int k, int l)
{
itemstack.damageItem(5, null);
}
public int getDamageVsEntity(Entity entity)
{
return field_22047_d;
}
public boolean isFull3D()
{
return true;
}
private int field_22047_d;
}
Well, first of all, you have all of your different items in their own separate mod_* classes. there shouldn't be more than a single mod_* class. It's just there as a container for all of your new declarations, and to block or item classes that are already there, or you add. If you add a new item or block that has special properties, then you need to create its own class file. If you're creating a class file for an item that has special properties, you don't name it with the "mod_" prefix.
Another thing, you have two empty rows in your Godstone recipe. Here's what you have:
So, the # symbols represent the wood in the recipe. And each set of quotes represents a row. A space means an empty slot. So, how that would look on a crafting table is this:
Thanks! but it says I need a own file for the Godstonesword.
For your little thing to work, you need:
File:
mod_Godstone.
Contents:
-block and item declarations,
-block and item recipes
-block and item sprite overrides.
File:
ItemGodsword
Contents:
copy ItemSword, and paste the stuff here. If you want a custom material, you either change EnumToolMaterial, or you make your own EnumToolMaterial file.
File:
BlockGodstone.
Contents:
Your block declaration here.
package net.minecraft.src; public class mod_Tools extends BaseMod { public static final Item pickaxe = new ItemLeadPickaxe(2000, EnumToolMaterial.LEAD).setItemName("pickaxe"); public static final Item axe = new ItemLeadAxe(2001, EnumToolMaterial.LEAD).setItemName("axe"); public static final Item shovel = new ItemLeadShovel(2002, EnumToolMaterial.LEAD).setItemName("shovel"); public static final Item sword = new ItemLeadSword(2003, EnumToolMaterialLead.LEAD).setItemName("sword"); public static final Item hoe = new ItemLeadHoe(2004, EnumToolMaterialLead.LEAD).setItemName("hoe"); public void load() { pickaxe.iconIndex = ModLoader.addOverride("/gui/items.png", "/LeadPickaxe.png"); axe.iconIndex = ModLoader.addOverride("/gui/items.png", "/LeadAxe.png"); shovel.iconIndex = ModLoader.addOverride("/gui/items.png", "/LeadShovel.png"); sword.iconIndex = ModLoader.addOverride("/gui/items.png", "/LeadSword.png"); hoe.iconIndex = ModLoader.addOverride("/gui/items.png", "/LeadHoe.png"); ModLoader.addName(pickaxe, "Lead Pickaxe"); ModLoader.addName(axe, "Lead Axe"); ModLoader.addName(shovel, "Lead Shovel"); ModLoader.addName(sword, "Lead Sword"); ModLoader.addName(hoe, "Lead Hoe"); ModLoader.addRecipe(new ItemStack(pickaxe, 1), new Object [] { "###", " % ", " % ", '#', mod_tutorials.LeadIngot, '%', Item.stick }); ModLoader.addRecipe(new ItemStack(axe, 1), new Object [] { "##", "#%", " %", '#', mod_tutorials.LeadIngot, '%', Item.stick }); ModLoader.addRecipe(new ItemStack(shovel, 1), new Object [] { "#", "%", "%", '#', mod_tutorials.LeadIngot, '%', Item.stick }); ModLoader.addRecipe(new ItemStack(sword, 1), new Object [] { "#", "#", "%", '#', mod_tutorials.LeadIngot, '%', Item.stick }); ModLoader.addRecipe(new ItemStack(hoe, 1), new Object [] { "##", " %", " %", '#', mod_tutorials.LeadIngot, '%', Item.stick }); } public String getVersion() { return "1.2.5"; } }ItemLeadIngot:
package net.minecraft.src; public class ItemLeadIngot extends Item{ public ItemLeadIngot(int i){ super(i); maxStackSize = 64; } }Why are you still using Lead stuff... i thought you'd said you'd change it :/
Hmm, not sure.
The correct line to use would be this:
mc.installResource("newsound/mob/spottedgrannymod/grannydefault.ogg", new File(mc.mcDataDir,"newsound/mob/spottedgrannymod/grannydefault.ogg"));Then you use this in your mob class:
protected String getLivingSound() { return "mob.spottedgrannymod.grannydefault"; }It looks as if your texture file isn't 16x16pixels and Minecraft is resizing it to that. Make sure the dimensions of your texture file are 16x16pixels
Have a look at this page. I haven't tried it but what they show should work.
What do you mean?
You are trying to use EnumToolMaterial for the first three tools. Change it to EnumToolMaterialLead in those lines.
More than one mod can have lead in it
together they are powerful beyond imagination."
-
View User Profile
-
View Posts
-
Send Message
Retired StaffI really don't mean any offence, but lead is not that original of an idea. That's like being upset that someone else besides yourself thought of adding rubies or sapphires to their code... Though, I'll back you up on the fact that I do recall him saying he'd change it.
First of all, this code you're using changes or adds to a base class, which is EnumToolMaterials. If you actually added LEAD to EnumToolMaterials, I don't think you'll get much help here, as these tutorials are aimed at not editing base classes. If you want Lead as a new type of Tool Material, follow the Tools tutorial posted in the second post of this thread. (Right under the main post)
Secondly, your code is a mess. Some of the tools refer to EnumToolMaterials, others refer to EnumToolMaterialsLead. As mentioned above, the purpose of these tutorials (in your case) is to not have any of your tools change or reference EnumToolMaterials at all. So here's a couple things that need fixing up:
- Lead ingots themselves do not need its own class file if the only property you're giving it is a max stack of 64. By default, an "= new Item" will default to a stack size of 64. The only thing you really need the lead for is for your recipes. So, it doesn't need its own class file, as it doesn't have any special qualities. So, the only thing you need for your ingots are the same as every other items you made. (Refer to the bottom of my post for further details on this)
- If lead is literally the only type of new tool you plan on adding, then your item declarations are fine. But if you plan on adding a different type after that, simply leaving them as public static final item pickaxe is ill-advised. Make sure to give your declarations meaningful names so that you don't have to go looking for it every time you add or change code for it. (such as pickaxeLead or leadPickaxe)
- You want all of your tools material types to come from a class file you created rather than one already in the game. This being said, "EnumToolMaterialsLead" is fine if you plan on ONLY adding lead. If you're going to add more than just lead, try giving it a more general name.
- Each one of your items is referring to a class file which I'm not sure you've even created, as you've not brought it or posted the code to at all. When you say "public static final Item pickaxe = new ItemLeadPickaxe", it means your code is trying to create a new ItemLeadPickaxe. This cannot happen if it doesn't have its own class file. You'd need to create the "ItemLeadPickaxe" class file first. Same goes for the other tool types. (again, refer to the tools tutorial in the second post on the first page of this thread)
Some of the things I mentioned are not absolutely necessary, but I'd say you don't fully understand the coding itself. It might be a better idea to just follow along. In learning how these things work, you'll need at least patience, and to read everything through carefully. If you can't follow along, or don't have the patience to do so, then you may not be ready for something like coding. (And no, I'm not saying that you don't. I'm just giving you a heads up)About your Lead Ingots. You need to declare the ingot in your code. I'd suggest to delete the class file you made for ItemLeadIngot, and instead add the following to your mod_* class
public static final Item leadIngot = new Item(1999).setItemName("leadIngot");As well as the necessary overrides and code to make it work in-game. (ModLoader.AddName, and if you plan on making it out of something else such as an ore or other block, give it a recipe also)
Sorry for the novel.
EDIT: Sorry, TechGuy. I started typing up this reply before you posted again. :s Not trying to steal anyones thunder... lol
-
View User Profile
-
View Posts
-
Send Message
Retired Staff-
View User Profile
-
View Posts
-
Send Message
Retired StaffIf you're referring to "The ModLoader Basics" section, you don't need to add that code at all. That's just showing you what certain methods do for when you add code later on. But most of your code will be placed in a new file.
On the top bar (with all the little pictures), you'll want to click "New Java Class" (The green C with a little yellow + on it). From there, type in the name for your file that will hold most of your mod information. (mod_Example) Make sure that the first 'm' in "mod_Example" is lower-case. Java is very picky about misplaced capitalization. You might need to create more classes at other times, but this is the class where you'll declare mostly all new content.
-
View User Profile
-
View Posts
-
Send Message
Retired Staffthank you very much. So nothing in the Modloader basics needs to be added to any other class or the one i created?
Haha, no problem. You explained everything and I didn't
together they are powerful beyond imagination."
-
View User Profile
-
View Posts
-
Send Message
Retired StaffSome parts will be added to the one you create, but those parts will be specified during each tutorial. Give it a whirl, and if you have any problems, either post here, or contact me via PM.
-
View User Profile
-
View Posts
-
Send Message
Retired Staffthanks again i really appreciate your help. I have a mod idea that i'm trying to get made (obviously) didn't get a lot of attention in the mods request forums. And this all goes into that one class i made or do i make multiple classes based on mod_block ect.?
-
View User Profile
-
View Posts
-
Send Message
Retired StaffYou only need to make new classes for blocks/items that have special properties such as it drops something else when mined, or if it's an advanced block like stairs or slabs.
-
View User Profile
-
View Posts
-
Send Message
Retired Staff-
View User Profile
-
View Posts
-
Send Message
Retired StaffNot sure. Personally never added any effects to my blocks being broken. Probably, though.
I think it doesn't recognize the path. You should add your textures to a folder. So it becomes: mcp/eclipse/client/bin/MODNAME.
Then, change
Godstone.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/Godstone.png");to
Godstone.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/MODNAME/Godstone.png");.It's the only thing i can think of, the code seems to be perfectly fine.
could you at least help me make a new 'pane'? or tell me of someone who can?
-
View User Profile
-
View Posts
-
Send Message
Retired StaffWell, first of all, you have all of your different items in their own separate mod_* classes. there shouldn't be more than a single mod_* class. It's just there as a container for all of your new declarations, and to block or item classes that are already there, or you add. If you add a new item or block that has special properties, then you need to create its own class file. If you're creating a class file for an item that has special properties, you don't name it with the "mod_" prefix.
Another thing, you have two empty rows in your Godstone recipe. Here's what you have:
ModLoader.addRecipe(new ItemStack(Godstone, 1), new Object []{" # ", "","" ,Character.valueOf('#'), Block.stone, Character.valueOf('@'), Item.diamond});Here's what it should be if you only plan on using a single item for its creation:
ModLoader.addRecipe(new ItemStack(Godstone, 1), new Object []{"#", Character.valueOf('#'), Block.stone});You had no @ signs in the recipe to represent your diamonds, and thus, I didn't use them. Recipes work in rows. I'll use a chest recipe as an example.
ModLoader.addRecipe(new ItemStack(Block.chest, 1), new Object []{"###", "# #", "###", Character.valueOf('#'), Block.wood});So, the # symbols represent the wood in the recipe. And each set of quotes represents a row. A space means an empty slot. So, how that would look on a crafting table is this:
# #
###
Art by me: [email protected]
For your little thing to work, you need:
File:
mod_Godstone.
Contents:
-block and item declarations,
-block and item recipes
-block and item sprite overrides.
File:
ItemGodsword
Contents:
copy ItemSword, and paste the stuff here. If you want a custom material, you either change EnumToolMaterial, or you make your own EnumToolMaterial file.
File:
BlockGodstone.
Contents:
Your block declaration here.
That's it.