How can I see what block is originaly broken? If I know that, I can see if it can harvest or not. Because when I destroy dirt it destroys all stone near it atm. That's bugging me.
EDIT: nvm found it and fixed it.
This is what I did.
@Override
public boolean onBlockDestroyed(ItemStack par1ItemStack, World world, int par1, int x, int y, int z, EntityLivingBase player) {
int numBlocks = 0;
Block firstBlock = Block.blocksList[world.getBlockId(x, y, z)];
if(firstBlock != null) {
if(this.canHarvestBlock(firstBlock, par1ItemStack))
{
for(int i=-1;i<=1;i++) {
for(int j=-1;j<=1;j++) {
for(int k=-1;k<=1;k++) {
int l = world.getBlockId(x+i, y+j, z+k);
Block block = Block.blocksList[l];
if(block != null) {
System.out.println("block: " + block.getUnlocalizedName());
System.out.println("can: " + par1ItemStack.canHarvestBlock(block));
System.out.println("numBlocks: " + numBlocks);
if(this.canHarvestBlock(block, par1ItemStack)) {
int par6 = EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId, par1ItemStack);
block.dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x+i, y+j, z+k), par6);
world.setBlockToAir(x+i, y+j, z+k);
numBlocks++;
}
}
}
}
}
par1ItemStack.damageItem(numBlocks/3, player);
}
}
//Block block = Block.blocksList[l]
return false;
}