Since none of the existing tutorials seem to be beta-compatible, I thought I'd make an updated version of one.
Note: This tutorial requires the latest version of the Minecraft Coder Pack.
So, once you've set up and decompiled Minecraft.jar, go into the sources/net/minecraft/src directory and make two new files: BlockGlowSand.java and BlockJump.java. These will be our two new blocks.
BlockJump is similar to the jump block in the earlier tutorial, with a few differences.
Type this code in to create the block type:
package net.minecraft.src;
import java.util.Random;
public class BlockJump extends Block
{
public BlockJump(int i, int j)
{
super(i, j, Material.wood);
}
public int idDropped(int i, Random random)
{
return Block.jump.blockID;
}
}
and this in Block.java:
Search for
public static final Block cobblestone;
and add this after it:
public static final Block jump; //*
So now we've told minecraft to make a wooden block called "jump", which is still invisible. So now look in Block.java for
stone = (new BlockStone(1, 1)).setHardness(1.5F).setResistance(10F).setStepSound(soundStoneFootstep).func_20012_a("stone");
and add:
jump = (new BlockJump(92, 74)).setHardness(1.5F).setResistance(10F).setStepSound(soundStoneFootstep).func_20012_a("jump"); //*
This puts the block into slot 92, with texture 74 (the jukebox side). But it's still missing two things: a crafting recipe and the "jumping" feature.
To add a recipe, open up CraftingManager.java and go to the end of the list of recipes. Add this line:
addRecipe(new ItemStack(Block.jump, 2), new Object[] {
"##", Character.valueOf('#'), Block.planks
});
This creates the recipe , to make 2 jump boxes. And now, for the jumping...
put this into BlockJump.java.
public void onEntityWalking(World world, int x, int y, int z, Entity entity)
{
entity.motionY += 2.0;
}
to fling anything on it way up into the air. Be careful!
Now, for the BlockGlowSand. We want it to look like sand, so put this into BlockGlowSand.java:
package net.minecraft.src;
import java.util.Random;
public class BlockGlowSand extends BlockSand
{
public BlockGlowSand(int i, int j)
{
super(i, j);
}
public int idDropped(int i, Random random)
{
return blockID;
}
}
to make a copy of the Sand block. And, of course, add the data in Block.java:
public static final Block glowsand; //*
glowsand = (new BlockGlowSand(93, 105)).setHardness(0.3F).setResistance(10F).setStepSound(soundGravelFootstep).setLightValue(1.0F).func_20012_a("glowsand");//*
This makes a Sand block that looks like glowstone and shines if it's on the ground. Good for spelunking!
Finally, the crafting recipe:
addRecipe(new ItemStack(Block.glowsand, 2), new Object[] {
"##", Character.valueOf('#'), Block.sand
});
The recipe is to make 2 Glowsand blocks. Now recompile and test these new blocks.
(Sorry if this tutorial's kind of unclear, I'll improve it when I understand the coding better. ; ) )
Okay first make the thread title called [TUTORIALS] For beta (Modding) or something.
Secondly people should make tutorials for beta.
Third sceleton theres a .bat called reopf.bat
Fourthy you could just basicly say: How to make the block be lighter, when adding to the block.java add: setLightValue(X.XF)
I followed the tutorial 100%. When I step on the block, however, nothing happens.
Any idea?
Code (BlockJump.java):
package net.minecraft.src;
import java.util.Random;
public class BlockJump extends Block
{
public void onEntityWalking(World world, int x, int y, int z, Entity entity)
{
entity.motionY += 1.5;
}
public BlockJump(int i, int j)
{
super(i, j, Material.wood);
}
public int idDropped(int i, Random random)
{
return Block.jump.blockID;
}
}
Note: This tutorial requires the latest version of the Minecraft Coder Pack.
So, once you've set up and decompiled Minecraft.jar, go into the sources/net/minecraft/src directory and make two new files: BlockGlowSand.java and BlockJump.java. These will be our two new blocks.
BlockJump is similar to the jump block in the earlier tutorial, with a few differences.
Type this code in to create the block type:
and this in Block.java:
Search for and add this after it:
So now we've told minecraft to make a wooden block called "jump", which is still invisible. So now look in Block.java for
and add:
This puts the block into slot 92, with texture 74 (the jukebox side). But it's still missing two things: a crafting recipe and the "jumping" feature.
To add a recipe, open up CraftingManager.java and go to the end of the list of recipes. Add this line:
This creates the recipe , to make 2 jump boxes. And now, for the jumping...
put this into BlockJump.java.
to fling anything on it way up into the air. Be careful!
Now, for the BlockGlowSand. We want it to look like sand, so put this into BlockGlowSand.java:
to make a copy of the Sand block. And, of course, add the data in Block.java:
This makes a Sand block that looks like glowstone and shines if it's on the ground. Good for spelunking!
Finally, the crafting recipe:
The recipe is to make 2 Glowsand blocks. Now recompile and test these new blocks.
(Sorry if this tutorial's kind of unclear, I'll improve it when I understand the coding better. ; ) )
I'll add on to it sooner on how to make it modloader compatible.
Secondly people should make tutorials for beta.
Third sceleton theres a .bat called reopf.bat
Fourthy you could just basicly say: How to make the block be lighter, when adding to the block.java add: setLightValue(X.XF)
Cheers.
Any idea?
Code (BlockJump.java):