Problème avec l'usure des outils

IlernoPian

Architecte en herbe
30 Août 2011
189
22
124
Bonjour, j'ai créé une classe pour une pioche spéciale, j'ai copié dedans tous le code de la pioche plus d'autres fonctions, j'ai mis extends ItemTool, aucune erreur ne s'affiche, mais quand je test, la pioche ne s'use pas quand je casse un bloc (par contre elle s'use quand je tape un mob avec)
Voici le code de la classe :
Code:
package net.minecraft.src;
 
public class ItemMagmaPickaxe extends ItemTool
{
 
    public boolean onItemUse(ItemStack itemstack, EntityPlayer entityplayer, World world, int i, int j, int k, int l)
    {
        world.setBlockWithNotify(i, j, k, Block.lavaMoving.blockID);
        return true;
    }
    public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer)
    {
        entityplayer.heal(+10);
        itemstack.getItem();
        return new ItemStack(Item.bucketLava);
}
    public boolean onBlockDestroyed(ItemStack itemstack, int i, int j, int k, int l, EntityLiving entityliving)
    {
        return false;
    }
    public void onCreated(ItemStack itemstack, World world, EntityPlayer entityplayer)
    {
        world.setWorldTime(16000);
    }
    private static Block blocksEffectiveAgainst[];
 
    protected ItemMagmaPickaxe(int i, EnumToolMaterial enumtoolmaterial)
    {
        super(i, 2, enumtoolmaterial, blocksEffectiveAgainst);
    }
 
    public boolean canHarvestBlock(Block block)
    {
        if (block == Block.obsidian)
        {
            return toolMaterial.getHarvestLevel() == 3;
        }
        if (block == Block.blockDiamond || block == Block.oreDiamond)
        {
            return toolMaterial.getHarvestLevel() >= 2;
        }
        if (block == Block.blockGold || block == Block.oreGold)
        {
            return toolMaterial.getHarvestLevel() >= 2;
        }
        if (block == Block.blockSteel || block == Block.oreIron)
        {
            return toolMaterial.getHarvestLevel() >= 1;
        }
        if (block == Block.blockLapis || block == Block.oreLapis)
        {
            return toolMaterial.getHarvestLevel() >= 1;
        }
        if (block == Block.oreRedstone || block == Block.oreRedstoneGlowing)
        {
            return toolMaterial.getHarvestLevel() >= 2;
        }
        if (block.blockMaterial == Material.rock)
        {
            return true;
        }
        return block.blockMaterial == Material.iron;
    }
 
    public float getStrVsBlock(ItemStack itemstack, Block block)
    {
        if (block != null && (block.blockMaterial == Material.iron || block.blockMaterial == Material.rock))
        {
            return efficiencyOnProperMaterial;
        }
        else
        {
            return super.getStrVsBlock(itemstack, block);
        }
    }
 
    static
    {
        blocksEffectiveAgainst = (new Block[]
                {
                    Block.cobblestone, Block.stairDouble, Block.stairSingle, Block.stone, Block.sandStone, Block.cobblestoneMossy, Block.oreIron, Block.blockSteel, Block.oreCoal, Block.blockGold,
                    Block.oreGold, Block.oreDiamond, Block.blockDiamond, Block.ice, Block.netherrack, Block.oreLapis, Block.blockLapis, Block.oreRedstone, Block.oreRedstoneGlowing, Block.rail,
                    Block.railDetector, Block.railPowered
                });
    }
 
}
J’espère que vous pourrez m'aider.