If setItemName isn't working for you, try the func_20011_a function, simply replace setItemName with func_20011_a I had this problem before..[/quote]
can u tell me how i type it i tried .func_ but that didnt work i also tried func_ but it didnt work either
Hello again everyone. How would I go about getting a block to spawn ONLY on the edge of specific blocks? like I ONLY want say, sand to spawn next to dirt? (not what i'm using it for, just an example =]) any help?
You would have to write your own World Generation file (I hope you're good with Java).
You can use the World.getBlockID(X, Y, Z) function to get a block's type from coordinates.
The game typically uses random coordinates (because most things are randomly generated), so you'll just have to loop until you find a block you need, or until you've done too many tries and you want to quit.
(If block is never found it = endless loop, so don't try to find one forever.)
What he said. Check the blocks around the cords your given and if they match a ceratin block place it. If not don't place it. Or place the required ones next to it then place what you want.
Ah alright guys thanks. Not that great with java, lol, maybe I'll tear apart the original world gen files and see if I can piece something together lol
EDIT: what if I just replaced my blocks in this code and saved as a new world gen?
He gave you all the info you need. See he's trying to use stairCompactStone in the Block class. but thats not where the it resides. It resides in the class he's trying to use it from. So if he removed the Block. it would work.
He gave you all the info you need. See he's trying to use stairCompactStone in the Block class. but thats not where the it resides. It resides in the class he's trying to use it from. So if he removed the Block. it would work.
Thanks for the help. So I removed the Block and it recompiled properly and reobfuscated with no problems.
So I applied the mod to minecraft and it crashes the game whenever i try the recipe...
Any idea why? I'm drained trying to understand how to get this mod working.
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.
Mods loaded: 2
ModLoader Beta 1.2_02v4
mod_StoneStairs 1.2_02
--- BEGIN ERROR REPORT ed5ba21f --------
Generated 2/20/11 4:25 PM
Minecraft: Minecraft Beta 1.2_02
OS: Windows XP (x86) version 5.1
Java: 1.6.0_23, Sun Microsystems Inc.
VM: Java HotSpot(TM) Client VM (mixed mode), Sun Microsystems Inc.
LWJGL: 2.4.2
OpenGL: GeForce 9500 GT/PCI/SSE2 version 3.3.0, NVIDIA Corporation
java.lang.NullPointerException
at gm.e(SourceFile:110)
at gm.g(SourceFile:124)
at al.b(SourceFile:170)
at ft.a(SourceFile:139)
at ft.a(SourceFile:64)
at ll.b(SourceFile:360)
at net.minecraft.client.Minecraft.run(SourceFile:705)
at java.lang.Thread.run(Unknown Source)
--- END ERROR REPORT d73b34ad ----------
You didn't register your block so the game doesn't know about it.
Look in risugami's javadoc about modloader on how to do that.
PS MY 100th post!!! :biggrin.gif:
Thanks for the reply and...
Congratulations on the 100th post :smile.gif:
After trying to figure out how to register a block...
This is a code i came up with:
package net.minecraft.src;
public class mod_StoneStairs extends BaseMod
{
public String Version()
{
return "1.2_02";
}
public static final Block stairCompactStone;
public static void RegisterBlock(Block stairCompactStone);
public static void AddName(Block stairCompactStone, "Smooth Stone Stairs");
static
{
stairCompactStone = (new BlockStairs(93, Block.stone)).setBlockName("stairCompactStone");
}
public void AddRecipes(CraftingManager recipes)
{
recipes.addRecipe(new ItemStack(stairCompactStone, 4), new Object[] {
"# ", "## ", "###", Character.valueOf('#'), Block.stone
});
}
}
But it gives me this error upon recompiling:
*** Minecraft Coder Pack Version 2.8 ***
MCP 2.8 running in C:\MCP
Compiling Minecraft
sources\minecraft\net\minecraft\src\mod_StoneStairs.java:14: illegal start of ty
pe
public static void AddName(Block stairCompactStone, "Smooth Stone Stairs
");
^
1 error
*** minecraft_server.jar was not found, skipping
=== MCP 2.8 recompile script finished ===
Press any key to continue . . .
I can't figure out what i need to do to fix it? Can you help?
Can someone decipher the code of the house for me?
I dont understand it and i wanna make the house rly good.
Also how do i name my blocks without modloader?
Func_ and itemname arent working...
Hey, all! Quick question, I've made the item class, but how can I assign it a custom graphic? I have an "items2.png" file, but how would I assign, say ItemCoord(10,5) to an item?
I keep getting the same error when I go to compile the world generator tutorial code.
The code is
package net.minecraft.src;
import java.util.Random;
public class WorldGenExample extends WorldGenerator
{
public WorldGenExample()
{
}
public boolean generate(World world, Random random, int i, int j, int k)
{
// Gives this a 1 in 10 chance of generating
if (random.nextInt(10) == 0)
{
// Loops 64 times, this could create up to 64 TNT
for (int z = 0; z < 64; z++)
{
int i1 = i + random.nextInt(8) - random.nextInt(8);
int j1 = j + random.nextInt(8) - random.nextInt(8);
int k1 = k + random.nextInt(8) - random.nextInt(8);
// Checks that there is nothing in the current location and there is grass beneath.
if(world.getBlockId(i1, j1, k1) == 0 && world.getBlockId(i1, j1 - 1, k1) == Block.grass.blockID && Block.tnt.canPlaceBlockAt(world, i1, j1, k1))
{
world.setBlockAndMetadata(i1, j1, k1, Block.tnt.blockID, random.nextInt(4));
}
}
}
}
}
But I get an this when I run recompile.bat
*** Minecraft Coder Pack Version 2.8 ***
MCP 2.8 running in C:\Users\Ade\Minecraft-mods
Compiling Minecraft
sources\minecraft\net\minecraft\src\WorldGenExample.java:31: missing return stat
ement
}
^
1 error
*** minecraft_server.jar was not found, skipping
=== MCP 2.8 recompile script finished ===
Press any key to continue . . .
Can somebody help?
You clearly forgot to add or delete a bracket you didn't had to put there.
There must be the same amount of } as { in a class file.
If your not from england/america(like me)
A bracket = }
or this = {
I wasn't going to say anything because all this guy did was copy and paste the code. The thing he is missing for the boolean is a return type. a line saying
return something;
I have prob, Im trying to make a tool and ive got everything done except i have this error:
[checking net.minecraft.src.Item]
sources\minecraft\net\minecraft\src\Item.java:305: cannot find symbol
symbol : variable pickaxeDarkgem
location: class net.minecraft.src.Item
pickaxeDarkgem = (new ItemPickaxe(100, EnumToolMaterial.DARKGEM)).setIconCoord(3, 6).setItemName("pickaxeDarkgem");
I have prob, Im trying to make a tool and ive got everything done except i have this error:
[checking net.minecraft.src.Item]
sources\minecraft\net\minecraft\src\Item.java:305: cannot find symbol
symbol : variable pickaxeDarkgem
location: class net.minecraft.src.Item
pickaxeDarkgem = (new ItemPickaxe(100, EnumToolMaterial.DARKGEM)).setIconCoord(3, 6).setItemName("pickaxeDarkgem");
^
that is the error
You need to put public static final Item pickaxeDarckgem; with the rest of the declarations
Okay if you say so. When create the new Item object. put at the end .setItemName("Name");
It might not be itemname might what to check that.
i did that?
can u tell me how i type it i tried .func_ but that didnt work i also tried func_ but it didnt work either
Ah alright guys thanks. Not that great with java, lol, maybe I'll tear apart the original world gen files and see if I can piece something together lol
EDIT: what if I just replaced my blocks in this code and saved as a new world gen?
Twitter
Blog
YouTube
Here is my code:
Here is the error report:
What am i doing wrong?
If you give me more info i might be able to help you what are you trying to do?
im a semi-noob
Thanks for the help. So I removed the Block and it recompiled properly and reobfuscated with no problems.
So I applied the mod to minecraft and it crashes the game whenever i try the recipe...
Any idea why? I'm drained trying to understand how to get this mod working.
Edit. Yep negative number equals night
Here is the error report...
Thanks for the reply and...
Congratulations on the 100th post :smile.gif:
After trying to figure out how to register a block...
This is a code i came up with:
But it gives me this error upon recompiling:
I can't figure out what i need to do to fix it? Can you help?
I dont understand it and i wanna make the house rly good.
Also how do i name my blocks without modloader?
Func_ and itemname arent working...
Oh man! I can't thank you enough... It finally worked... Thanks so much! :smile.gif:)
I wasn't going to say anything because all this guy did was copy and paste the code. The thing he is missing for the boolean is a return type. a line saying
return something;
The little arrow is right below the , in (3, 6)
You need to put public static final Item pickaxeDarckgem; with the rest of the declarations