//System.out.println(cmp.getCompoundTag("TCResearch").getTagList("TCResearchList").tagCount());
boolean done = false;
if (leftClick) {
Entity entity = detectedEntities.isEmpty() ? null : detectedEntities.get(worldObj.rand.nextInt(detectedEntities.size()));
if (entity != null) {
player.getAttributeMap().applyAttributeModifiers(stack.getAttributeModifiers()); // Set attack strenght
player.attackTargetEntityWithCurrentItem(entity);
done = true;
} else if (!isBreaking) {
if (block != Blocks.air && !block.isAir(worldObj, coords.posX, coords.posY, coords.posZ) && block.getBlockHardness(worldObj, coords.posX, coords.posY, coords.posZ) >= 0) {
isBreaking = true;
startBreaking(block, worldObj.getBlockMetadata(coords.posX, coords.posY, coords.posZ));
done = true;
}
}
} else {
int side = SIDES[(getBlockMetadata() & 7) - 2].getOpposite().ordinal();
if (!(block != Blocks.air && !block.isAir(worldObj, coords.posX, coords.posY, coords.posZ))) {
coords.posY -= 1;
side = ForgeDirection.UP.ordinal();
block = worldObj.getBlock(coords.posX, coords.posY, coords.posZ);
}
try {
ForgeEventFactory.onPlayerInteract(player, Action.RIGHT_CLICK_AIR, coords.posX, coords.posY, coords.posZ, side,worldObj);
Entity entity = detectedEntities.isEmpty() ? null : detectedEntities.get(worldObj.rand.nextInt(detectedEntities.size()));
done = entity != null && entity instanceof EntityLiving && (item.itemInteractionForEntity(stack, player, (EntityLivingBase) entity) || (!(entity instanceof EntityAnimal) || ((EntityAnimal) entity).interact(player)));
if (!done)
item.onItemUseFirst(stack, player, worldObj, coords.posX, coords.posY, coords.posZ, side, 0F, 0F, 0F);
if (!done)