Code (cpp):
package net.minecraft.src;
import java.util.Map;
import java.util.Random;
public class mod_DarkSide extends BaseMod {
static int ii = 530;
static int ib = 130;
//Items
public static final Item ironStick = (new Item(ii++).setFull3D().setItemName("ironStick"));
public static final Item ironTube = (new Item(ii++).setFull3D().setItemName("ironTube"));
public static final Item redCristal = (new Item(ii++).setFull3D().setItemName("redCristal"));
public static final Item blueCristal = (new Item(ii++).setFull3D().setItemName("blueCristal"));
public static final Item greenCristal = (new Item(ii++).setFull3D().setItemName("greenCristal"));
public static final Item purpleCristal = (new Item(ii++).setFull3D().setItemName("purpleCristal"));
public static final Item redLightSaber = (new ItemSword(ii++, EnumToolMaterial.REDCRISTAL).setFull3D().setItemName("RedLightSaber"));
public static final Item blueLightSaber = (new ItemSword(ii++, EnumToolMaterial.BLUECRISTAL).setFull3D().setItemName("BlueLightSaber"));
public static final Item greenLightSaber = (new ItemSword(ii++, EnumToolMaterial.GREENCRISTAL).setFull3D().setItemName("GreenLightSaber"));
public static final Item purpleLightSaber = (new ItemSword(ii++, EnumToolMaterial.PURPLECRISTAL).setFull3D().setItemName("PurpleLightSaber"));
//Blocks
public static final Block redLaser = (new BlockRedLaser(ib++, 0, Material.air)).setHardness(0F).setResistance(0F).setLightValue(1F).setBlockName("redLaser");
public static final Block blueLaser = (new BlockBlueLaser(ib++, 0, Material.air)).setHardness(0F).setResistance(0F).setLightValue(1F).setBlockName("blueLaser");
public static final Block greenLaser = (new BlockGreenLaser(ib++, 0, Material.air)).setHardness(0F).setResistance(0F).setLightValue(1F).setBlockName("greenLaser");
public static final Block purpleLaser = (new BlockPurpleLaser(ib++, 0, Material.air)).setHardness(0F).setResistance(0F).setLightValue(1F).setBlockName("purpleLaser");
public static final Block redCristalOre = (new BlockRedCristal(ib++, 0, Material.rock)).setHardness(2F).setResistance(2F).setBlockName("redCristalOre");
public static final Block blueCristalOre = (new BlockBlueCristal(ib++, 0, Material.rock)).setHardness(2F).setResistance(2F).setBlockName("blueCristalOre");
public static final Block greenCristalOre = (new BlockGreenCristal(ib++, 0, Material.rock)).setHardness(2F).setResistance(2F).setBlockName("greenCristalOre");
public static final Block purpleCristalOre = (new BlockPurpleCristal(ib++, 0, Material.rock)).setHardness(2F).setResistance(2F).setBlockName("purpleCristalOre");
public mod_DarkSide()
{
ModLoader.registerBlock(redCristalOre);
redCristalOre.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/Images/redCristalOre.png");
ModLoader.addName(redCristalOre, "Minerai de cristal rouge");
ModLoader.registerBlock(blueCristalOre);
blueCristalOre.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/Images/blueCristalOre.png");
ModLoader.addName(blueCristalOre, "Minerai de cristal bleu");
ModLoader.registerBlock(greenCristalOre);
greenCristalOre.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/Images/greenCristalOre.png");
ModLoader.addName(greenCristalOre, "Minerai de cristal vert");
ModLoader.registerBlock(purpleCristalOre);
purpleCristalOre.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/Images/purpleCristalOre.png");
ModLoader.addName(purpleCristalOre, "Minerai de cristal violet");
ModLoader.registerBlock(redLaser);
redLaser.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/Images/redLaser.png");
ModLoader.addRecipe(new ItemStack(redLaser, 16), new Object[]{"RDR", " C ", " P ", Character.valueOf('R'), Item.redstone, Character.valueOf('D'), Block.dispenser, Character.valueOf('C'), redCristal, Character.valueOf('P'), Block.pistonBase});
ModLoader.addName(redLaser, "Laser Rouge");
ModLoader.registerBlock(blueLaser);
blueLaser.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/Images/blueLaser.png");
ModLoader.addRecipe(new ItemStack(blueLaser, 16), new Object[]{"RDR", "BCB", "BPB", Character.valueOf('R'), Item.redstone, Character.valueOf('D'), Block.dispenser, Character.valueOf('C'), blueCristal, Character.valueOf('P'), Block.pistonBase, Character.valueOf('B'), Item.diamond});
ModLoader.addName(blueLaser, "Laser Bleu");
ModLoader.registerBlock(greenLaser);
greenLaser.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/Images/greenLaser.png");
ModLoader.addRecipe(new ItemStack(greenLaser, 16), new Object[]{"RDR", " C ", " P ", Character.valueOf('R'), Item.redstone, Character.valueOf('D'), Block.dispenser, Character.valueOf('C'), greenCristal, Character.valueOf('P'), Block.pistonBase});
ModLoader.addName(greenLaser, "Laser Vert");
ModLoader.registerBlock(purpleLaser);
purpleLaser.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/Images/purpleLaser.png");
ModLoader.addRecipe(new ItemStack(purpleLaser, 16), new Object[]{"RDR", " C ", " P ", Character.valueOf('R'), Item.redstone, Character.valueOf('D'), Block.dispenser, Character.valueOf('C'), purpleCristal, Character.valueOf('P'), Block.pistonBase});
ModLoader.addName(purpleLaser, "Laser Violet");
}
public void load() {
//Iron stick
ironStick.iconIndex = ModLoader.addOverride("/gui/items.png", "/Images/ironStick.png");
ModLoader.addRecipe(new ItemStack(ironStick, 2), new Object[]{"I", "I", Character.valueOf('I'), Item.ingotIron});
ModLoader.addName(ironStick, "Bâton de fer");
//Iron tube
ironTube.iconIndex = ModLoader.addOverride("/gui/items.png", "/Images/ironTube.png");
ModLoader.addRecipe(new ItemStack(ironTube, 1), new Object[]{"BIB", "BIB", "BIB", Character.valueOf('I'), ironStick, Character.valueOf('B'), Block.blockSteel});
ModLoader.addName(ironTube, "Tube de fer");
//Red crystal
redCristal.iconIndex = ModLoader.addOverride("/gui/items.png", "/Images/redCristal.png");
ModLoader.addName(redCristal, "Cristal Rouge");
//Blue crystal
blueCristal.iconIndex = ModLoader.addOverride("/gui/items.png", "/Images/blueCristal.png");
ModLoader.addName(blueCristal, "Cristal Bleu");
//Green crystal
greenCristal.iconIndex = ModLoader.addOverride("/gui/items.png", "/Images/greenCristal.png");
ModLoader.addName(greenCristal, "Cristal Vert");
purpleCristal.iconIndex = ModLoader.addOverride("/gui/items.png", "/Images/purpleCristal.png");
ModLoader.addName(purpleCristal, "Cristal Violet");
redLightSaber.iconIndex = ModLoader.addOverride("/gui/items.png", "/Images/redLightSaber.png");
ModLoader.addRecipe(new ItemStack(redLightSaber, 1), new Object[]{"R", "T", Character.valueOf('R'), redCristal, Character.valueOf('T'), ironTube});
ModLoader.addName(redLightSaber, "Sabre laser rouge (Jedi Obscur)");
blueLightSaber.iconIndex = ModLoader.addOverride("/gui/items.png", "/Images/blueLightSaber.png");
ModLoader.addRecipe(new ItemStack(blueLightSaber, 1), new Object[]{"B", "T", Character.valueOf('B'), blueCristal, Character.valueOf('T'), ironTube});
ModLoader.addName(blueLightSaber, "Sabre laser bleu (Jedi)");
greenLightSaber.iconIndex = ModLoader.addOverride("/gui/items.png", "/Images/greenLightSaber.png");
ModLoader.addRecipe(new ItemStack(greenLightSaber, 1), new Object[]{"G", "T", Character.valueOf('G'), greenCristal, Character.valueOf('T'), ironTube});
ModLoader.addName(greenLightSaber, "Sabre laser vert (Jedi)");
purpleLightSaber.iconIndex = ModLoader.addOverride("/gui/items.png", "/Images/purpleLightSaber.png");
ModLoader.addRecipe(new ItemStack(purpleLightSaber, 1), new Object[]{"V", "T", Character.valueOf('V'), purpleCristal, Character.valueOf('T'), ironTube});
ModLoader.addName(purpleLightSaber, "Sabre laser violet (Jedi ou Sith)");
//Monster
ModLoader.registerEntityID(EntityYoda.class, "Yoda", ModLoader.getUniqueEntityId());
ModLoader.addSpawn(EntityYoda.class, 5, 2, 4, EnumCreatureType.monster);
}
public void addRendered(Map map)
{
map.put(EntityYoda.class, new RenderBiped(new ModelBiped(), 0.5F));
}
public void generateSurface(World world, Random random, int chunkX, int chunkZ)
{
for (int i=0 ; i < 5 ; i++)
{
int X = chunkX + random.nextInt(16);
int Y = 5 + random.nextInt(16 - 5);
int Z = chunkZ + random.nextInt(16);
(new WorldGenMinable(redCristalOre.blockID, 5)).generate(world, random, X, Y, Z);
}
for (int i=0 ; i < 5 ; i++)
{
int X = chunkX + random.nextInt(16);
int Y = 5 + random.nextInt(16 - 5);
int Z = chunkZ + random.nextInt(16);
(new WorldGenMinable(blueCristalOre.blockID, 5)).generate(world, random, X, Y, Z);
}
for (int i=0 ; i < 5 ; i++)
{
int X = chunkX + random.nextInt(16);
int Y = 5 + random.nextInt(16 - 5);
int Z = chunkZ + random.nextInt(16);
(new WorldGenMinable(greenCristalOre.blockID, 5)).generate(world, random, X, Y, Z);
}
for (int i=0 ; i < 3 ; i++)
{
int X = chunkX + random.nextInt(16);
int Y = 5 + random.nextInt(16 - 5);
int Z = chunkZ + random.nextInt(16);
(new WorldGenMinable(purpleCristalOre.blockID, 3)).generate(world, random, X, Y, Z);
}
}
public String getVersion() {
return "1.2.5";
}
}