Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 9th, 2012  |  syntax: None  |  size: 1.97 KB  |  hits: 21  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. package net.minecraft.src;
  2.  
  3. import java.util.Random;
  4.  
  5. public class mod_TestBlock extends BaseMod {
  6.        
  7.         //Constructor
  8.         public mod_TestBlock() {
  9.                
  10.                 //Registred Blocks
  11.                 ModLoader.registerBlock(testBlock);
  12.                
  13.                 //Added Names
  14.                 ModLoader.addName(testBlock, "Testblock for dungeonlords");
  15.                 ModLoader.addName(Testgem, "A gem from the testblock");
  16.                
  17.                 //Added Overrides
  18.                 testBlock.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/toolfolder/testBlock.png");
  19.                 Testgem.iconIndex = ModLoader.addOverride("/gui/items.png", "/toolfolder/Testgem.png");
  20.                
  21.                 //Crafting Recipes
  22.                 ModLoader.addRecipe(new ItemStack(testBlock, 8), new Object[] {
  23.                         "X X", " X ", Character.valueOf('X'), Block.dirt                       
  24.                 });
  25.                
  26.                 //Furnace Recipes
  27.                 ModLoader.addSmelting(testBlock.blockID, new ItemStack(Block.glass, 10));
  28.                
  29.                 //Other Initializers
  30.                 world = ModLoader.getMinecraftInstance().theWorld;
  31.                                 }
  32.        
  33.         //Generated Blocks
  34.     public void generateSurface(World world, Random random, int i, int j) {
  35.        
  36.         for(int a = 0; a < 20; a++) {
  37.                 int posX = i + random.nextInt(16);
  38.                 int posY = random.nextInt(128);
  39.                 int posZ = j + random.nextInt(16);
  40.                 (new WorldGenMinable(testBlock.blockID, 32)).generate(world, random, posX, posY, posZ);
  41.         }
  42.     }
  43.    
  44.         //Stated Blocks
  45.         public static final Block testBlock;
  46.        
  47.         //Stated Items
  48.         public static Item Testgem;
  49.        
  50.         static {
  51.                 //Initialized Blocks
  52.                 testBlock = new Block(150, 0, Material.rock).setHardness(0.2F).setResistance(10F).setStepSound(Block.soundSandFootstep).setLightValue(1F).setBlockName("testBlock");
  53.                
  54.                 //Initialized Items
  55.                 Testgem = new Item(3000).setItemName("Testgem");
  56.         }
  57.        
  58.         //Other Object
  59.         World world;
  60.        
  61.         //Version
  62.         public String Version() {
  63.                 return "Test mod Block for 1.2.5";
  64.                
  65.         }
  66.  
  67.         @Override
  68.         public String getVersion() {
  69.                 // TODO Auto-generated method stub
  70.                 return null;
  71.         }
  72.  
  73.         @Override
  74.         public void load() {
  75.                 // TODO Auto-generated method stub
  76.                
  77.         }
  78.  
  79. }