13 juin 2016, 11:23

Merci beaucoup ! Donc en gros ça ?

@Override
public boolean onBlockDestroyed(ItemStack item, World world, Block block, int x, int y, int z, EntityLivingBase user)
{
 if(!world.isRemote && ForgeHooks.isToolEffective(item, block, world.getBlockMetadata(x, y, z)) && ItemSaw.canAcceptCost(user))
 {
  for(int x1 = -1; x1 <= 1; x1 ++)
  {
   for(int y1 = -1; y1 <= 1; y1 ++)
   {
    for(int z1 = -1; z1 <= 1; z1 ++)
    {
     ForgeDirection FD = getFDFor(user);
     int blockX = x+x1 + FD.offsetX;
     int blockY = y+y1 + FD.offsetY;
     int blockZ = z+z1 + FD.offsetZ;

     if(!(x1+FD.offsetX == 0 && y1+FD.offsetY == 0 &&  z1+FD.offsetZ == 0))
     {
      Block newblock = world.getBlock(blockX, blockY, blockZ);
      int m = world.getBlockMetadata(blockX, blockY, blockZ);

      if(newblock != null && user instanceof EntityPlayer && ForgeHooks.canHarvestBlock(newblock, (EntityPlayer) user, m) && ForgeHooks.isToolEffective(item, newblock, m))
      {
       if(rand.nextFloat()*100F < (100F - ConfigTools.hvyDropChance))
       {
        newblock.dropBlockAsItem(world, blockX, blockY, blockZ, m, EnchantmentHelper.getFortuneModifier(user));
       }
       world.setBlockToAir(blockX, blockY, blockZ);
       item.damageItem(1, user);
       ItemSaw.tirePlayer(user, 1F);
      }
     }
    }  
   }  
  }
 }
 return super.onBlockDestroyed(item, world, block, x, y, z, user);
}

Pomper sur le net par contre mais je pense comprendre la logique qui se cache derrière le code

La source :  http://www.programcreek.com/java-api-examples/index.php?source_dir=MineFantasy2-master/src/main/java/minefantasy/mf2/item/tool/advanced/ItemHvyPick.java