And I have another question: how to make blocks that are easy to breake with a pickaxe, but the stone pickaxe is faster than the wooden pickaxe and so on.
Look in ItemPickaxe. It's pretty easy to understand.
But I write "Block.xxxxxx" and it gives a error that says to introduce the block in the block list, but I wanna mod using modloader, did I have to introduce the block in the block.java?
Hi, I had created a mod like that, you can see it here: [1.7.3] CRAFTABLE GRASS V1.0
And I have one question: can I make a block that when is on fire it will burn and don't drop anything?
Set it's material to a flammable material.
In your block's constructor:
super(i, j, Material.<whatever material>)
Change the angle brackets to Material.wood or Material.wool.
I wanna create a new food type, and so I need a new item that is sugar on a furnace, so I had this code:
ModLoader.AddSmelting(Item.sugar, new ItemStack(mod_supersugar.stickysugar,1));
But it crashes my game.
Can I use sugar in a furnace? If yes how?
It hadn't worked
Put .shiftedIndex after Item.sugar.
As for the flammable block that should work. Look in Material.java and look at the Material of wood planks. The wood Material has a boolean set to true that allows it to burn.
Thanks again, you are helping me a lot, but I'm trying to understand how to use the damage values, I had already saw Itemcoal.java, but it hadn't worked... I want to use the damage values on blocks, using modloader, if you can make a example, like a mod_xxxx and/or a blockxxxxx, when you explain how to use damage values, I'll apreciate it a lot, because I'm tired of search and try and try....
Look at BlockWool or half slabs. Those both have damage values.
In the spoiler is the source of blockcloth.java (wool)
Can you underline/bold the part that is related with the damage values and show how it works please?
// 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:
// Block, Material
public class BlockCloth extends Block
{
public BlockCloth()
{
super(35, 64, Material.cloth);
}
public int getBlockTextureFromSideAndMetadata(int i, int j)
{
if(j == 0)
{
return blockIndexInTexture;
} else
{
j = ~(j & 0xf);
return 113 + ((j & 8) >> 3) + (j & 7) * 16;
}
}
protected int damageDropped(int i)
{
return i;
}
public static int func_21034_c(int i)
{
return ~i & 0xf;
}
public static int func_21035_d(int i)
{
return ~i & 0xf;
}
}
Honestly I thought it was in that file :ohmy.gif:
I'll look into it later, as I've always wondered myself. I know how to do it with items, but blocks are a bit unclear. It has to do with metadata, which can be very complex.
I have a problem, when I'm trying to test a block recipe I get this error message:
Minecraft has crashed!
----------------------
Minecraft has stopped running because it encountered a problem.
If you wish to report this, please copy this entire text and email it to [email protected].
Please include a description of what you did when the error occured.
java.lang.NullPointerException
at net.minecraft.src.EntityDiggingFX.func_4041_a(EntityDiggingFX.java:35)
at net.minecraft.src.EffectRenderer.addBlockHitEffects(EffectRenderer.java:193)
at net.minecraft.client.Minecraft.sendClickBlockToController(Minecraft.java:776)
at net.minecraft.client.Minecraft.runTick(Minecraft.java:1155)
at net.minecraft.client.Minecraft.run(Minecraft.java:480)
at java.lang.Thread.run(Unknown Source)
I have a slightly more advanced question. I was curious how to get a recipe to return buckets. I have sorted through a lot of Notch's code looking around for his cake recipe (it places the 3 buckets in the same formation as the recipe but empty). If you even know where this code is located (class or preferably method) please reply. If not but know a way to do it that would work too. I am not trying to be a perfect coder, just wanna not lose 3 iron every time I craft custom recipes =P
I have a slightly more advanced question. I was curious how to get a recipe to return buckets. I have sorted through a lot of Notch's code looking around for his cake recipe (it places the 3 buckets in the same formation as the recipe but empty). If you even know where this code is located (class or preferably method) please reply. If not but know a way to do it that would work too. I am not trying to be a perfect coder, just wanna not lose 3 iron every time I craft custom recipes =P
I'm pretty sure it returns the empty buckets automatically. I haven't tested it lately, but I did at one point have a recipe that included buckets and it returned them automatically. I'll do some looking around.
I'm pretty sure it returns the empty buckets automatically. I haven't tested it lately, but I did at one point have a recipe that included buckets and it returned them automatically. I'll do some looking around.
Well thats interesting. I had no idea. I will give it a shot just completing the mod (since I use inv hacking to test anyway =P) and seeing if it returns. Thanks for the speedy response.
EDIT: Well thats pretty nice for me (being a noob and all). It DOES automatically return empty buckets. Thanks for the help. I assumed it would have been written somewhere into the code but not be automatic (I have noticed several instances where Notch likes doing that).
im having problems getting my new ore to drop an item. I've done everything i should have to do to make it drop my item
but it still just gives me the block.
well, i did all the coding an stuff but its stuck as a JAVA file. doesn't the bin use CLASS files?
Study Java a bit more. The code you edit is in .java format, but as it is compiled into what is called bytecode it turns the .java files into .class files, which is what the game (or any program, for that matter) runs off.
Run recompile.bat then reobfuscate.bat from MCP. Afterwards, look in \reobf\minecraft for the class files.
Now, I've follwed at least 4 tutorials on how to add a toolset, and I've got everything down but (in-game) the moment I left click a block with my new tool, Minecraft Crashes. I got no compilation errors, and it probably is something super simple like a capitalization mistake or messing up , with ;, as tbis is my very first mod. If someone could help me, That would be greatly appreciated.
Now, I've follwed at least 4 tutorials on how to add a toolset, and I've got everything down but (in-game) the moment I left click a block with my new tool, Minecraft Crashes. I got no compilation errors, and it probably is something super simple like a capitalization mistake or messing up , with ;, as tbis is my very first mod. If someone could help me, That would be greatly appreciated.
Coding errors are caught by the compiler, so you wouldn't have the game crash by any errors in the syntax.
Your problem could be anything by the way you describe it. The only way to know for sure what is happening is to get a stack trace. Install the mod files into your actual game, download this and run it. Post the stack trace and I'll be able to help more.
Look in ItemPickaxe. It's pretty easy to understand.
Instead of Block put your mod_ class.
package net.minecraft.src;
public class mod_GrassMod extends BaseMod
{
public String Version()
{
return "1.xx7.3";
}
public mod_GrassMod()
{
ModLoader.AddRecipe(new ItemStack(Block.grass, 2), new Object[] {"S", "D", Character.valueOf('D'), Block.dirt, Character.valueOf('S'), Item.seeds});
}
}
And here is the error message:
2011-08-22 00:20 - commands.recompile - ERROR - src\minecraft\net\minecraft\src\mod_GrassMod.java:12: cannot find symbol
2011-08-22 00:20 - commands.recompile - ERROR - symbol : variable ModLoader
2011-08-22 00:20 - commands.recompile - ERROR - location: class net.minecraft.src.mod_GrassMod
2011-08-22 00:20 - commands.recompile - ERROR - ModLoader.AddRecipe(new ItemStack(Block.grass, 2), new Object[] {"S", "D", Character.valueOf('D'), Block.dirt, Character.valueOf('S'), Item.seeds});
Any help?
Set it's material to a flammable material.
In your block's constructor:
Change the angle brackets to Material.wood or Material.wool.
Put .shiftedIndex after Item.sugar.
As for the flammable block that should work. Look in Material.java and look at the Material of wood planks. The wood Material has a boolean set to true that allows it to burn.
Look at BlockWool or half slabs. Those both have damage values.
Honestly I thought it was in that file :ohmy.gif:
I'll look into it later, as I've always wondered myself. I know how to do it with items, but blocks are a bit unclear. It has to do with metadata, which can be very complex.
It might be a while before any tutorial comes out. School just started for me and it's been really rough. I'll try tomorrow, but no promises.
Minecraft has crashed!
----------------------
Minecraft has stopped running because it encountered a problem.
If you wish to report this, please copy this entire text and email it to [email protected].
Please include a description of what you did when the error occured.
java.lang.NullPointerException
at net.minecraft.src.EntityDiggingFX.func_4041_a(EntityDiggingFX.java:35)
at net.minecraft.src.EffectRenderer.addBlockHitEffects(EffectRenderer.java:193)
at net.minecraft.client.Minecraft.sendClickBlockToController(Minecraft.java:776)
at net.minecraft.client.Minecraft.runTick(Minecraft.java:1155)
at net.minecraft.client.Minecraft.run(Minecraft.java:480)
at java.lang.Thread.run(Unknown Source)
I'm pretty sure it returns the empty buckets automatically. I haven't tested it lately, but I did at one point have a recipe that included buckets and it returned them automatically. I'll do some looking around.
Well thats interesting. I had no idea. I will give it a shot just completing the mod (since I use inv hacking to test anyway =P) and seeing if it returns. Thanks for the speedy response.
EDIT: Well thats pretty nice for me (being a noob and all). It DOES automatically return empty buckets. Thanks for the help. I assumed it would have been written somewhere into the code but not be automatic (I have noticed several instances where Notch likes doing that).
but it still just gives me the block.
and heres the screenies
part 1
part 2
Check your capitalization. Java is very sensitive to caps, and things can especially get compiled wrongly if you don't follow the proper convention.
Study Java a bit more. The code you edit is in .java format, but as it is compiled into what is called bytecode it turns the .java files into .class files, which is what the game (or any program, for that matter) runs off.
Run recompile.bat then reobfuscate.bat from MCP. Afterwards, look in \reobf\minecraft for the class files.
Coding errors are caught by the compiler, so you wouldn't have the game crash by any errors in the syntax.
Your problem could be anything by the way you describe it. The only way to know for sure what is happening is to get a stack trace. Install the mod files into your actual game, download this and run it. Post the stack trace and I'll be able to help more.