Method 2 .com



Method 1Note* This tutorial requires you have a Minecraft Coder Pack(MCP)How to make blocks for your mod.You need to make a new file called BlockExample.java in the src directory.The basic structure of this file is this:package net.minecraft.src;import java.util.Random;public class BlockExample extends Block{ public BlockExample(int i, int j) { super(i, j, Material.rock); } public int idDropped(int i, Random random) { return 0; }}You now need to add this block to Minecraft so that it knows about it. To do this open up Block.javaYou should see a whole bunch of variable declarations towards the bottom of the file, add a new one:public static final Block example;Below the declarations you should see initialisation of these instance variables, initialise your block.example = (new BlockExample(150, 1)).setHardness(1.5F).setResistance(10F).setStepSound(soundStoneFootstep);Like mentioned before this example block is creating a new 'stone' block. new BlockExample(150, 1) creates the new block, the first number is the block id - THIS HAS TO BE UNIQUE, the second number is the graphic of the block, in this case the same as stone.setHardness(1.5F) is the same as stone, this is how long it takes to destroy a block.setResistance(10F) is the same as stone, this is how strong the block is against explosions.setStepSound(soundStoneFootstep) is the same as stone, this is the sound it makes when you walk on it.Note* These numbers can be changed to change the aspects of the block. For example, obsidian has a resistance of 6,000.You have now successfully created a new block class. To use this block just enable cheats and use this command: "/give 150".Method 2You need to make a package called com.*your username*.block.?You need to make a class inside that package called ModBlocks.Create a public static void function called registerBlock().package com.richhobo1216.block;public class ModBlocks { public static void registerBlocks() { }}?Go into your MainRegistry and inside the PreLoad function, type 'ModBlocks.registerBlocks();' and import ModBlocks ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download