Ha :s tu à tester sa avec la SwordGold ou une autre ?
Car moi j'ai tester avec :
defaultHeldItem = new ItemStack(Item.swordSteel, 1);
ou encore :
defaultHeldItem = new ItemStack(mod_Nether.netherSword, 1);
et sa n'as pas marcher ...
voila le code de mon bestio :
et ma main class :
Car moi j'ai tester avec :
defaultHeldItem = new ItemStack(Item.swordSteel, 1);
ou encore :
defaultHeldItem = new ItemStack(mod_Nether.netherSword, 1);
et sa n'as pas marcher ...
voila le code de mon bestio :
Code:
package net.minecraft.src;
import java.util.List;
import java.util.Random;
public class EntityWarrior extends EntityMob {
public EntityWarrior(World world) {
super(world);
texture = "/Nether/warrior.png";
moveSpeed = 1.4F;
isImmuneToFire = true;
attackStrength = 5;
}
public int getMaxSpawnedInChunk() {
return 3;
}
public boolean getCanSpawnHere() {
return worldObj.difficultySetting > 0 && worldObj.checkIfAABBIsClear(boundingBox) && worldObj.getCollidingBoundingBoxes(this, boundingBox).size() == 0 && !worldObj.getIsAnyLiquid(boundingBox);
}
public void readEntityFromNBT(NBTTagCompound nbttagcompound) {
super.readEntityFromNBT(nbttagcompound);
}
public void onLivingUpdate() {
super.onLivingUpdate();
}
protected int getDropItemId() {
return mod_Nether.netherPowder.shiftedIndex;
}
}
et ma main class :
Code:
package net.minecraft.src;
import java.util.*;
import java.util.Map;
public class mod_Nether extends BaseMod {
public mod_Nether() {
// Adding stick
netherStick = (new Item(901)).setIconIndex(ModLoader.addOverride("/gui/items.png", "/Nether/stick.png")).setItemName("NeoStick");
ModLoader.AddName(netherStick, "NeoStick");
ModLoader.AddRecipe(new ItemStack(netherStick, 4), new Object[] { "#", "#", Character.valueOf('#'), Block.netherrack });
// Adding ingot
netherIngot = (new Item(902)).setIconIndex(ModLoader.addOverride("/gui/items.png", "/Nether/ingot.png")).setItemName("NeoIngot");
ModLoader.AddName(netherIngot, "NeoIngot");
ModLoader.AddRecipe(new ItemStack(netherIngot, 2), new Object[] { "#", Character.valueOf('#'), Block.netherrack });
// Adding Sword
netherSword = (new ItemSword(903, EnumToolMaterial.IRON)).setIconIndex(ModLoader.addOverride("/gui/items.png", "/Nether/sword.png")).setItemName("NeoSword");
ModLoader.AddName(netherSword, "NeoSword");
ModLoader.AddRecipe(new ItemStack(netherSword, 1), new Object[] { "#", "#", "%", Character.valueOf('#'), netherIngot, Character.valueOf('%'), netherStick });
// Adding Shovel
netherShovel = (new ItemSpade(904, EnumToolMaterial.IRON)).setIconIndex(ModLoader.addOverride("/gui/items.png", "/Nether/shovel.png")).setItemName("NeoShovel");
ModLoader.AddName(netherShovel, "NeoShovel");
ModLoader.AddRecipe(new ItemStack(netherShovel, 1), new Object[] { "#", "%", "%", Character.valueOf('#'), netherIngot, Character.valueOf('%'), netherStick });
// Adding Pickaxe
netherPickaxe = (new ItemPickaxe(905, EnumToolMaterial.IRON)).setIconIndex(ModLoader.addOverride("/gui/items.png", "/Nether/pickaxe.png")).setItemName("NeoPickaxe");
ModLoader.AddName(netherPickaxe, "NeoPickaxe");
ModLoader.AddRecipe(new ItemStack(netherPickaxe, 1), new Object[] { "###", " % ", " % ", Character.valueOf('#'), netherIngot, Character.valueOf('%'), netherStick });
// Adding Axe
netherAxe = (new ItemAxe(906, EnumToolMaterial.IRON)).setIconIndex(ModLoader.addOverride("/gui/items.png", "/Nether/axe.png")).setItemName("NeoAxe");
ModLoader.AddName(netherAxe, "NeoAxe");
ModLoader.AddRecipe(new ItemStack(netherAxe, 1), new Object[] { "##", "#%", " %", Character.valueOf('#'), netherIngot, Character.valueOf('%'), netherStick });
// Adding powder
netherPowder = (new Item(907)).setIconIndex(ModLoader.addOverride("/gui/items.png", "/Nether/powder.png")).setItemName("NeoPowder");
ModLoader.AddName(netherPowder, "NeoPowder");
ModLoader.AddRecipe(new ItemStack(netherPowder, 1), new Object[] { "#", Character.valueOf('#'), netherIngot });
// Adding Workbench
ModLoader.RegisterBlock(netherWorkbench);
ModLoader.AddRecipe(new ItemStack(netherWorkbench, 1), new Object[] { "##", "##", Character.valueOf('#'), netherIngot });
ModLoader.AddName(netherWorkbench, "NeoWorkbench");
// Adding chest
ModLoader.RegisterBlock(netherChest);
ModLoader.AddRecipe(new ItemStack(netherChest, 1), new Object[] { "###", "# #", "###", Character.valueOf('#'), netherIngot });
ModLoader.AddName(netherChest, "NeoChest");
// Mobs regisration and spawn
ModLoader.RegisterEntityID(EntityDamned.class, "Damned", ModLoader.getUniqueEntityId());
ModLoader.AddSpawn(EntityDamned.class, 80, EnumCreatureType.monster, (new BiomeGenBase[]{BiomeGenBase.hell}));
ModLoader.RegisterEntityID(EntitySpirit.class, "Spirit", ModLoader.getUniqueEntityId());
ModLoader.AddSpawn(EntitySpirit.class, 30, EnumCreatureType.monster, (new BiomeGenBase[]{BiomeGenBase.hell}));
ModLoader.RegisterEntityID(EntityWarrior.class, "Warrior", ModLoader.getUniqueEntityId());
ModLoader.AddSpawn(EntityWarrior.class, 60, EnumCreatureType.monster, (new BiomeGenBase[]{BiomeGenBase.hell}));
}
// Version
public String Version() {
return "1.5_01";
}
// Add render to mobs
public void AddARenderer(Map map) {
map.put(EntityDamned.class, new RenderBiped(new ModelBiped(),0.5F));
map.put(EntitySpirit.class, new RenderBiped(new ModelBiped(),0.5F));
map.put(EntityWarrior.class, new RenderBiped(new ModelBiped(),0.5F));
}
// Items declaration
public static Item netherStick;
public static Item netherIngot;
public static Item netherShovel;
public static Item netherPickaxe;
public static Item netherAxe;
public static Item netherSword;
public static Item netherPowder;
// Blocks declarations
public static final Block netherWorkbench = (new Block(100, ModLoader.addOverride("/terrain.png", "/Nether/ingot.png"), Material.wood)).setHardness(2.0F).setResistance(10F).setStepSound(Block.soundWoodFootstep).setBlockName("NeoWorkbench");
public static final Block netherChest = (new Block(101, ModLoader.addOverride("/terrain.png", "/Nether/ingot.png"), Material.wood)).setHardness(2.0F).setResistance(10F).setStepSound(Block.soundWoodFootstep).setBlockName("NeoChest");
}